Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 294010b562c9846bb2bc4ee9c63ff78adc7c1f4f Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Lisandro=20Dami=C3=A1n=20Nicanor=20P=C3=A9rez=20Meyer?= |
| 3 | <perezmeyer@gmail.com> |
| 4 | Date: Sat, 15 Mar 2014 15:40:49 -0300 |
| 5 | Subject: [PATCH] Add qatomic support for AArch64 (aka arm64). |
| 6 | |
| 7 | Patch by Mark Salter <msalter@redhat.com> |
| 8 | licensed under BSD: |
| 9 | |
| 10 | <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=735488#195> |
| 11 | |
| 12 | This patch is known to not be the most correct way |
| 13 | to implement them, as it seems to be possible to do it in a faster way, |
| 14 | but should work non the less until we can provide something better. |
| 15 | |
| 16 | Change-Id: Ib392b27dc54691fd4c2ea9896240ad71fb8128cc |
| 17 | |
| 18 | |
| 19 | Upstream-Status: Pending |
| 20 | |
| 21 | Signed-off-by: Kai Kang <kai.kang@windriver.com> |
| 22 | |
| 23 | --- |
| 24 | src/corelib/arch/aarch64/arch.pri | 4 + |
| 25 | src/corelib/arch/aarch64/qatomic_aarch64.cpp | 70 ++++++ |
| 26 | src/corelib/arch/arch.pri | 4 +- |
| 27 | src/corelib/arch/qatomic_aarch64.h | 335 +++++++++++++++++++++++++++ |
| 28 | src/corelib/arch/qatomic_arch.h | 2 + |
| 29 | 5 files changed, 414 insertions(+), 1 deletion(-) |
| 30 | create mode 100644 src/corelib/arch/aarch64/arch.pri |
| 31 | create mode 100644 src/corelib/arch/aarch64/qatomic_aarch64.cpp |
| 32 | create mode 100644 src/corelib/arch/qatomic_aarch64.h |
| 33 | |
| 34 | diff --git a/src/corelib/arch/aarch64/arch.pri b/src/corelib/arch/aarch64/arch.pri |
| 35 | new file mode 100644 |
| 36 | index 0000000..63523d9 |
| 37 | --- /dev/null |
| 38 | +++ b/src/corelib/arch/aarch64/arch.pri |
| 39 | @@ -0,0 +1,4 @@ |
| 40 | +# |
| 41 | +# AArch64 architecture |
| 42 | +# |
| 43 | +SOURCES += $$QT_ARCH_CPP/qatomic_aarch64.cpp |
| 44 | diff --git a/src/corelib/arch/aarch64/qatomic_aarch64.cpp b/src/corelib/arch/aarch64/qatomic_aarch64.cpp |
| 45 | new file mode 100644 |
| 46 | index 0000000..fc851b9 |
| 47 | --- /dev/null |
| 48 | +++ b/src/corelib/arch/aarch64/qatomic_aarch64.cpp |
| 49 | @@ -0,0 +1,70 @@ |
| 50 | +/**************************************************************************** |
| 51 | +** |
| 52 | +** Copyright (C) 2012, 2013 Digia Plc and/or its subsidiary(-ies). |
| 53 | +** Contact: http://www.qt-project.org/legal |
| 54 | +** |
| 55 | +** This file is part of the QtCore module of the Qt Toolkit. |
| 56 | +** |
| 57 | +** $QT_BEGIN_LICENSE:LGPL$ |
| 58 | +** Commercial License Usage |
| 59 | +** Licensees holding valid commercial Qt licenses may use this file in |
| 60 | +** accordance with the commercial license agreement provided with the |
| 61 | +** Software or, alternatively, in accordance with the terms contained in |
| 62 | +** a written agreement between you and Digia. For licensing terms and |
| 63 | +** conditions see http://qt.digia.com/licensing. For further information |
| 64 | +** use the contact form at http://qt.digia.com/contact-us. |
| 65 | +** |
| 66 | +** GNU Lesser General Public License Usage |
| 67 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
| 68 | +** General Public License version 2.1 as published by the Free Software |
| 69 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
| 70 | +** packaging of this file. Please review the following information to |
| 71 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
| 72 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 73 | +** |
| 74 | +** In addition, as a special exception, Digia gives you certain additional |
| 75 | +** rights. These rights are described in the Digia Qt LGPL Exception |
| 76 | +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 77 | +** |
| 78 | +** GNU General Public License Usage |
| 79 | +** Alternatively, this file may be used under the terms of the GNU |
| 80 | +** General Public License version 3.0 as published by the Free Software |
| 81 | +** Foundation and appearing in the file LICENSE.GPL included in the |
| 82 | +** packaging of this file. Please review the following information to |
| 83 | +** ensure the GNU General Public License version 3.0 requirements will be |
| 84 | +** met: http://www.gnu.org/copyleft/gpl.html. |
| 85 | +** |
| 86 | +** |
| 87 | +** $QT_END_LICENSE$ |
| 88 | +** |
| 89 | +****************************************************************************/ |
| 90 | + |
| 91 | +#include <QtCore/qglobal.h> |
| 92 | + |
| 93 | +#include <unistd.h> |
| 94 | +#ifdef _POSIX_PRIORITY_SCHEDULING |
| 95 | +# include <sched.h> |
| 96 | +#endif |
| 97 | +#include <time.h> |
| 98 | + |
| 99 | +QT_BEGIN_NAMESPACE |
| 100 | + |
| 101 | +QT_USE_NAMESPACE |
| 102 | + |
| 103 | +Q_CORE_EXPORT void qt_atomic_yield(int *count) |
| 104 | +{ |
| 105 | +#ifdef _POSIX_PRIORITY_SCHEDULING |
| 106 | + if ((*count)++ < 50) { |
| 107 | + sched_yield(); |
| 108 | + } else |
| 109 | +#endif |
| 110 | + { |
| 111 | + struct timespec tm; |
| 112 | + tm.tv_sec = 0; |
| 113 | + tm.tv_nsec = 2000001; |
| 114 | + nanosleep(&tm, NULL); |
| 115 | + *count = 0; |
| 116 | + } |
| 117 | +} |
| 118 | + |
| 119 | +QT_END_NAMESPACE |
| 120 | diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri |
| 121 | index cd23e5e..f50fca7 100644 |
| 122 | --- a/src/corelib/arch/arch.pri |
| 123 | +++ b/src/corelib/arch/arch.pri |
| 124 | @@ -31,7 +31,9 @@ integrity:HEADERS += arch/qatomic_integrity.h |
| 125 | arch/qatomic_s390.h \ |
| 126 | arch/qatomic_x86_64.h \ |
| 127 | arch/qatomic_sh.h \ |
| 128 | - arch/qatomic_sh4a.h |
| 129 | + arch/qatomic_sh4a.h \ |
| 130 | + arch/qatomic_aarch64.h \ |
| 131 | + |
| 132 | |
| 133 | QT_ARCH_CPP = $$QT_SOURCE_TREE/src/corelib/arch/$$QT_ARCH |
| 134 | DEPENDPATH += $$QT_ARCH_CPP |
| 135 | diff --git a/src/corelib/arch/qatomic_aarch64.h b/src/corelib/arch/qatomic_aarch64.h |
| 136 | new file mode 100644 |
| 137 | index 0000000..de61ca8 |
| 138 | --- /dev/null |
| 139 | +++ b/src/corelib/arch/qatomic_aarch64.h |
| 140 | @@ -0,0 +1,335 @@ |
| 141 | +/**************************************************************************** |
| 142 | +** |
| 143 | +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
| 144 | +** Contact: http://www.qt-project.org/legal |
| 145 | +** |
| 146 | +** This file is part of the QtCore module of the Qt Toolkit. |
| 147 | +** |
| 148 | +** $QT_BEGIN_LICENSE:LGPL$ |
| 149 | +** Commercial License Usage |
| 150 | +** Licensees holding valid commercial Qt licenses may use this file in |
| 151 | +** accordance with the commercial license agreement provided with the |
| 152 | +** Software or, alternatively, in accordance with the terms contained in |
| 153 | +** a written agreement between you and Digia. For licensing terms and |
| 154 | +** conditions see http://qt.digia.com/licensing. For further information |
| 155 | +** use the contact form at http://qt.digia.com/contact-us. |
| 156 | +** |
| 157 | +** GNU Lesser General Public License Usage |
| 158 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
| 159 | +** General Public License version 2.1 as published by the Free Software |
| 160 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
| 161 | +** packaging of this file. Please review the following information to |
| 162 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
| 163 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 164 | +** |
| 165 | +** In addition, as a special exception, Digia gives you certain additional |
| 166 | +** rights. These rights are described in the Digia Qt LGPL Exception |
| 167 | +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 168 | +** |
| 169 | +** GNU General Public License Usage |
| 170 | +** Alternatively, this file may be used under the terms of the GNU |
| 171 | +** General Public License version 3.0 as published by the Free Software |
| 172 | +** Foundation and appearing in the file LICENSE.GPL included in the |
| 173 | +** packaging of this file. Please review the following information to |
| 174 | +** ensure the GNU General Public License version 3.0 requirements will be |
| 175 | +** met: http://www.gnu.org/copyleft/gpl.html. |
| 176 | +** |
| 177 | +** |
| 178 | +** $QT_END_LICENSE$ |
| 179 | +** |
| 180 | +****************************************************************************/ |
| 181 | + |
| 182 | +#ifndef QATOMIC_AARCH64_H |
| 183 | +#define QATOMIC_AARCH64_H |
| 184 | + |
| 185 | +QT_BEGIN_HEADER |
| 186 | + |
| 187 | +QT_BEGIN_NAMESPACE |
| 188 | + |
| 189 | +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE |
| 190 | + |
| 191 | +inline bool QBasicAtomicInt::isReferenceCountingNative() |
| 192 | +{ return true; } |
| 193 | +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() |
| 194 | +{ return false; } |
| 195 | + |
| 196 | +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE |
| 197 | + |
| 198 | +inline bool QBasicAtomicInt::isTestAndSetNative() |
| 199 | +{ return true; } |
| 200 | +inline bool QBasicAtomicInt::isTestAndSetWaitFree() |
| 201 | +{ return false; } |
| 202 | + |
| 203 | +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE |
| 204 | + |
| 205 | +inline bool QBasicAtomicInt::isFetchAndStoreNative() |
| 206 | +{ return true; } |
| 207 | +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() |
| 208 | +{ return false; } |
| 209 | + |
| 210 | +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE |
| 211 | + |
| 212 | +inline bool QBasicAtomicInt::isFetchAndAddNative() |
| 213 | +{ return true; } |
| 214 | +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() |
| 215 | +{ return false; } |
| 216 | + |
| 217 | +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE |
| 218 | + |
| 219 | +template <typename T> |
| 220 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() |
| 221 | +{ return true; } |
| 222 | +template <typename T> |
| 223 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() |
| 224 | +{ return false; } |
| 225 | + |
| 226 | +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE |
| 227 | + |
| 228 | +template <typename T> |
| 229 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() |
| 230 | +{ return true; } |
| 231 | +template <typename T> |
| 232 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() |
| 233 | +{ return false; } |
| 234 | + |
| 235 | +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE |
| 236 | + |
| 237 | +template <typename T> |
| 238 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() |
| 239 | +{ return true; } |
| 240 | +template <typename T> |
| 241 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() |
| 242 | +{ return false; } |
| 243 | + |
| 244 | +#ifndef Q_DATA_MEMORY_BARRIER |
| 245 | +# define Q_DATA_MEMORY_BARRIER asm volatile("dmb sy\n":::"memory") |
| 246 | +#endif |
| 247 | +#ifndef Q_COMPILER_MEMORY_BARRIER |
| 248 | +# define Q_COMPILER_MEMORY_BARRIER asm volatile("":::"memory") |
| 249 | +#endif |
| 250 | + |
| 251 | +inline bool QBasicAtomicInt::ref() |
| 252 | +{ |
| 253 | + int newValue; |
| 254 | + |
| 255 | + Q_COMPILER_MEMORY_BARRIER; |
| 256 | + newValue = __atomic_add_fetch(&_q_value, 1, __ATOMIC_ACQ_REL); |
| 257 | + Q_COMPILER_MEMORY_BARRIER; |
| 258 | + |
| 259 | + return newValue != 0; |
| 260 | +} |
| 261 | + |
| 262 | +inline bool QBasicAtomicInt::deref() |
| 263 | +{ |
| 264 | + int newValue; |
| 265 | + |
| 266 | + Q_COMPILER_MEMORY_BARRIER; |
| 267 | + newValue = __atomic_sub_fetch(&_q_value, 1, __ATOMIC_ACQ_REL); |
| 268 | + Q_COMPILER_MEMORY_BARRIER; |
| 269 | + |
| 270 | + return newValue != 0; |
| 271 | +} |
| 272 | + |
| 273 | +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) |
| 274 | +{ |
| 275 | + bool val; |
| 276 | + |
| 277 | + Q_COMPILER_MEMORY_BARRIER; |
| 278 | + val = __atomic_compare_exchange_n (&_q_value, &expectedValue, newValue, |
| 279 | + false, __ATOMIC_RELAXED, __ATOMIC_RELAXED); |
| 280 | + Q_COMPILER_MEMORY_BARRIER; |
| 281 | + return val; |
| 282 | +} |
| 283 | + |
| 284 | +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) |
| 285 | +{ |
| 286 | + int val; |
| 287 | + Q_COMPILER_MEMORY_BARRIER; |
| 288 | + val = __atomic_exchange_n(&_q_value, newValue, __ATOMIC_RELAXED); |
| 289 | + Q_COMPILER_MEMORY_BARRIER; |
| 290 | + return val; |
| 291 | +} |
| 292 | + |
| 293 | +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) |
| 294 | +{ |
| 295 | + int val; |
| 296 | + Q_COMPILER_MEMORY_BARRIER; |
| 297 | + val = __atomic_fetch_add(&_q_value, valueToAdd, __ATOMIC_RELAXED); |
| 298 | + Q_COMPILER_MEMORY_BARRIER; |
| 299 | + return val; |
| 300 | +} |
| 301 | + |
| 302 | +template <typename T> |
| 303 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) |
| 304 | +{ |
| 305 | + bool val; |
| 306 | + Q_COMPILER_MEMORY_BARRIER; |
| 307 | + val = __atomic_compare_exchange_n (&_q_value, &expectedValue, newValue, |
| 308 | + false, __ATOMIC_RELAXED, __ATOMIC_RELAXED); |
| 309 | + Q_COMPILER_MEMORY_BARRIER; |
| 310 | + return val; |
| 311 | +} |
| 312 | + |
| 313 | +template <typename T> |
| 314 | +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) |
| 315 | +{ |
| 316 | + T *val; |
| 317 | + Q_COMPILER_MEMORY_BARRIER; |
| 318 | + val = __atomic_exchange_n(&_q_value, newValue, __ATOMIC_RELAXED); |
| 319 | + Q_COMPILER_MEMORY_BARRIER; |
| 320 | + return val; |
| 321 | +} |
| 322 | + |
| 323 | +template <typename T> |
| 324 | +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) |
| 325 | +{ |
| 326 | + T *val; |
| 327 | + Q_COMPILER_MEMORY_BARRIER; |
| 328 | + val = __atomic_fetch_add(&_q_value, valueToAdd, __ATOMIC_RELAXED); |
| 329 | + Q_COMPILER_MEMORY_BARRIER; |
| 330 | + return val; |
| 331 | +} |
| 332 | + |
| 333 | +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) |
| 334 | +{ |
| 335 | + bool returnValue = testAndSetRelaxed(expectedValue, newValue); |
| 336 | + Q_DATA_MEMORY_BARRIER; |
| 337 | + return returnValue; |
| 338 | +} |
| 339 | + |
| 340 | +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) |
| 341 | +{ |
| 342 | + Q_DATA_MEMORY_BARRIER; |
| 343 | + return testAndSetRelaxed(expectedValue, newValue); |
| 344 | +} |
| 345 | + |
| 346 | +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) |
| 347 | +{ |
| 348 | + Q_DATA_MEMORY_BARRIER; |
| 349 | + bool returnValue = testAndSetRelaxed(expectedValue, newValue); |
| 350 | + Q_COMPILER_MEMORY_BARRIER; |
| 351 | + return returnValue; |
| 352 | +} |
| 353 | + |
| 354 | +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) |
| 355 | +{ |
| 356 | + int returnValue = fetchAndStoreRelaxed(newValue); |
| 357 | + Q_DATA_MEMORY_BARRIER; |
| 358 | + return returnValue; |
| 359 | +} |
| 360 | + |
| 361 | +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) |
| 362 | +{ |
| 363 | + Q_DATA_MEMORY_BARRIER; |
| 364 | + return fetchAndStoreRelaxed(newValue); |
| 365 | +} |
| 366 | + |
| 367 | +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) |
| 368 | +{ |
| 369 | + Q_DATA_MEMORY_BARRIER; |
| 370 | + int returnValue = fetchAndStoreRelaxed(newValue); |
| 371 | + Q_COMPILER_MEMORY_BARRIER; |
| 372 | + return returnValue; |
| 373 | +} |
| 374 | + |
| 375 | +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) |
| 376 | +{ |
| 377 | + int returnValue = fetchAndAddRelaxed(valueToAdd); |
| 378 | + Q_DATA_MEMORY_BARRIER; |
| 379 | + return returnValue; |
| 380 | +} |
| 381 | + |
| 382 | +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) |
| 383 | +{ |
| 384 | + Q_DATA_MEMORY_BARRIER; |
| 385 | + return fetchAndAddRelaxed(valueToAdd); |
| 386 | +} |
| 387 | + |
| 388 | +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) |
| 389 | +{ |
| 390 | + Q_DATA_MEMORY_BARRIER; |
| 391 | + int returnValue = fetchAndAddRelaxed(valueToAdd); |
| 392 | + Q_COMPILER_MEMORY_BARRIER; |
| 393 | + return returnValue; |
| 394 | +} |
| 395 | + |
| 396 | +template <typename T> |
| 397 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) |
| 398 | +{ |
| 399 | + bool returnValue = testAndSetRelaxed(expectedValue, newValue); |
| 400 | + Q_DATA_MEMORY_BARRIER; |
| 401 | + return returnValue; |
| 402 | +} |
| 403 | + |
| 404 | +template <typename T> |
| 405 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) |
| 406 | +{ |
| 407 | + Q_DATA_MEMORY_BARRIER; |
| 408 | + return testAndSetRelaxed(expectedValue, newValue); |
| 409 | +} |
| 410 | + |
| 411 | +template <typename T> |
| 412 | +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) |
| 413 | +{ |
| 414 | + Q_DATA_MEMORY_BARRIER; |
| 415 | + bool returnValue = testAndSetAcquire(expectedValue, newValue); |
| 416 | + Q_COMPILER_MEMORY_BARRIER; |
| 417 | + return returnValue; |
| 418 | +} |
| 419 | + |
| 420 | +template <typename T> |
| 421 | +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) |
| 422 | +{ |
| 423 | + T *returnValue = fetchAndStoreRelaxed(newValue); |
| 424 | + Q_DATA_MEMORY_BARRIER; |
| 425 | + return returnValue; |
| 426 | +} |
| 427 | + |
| 428 | +template <typename T> |
| 429 | +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) |
| 430 | +{ |
| 431 | + Q_DATA_MEMORY_BARRIER; |
| 432 | + return fetchAndStoreRelaxed(newValue); |
| 433 | +} |
| 434 | + |
| 435 | +template <typename T> |
| 436 | +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) |
| 437 | +{ |
| 438 | + Q_DATA_MEMORY_BARRIER; |
| 439 | + T *returnValue = fetchAndStoreRelaxed(newValue); |
| 440 | + Q_COMPILER_MEMORY_BARRIER; |
| 441 | + return returnValue; |
| 442 | +} |
| 443 | + |
| 444 | +template <typename T> |
| 445 | +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) |
| 446 | +{ |
| 447 | + T *returnValue = fetchAndAddRelaxed(valueToAdd); |
| 448 | + Q_DATA_MEMORY_BARRIER; |
| 449 | + return returnValue; |
| 450 | +} |
| 451 | + |
| 452 | +template <typename T> |
| 453 | +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) |
| 454 | +{ |
| 455 | + Q_DATA_MEMORY_BARRIER; |
| 456 | + return fetchAndAddRelaxed(valueToAdd); |
| 457 | +} |
| 458 | + |
| 459 | +template <typename T> |
| 460 | +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) |
| 461 | +{ |
| 462 | + Q_DATA_MEMORY_BARRIER; |
| 463 | + T *returnValue = fetchAndAddRelaxed(valueToAdd); |
| 464 | + Q_COMPILER_MEMORY_BARRIER; |
| 465 | + return returnValue; |
| 466 | +} |
| 467 | + |
| 468 | +#undef Q_DATA_MEMORY_BARRIER |
| 469 | +#undef Q_COMPILER_MEMORY_BARRIER |
| 470 | + |
| 471 | +QT_END_NAMESPACE |
| 472 | + |
| 473 | +QT_END_HEADER |
| 474 | + |
| 475 | +#endif // QATOMIC_AARCH64_H |
| 476 | diff --git a/src/corelib/arch/qatomic_arch.h b/src/corelib/arch/qatomic_arch.h |
| 477 | index 141726c..3e96926 100644 |
| 478 | --- a/src/corelib/arch/qatomic_arch.h |
| 479 | +++ b/src/corelib/arch/qatomic_arch.h |
| 480 | @@ -94,6 +94,8 @@ QT_BEGIN_HEADER |
| 481 | # include "QtCore/qatomic_sh4a.h" |
| 482 | #elif defined(QT_ARCH_NACL) |
| 483 | # include "QtCore/qatomic_generic.h" |
| 484 | +#elif defined(QT_ARCH_AARCH64) |
| 485 | +# include "QtCore/qatomic_aarch64.h" |
| 486 | #else |
| 487 | # error "Qt has not been ported to this architecture" |
| 488 | #endif |
| 489 | -- |
| 490 | 2.1.0 |
| 491 | |