1 /* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */
2 /* { dg-require-effective-target sync_long_long_runtime } */
3 /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
4 /* { dg-additional-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
6 /* Verify that the builtin functions are correctly marked as trapping
7 when using -fnon-call-exceptions. */
12 typedef int ditype __attribute__ ((mode (DI)));
14 #define FN(IDX, RET, CALL) \
15 static RET f ## IDX (void *p) __attribute__ ((noinline)); \
35 FN(1, ditype, (__sync_fetch_and_add((ditype*)p, 1)))
36 FN(2, ditype, (__sync_fetch_and_sub((ditype*)p, 1)))
37 FN(3, ditype, (__sync_fetch_and_or((ditype*)p, 1)))
38 FN(4, ditype, (__sync_fetch_and_and((ditype*)p, 1)))
39 FN(5, ditype, (__sync_fetch_and_xor((ditype*)p, 1)))
40 FN(6, ditype, (__sync_fetch_and_nand((ditype*)p, 1)))
42 FN( 7, ditype, (__sync_add_and_fetch((ditype*)p, 1)))
43 FN( 8, ditype, (__sync_sub_and_fetch((ditype*)p, 1)))
44 FN( 9, ditype, (__sync_or_and_fetch((ditype*)p, 1)))
45 FN(10, ditype, (__sync_and_and_fetch((ditype*)p, 1)))
46 FN(11, ditype, (__sync_xor_and_fetch((ditype*)p, 1)))
47 FN(12, ditype, (__sync_nand_and_fetch((ditype*)p, 1)))
49 FN(13, bool, (__sync_bool_compare_and_swap((ditype*)p, 1, 2)))
50 FN(14, ditype, (__sync_val_compare_and_swap((ditype*)p, 1, 2)))
52 FN(15, ditype, (__sync_lock_test_and_set((ditype*)p, 1)))
53 FN(16, void, (__sync_lock_release((ditype*)p)))
55 FN(17, bool, (__atomic_test_and_set((ditype*)p, __ATOMIC_SEQ_CST)))
56 FN(18, void, (__atomic_clear((ditype*)p, __ATOMIC_SEQ_CST)))
58 FN(19, void, (__atomic_exchange((ditype*)p, (ditype*)0, (ditype*)0, __ATOMIC_SEQ_CST)))
59 FN(20, ditype, (__atomic_exchange_n((ditype*)p, 1, 2)))
61 FN(21, void, (__atomic_load((ditype*)p, (ditype*)0, __ATOMIC_SEQ_CST)))
62 FN(22, ditype, (__atomic_load_n((ditype*)p, __ATOMIC_SEQ_CST)))
64 FN(23, bool, (__atomic_compare_exchange((ditype*)p, (ditype*)0, (ditype*)0, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)))
65 FN(24, bool, (__atomic_compare_exchange_n((ditype*)p, (ditype*)0, 1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)))
67 FN(25, void, (__atomic_store((ditype*)p, (ditype*)0, __ATOMIC_SEQ_CST)))
68 FN(26, void, (__atomic_store_n((ditype*)p, 1, __ATOMIC_SEQ_CST)))
70 FN(27, ditype, (__atomic_add_fetch((ditype*)p, 1, __ATOMIC_SEQ_CST)))
71 FN(28, ditype, (__atomic_sub_fetch((ditype*)p, 1, __ATOMIC_SEQ_CST)))
72 FN(29, ditype, (__atomic_and_fetch((ditype*)p, 1, __ATOMIC_SEQ_CST)))
73 FN(30, ditype, (__atomic_nand_fetch((ditype*)p, 1, __ATOMIC_SEQ_CST)))
74 FN(31, ditype, (__atomic_xor_fetch((ditype*)p, 1, __ATOMIC_SEQ_CST)))
75 FN(32, ditype, (__atomic_or_fetch((ditype*)p, 1, __ATOMIC_SEQ_CST)))
77 FN(33, ditype, (__atomic_fetch_add((ditype*)p, 1, __ATOMIC_SEQ_CST)))
78 FN(34, ditype, (__atomic_fetch_sub((ditype*)p, 1, __ATOMIC_SEQ_CST)))
79 FN(35, ditype, (__atomic_fetch_and((ditype*)p, 1, __ATOMIC_SEQ_CST)))
80 FN(36, ditype, (__atomic_fetch_nand((ditype*)p, 1, __ATOMIC_SEQ_CST)))
81 FN(37, ditype, (__atomic_fetch_xor((ditype*)p, 1, __ATOMIC_SEQ_CST)))
82 FN(38, ditype, (__atomic_fetch_or((ditype*)p, 1, __ATOMIC_SEQ_CST)))
90 sigprocmask (SIG_UNBLOCK, &clear, NULL);
97 signal (SIGSEGV, handler);
98 signal (SIGBUS, handler);