2 /* { dg-require-effective-target sync_int_long } */
4 /* { dg-options "-march=i486" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
6 /* Test basic functionality of the intrinsics. */
8 extern void abort (void);
9 extern void *memcpy (void *, const void *, __SIZE_TYPE__
);
12 static int init_si
[4] = { -30,-30,-50,-50 };
13 static int test_si
[4] = { -115,-115,25,25 };
18 if (__sync_val_compare_and_swap(AI
+0, -30, -115) != -30)
20 if (__sync_val_compare_and_swap(AI
+0, -30, -115) != -115)
22 if (__sync_bool_compare_and_swap(AI
+1, -30, -115) != 1)
24 if (__sync_bool_compare_and_swap(AI
+1, -30, -115) != 0)
27 if (__sync_val_compare_and_swap(AI
+2, AI
[2], 25) != -50)
29 if (__sync_val_compare_and_swap(AI
+2, AI
[2], 25) != 25)
31 if (__sync_bool_compare_and_swap(AI
+3, AI
[3], 25) != 1)
33 if (__sync_bool_compare_and_swap(AI
+3, AI
[3], 25) != 1)
38 static long init_di
[4] = { -30,-30,-50,-50 };
39 static long test_di
[4] = { -115,-115,25,25 };
44 if (__sync_val_compare_and_swap(AL
+0, -30, -115) != -30)
46 if (__sync_val_compare_and_swap(AL
+0, -30, -115) != -115)
48 if (__sync_bool_compare_and_swap(AL
+1, -30, -115) != 1)
50 if (__sync_bool_compare_and_swap(AL
+1, -30, -115) != 0)
53 if (__sync_val_compare_and_swap(AL
+2, AL
[2], 25) != -50)
55 if (__sync_val_compare_and_swap(AL
+2, AL
[2], 25) != 25)
57 if (__sync_bool_compare_and_swap(AL
+3, AL
[3], 25) != 1)
59 if (__sync_bool_compare_and_swap(AL
+3, AL
[3], 25) != 1)
65 memcpy(AI
, init_si
, sizeof(init_si
));
66 memcpy(AL
, init_di
, sizeof(init_di
));
71 if (memcmp (AI
, test_si
, sizeof(test_si
)))
73 if (memcmp (AL
, test_di
, sizeof(test_di
)))