[test-suite] r178594 - Add test for atomic addition and subtraction. <rdar://problem/13549656>
Bill Wendling
isanbard at gmail.com
Tue Apr 2 17:04:27 PDT 2013
Author: void
Date: Tue Apr 2 19:04:26 2013
New Revision: 178594
URL: http://llvm.org/viewvc/llvm-project?rev=178594&view=rev
Log:
Add test for atomic addition and subtraction. <rdar://problem/13549656>
Modified:
test-suite/trunk/SingleSource/UnitTests/AtomicOps.c
test-suite/trunk/SingleSource/UnitTests/AtomicOps.reference_output
Modified: test-suite/trunk/SingleSource/UnitTests/AtomicOps.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/AtomicOps.c?rev=178594&r1=178593&r2=178594&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/AtomicOps.c (original)
+++ test-suite/trunk/SingleSource/UnitTests/AtomicOps.c Tue Apr 2 19:04:26 2013
@@ -7,11 +7,24 @@ int foo(volatile *mem, int val, int c) {
volatile int x = 0;
int main() {
+ long long test = 0;
+ int i;
int y = foo(&x, 1, 2);
printf("%d, %d\n", y, x);
y = __sync_val_compare_and_swap(&x, 1, 2);
printf("%d, %d\n", y, x);
y = __sync_lock_test_and_set(&x, 1);
printf("%d, %d\n", y, x);
+
+ for (i = 0; i < 5; i++) {
+ __sync_add_and_fetch(&test, 1);
+ printf("test = %d\n", (int)test);
+ }
+
+ for (i = 0; i < 5; i++) {
+ __sync_fetch_and_sub(&test,1);
+ printf("test = %d\n", (int)test);
+ }
+
return 0;
}
Modified: test-suite/trunk/SingleSource/UnitTests/AtomicOps.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/AtomicOps.reference_output?rev=178594&r1=178593&r2=178594&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/AtomicOps.reference_output (original)
+++ test-suite/trunk/SingleSource/UnitTests/AtomicOps.reference_output Tue Apr 2 19:04:26 2013
@@ -1,4 +1,14 @@
2, 1
1, 2
2, 1
+test = 1
+test = 2
+test = 3
+test = 4
+test = 5
+test = 4
+test = 3
+test = 2
+test = 1
+test = 0
exit 0
More information about the llvm-commits
mailing list