| OLD | NEW |
| 1 //===- subzero/crosstest/test_sync_atomic_main.cpp - Driver for tests -----===// | 1 //===- subzero/crosstest/test_sync_atomic_main.cpp - Driver for tests -----===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // Driver for cross testing atomic intrinsics, via the sync builtins. | 10 // Driver for cross testing atomic intrinsics, via the sync builtins. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 153 } |
| 154 | 154 |
| 155 template <typename Type> struct ThreadData { | 155 template <typename Type> struct ThreadData { |
| 156 Type (*FuncPtr)(bool, volatile Type *, Type); | 156 Type (*FuncPtr)(bool, volatile Type *, Type); |
| 157 bool Fetch; | 157 bool Fetch; |
| 158 volatile Type *Ptr; | 158 volatile Type *Ptr; |
| 159 Type Adjustment; | 159 Type Adjustment; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 template <typename Type> void *threadWrapper(void *Data) { | 162 template <typename Type> void *threadWrapper(void *Data) { |
| 163 #ifdef ARM32 | 163 #if defined(ARM32) || defined(MIPS32) |
| 164 // Given that most of times these crosstests for ARM are run under qemu, we | 164 // Given that most of times these crosstests for ARM are run under qemu, we |
| 165 // set a lower NumReps to allow crosstests to complete within a reasonable | 165 // set a lower NumReps to allow crosstests to complete within a reasonable |
| 166 // amount of time. | 166 // amount of time. |
| 167 static const size_t NumReps = 1000; | 167 static const size_t NumReps = 1000; |
| 168 #else // ARM32 | 168 #else // ARM32 || MIPS32 |
| 169 static const size_t NumReps = 8000; | 169 static const size_t NumReps = 8000; |
| 170 #endif // ARM32 | 170 #endif // ARM32 || MIPS32 |
| 171 | 171 |
| 172 ThreadData<Type> *TData = reinterpret_cast<ThreadData<Type> *>(Data); | 172 ThreadData<Type> *TData = reinterpret_cast<ThreadData<Type> *>(Data); |
| 173 for (size_t i = 0; i < NumReps; ++i) { | 173 for (size_t i = 0; i < NumReps; ++i) { |
| 174 (void)TData->FuncPtr(TData->Fetch, TData->Ptr, TData->Adjustment); | 174 (void)TData->FuncPtr(TData->Fetch, TData->Ptr, TData->Adjustment); |
| 175 } | 175 } |
| 176 return NULL; | 176 return NULL; |
| 177 } | 177 } |
| 178 | 178 |
| 179 template <typename Type> | 179 template <typename Type> |
| 180 void testAtomicRMWThreads(volatile Type *AtomicLoc, size_t &TotalTests, | 180 void testAtomicRMWThreads(volatile Type *AtomicLoc, size_t &TotalTests, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 testValCompareAndSwap<uint64>(&AtomicLocs.l64, TotalTests, Passes, Failures); | 281 testValCompareAndSwap<uint64>(&AtomicLocs.l64, TotalTests, Passes, Failures); |
| 282 testAtomicRMWThreads<uint8_t>(&AtomicLocs.l8, TotalTests, Passes, Failures); | 282 testAtomicRMWThreads<uint8_t>(&AtomicLocs.l8, TotalTests, Passes, Failures); |
| 283 testAtomicRMWThreads<uint16_t>(&AtomicLocs.l16, TotalTests, Passes, Failures); | 283 testAtomicRMWThreads<uint16_t>(&AtomicLocs.l16, TotalTests, Passes, Failures); |
| 284 testAtomicRMWThreads<uint32_t>(&AtomicLocs.l32, TotalTests, Passes, Failures); | 284 testAtomicRMWThreads<uint32_t>(&AtomicLocs.l32, TotalTests, Passes, Failures); |
| 285 testAtomicRMWThreads<uint64>(&AtomicLocs.l64, TotalTests, Passes, Failures); | 285 testAtomicRMWThreads<uint64>(&AtomicLocs.l64, TotalTests, Passes, Failures); |
| 286 | 286 |
| 287 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes | 287 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes |
| 288 << " Failures=" << Failures << "\n"; | 288 << " Failures=" << Failures << "\n"; |
| 289 return Failures; | 289 return Failures; |
| 290 } | 290 } |
| OLD | NEW |