1/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ 2 3/* Validate that each of the __sync builtins compiles. This won't 4 necessarily link, since the target might not support the builtin, 5 so this may result in external library calls. */ 6 7signed char sc; 8unsigned char uc; 9signed short ss; 10unsigned short us; 11signed int si; 12unsigned int ui; 13signed long sl; 14unsigned long ul; 15signed long long sll; 16unsigned long long ull; 17 18void test_op_ignore (void) 19{ 20 (void) __sync_fetch_and_add (&sc, -1); 21 (void) __sync_fetch_and_add (&uc, -1); 22 (void) __sync_fetch_and_add (&ss, -1); 23 (void) __sync_fetch_and_add (&us, -1); 24 (void) __sync_fetch_and_add (&si, -1); 25 (void) __sync_fetch_and_add (&ui, -1); 26 (void) __sync_fetch_and_add (&sl, -1); 27 (void) __sync_fetch_and_add (&ul, -1); 28 (void) __sync_fetch_and_add (&sll, -1); 29 (void) __sync_fetch_and_add (&ull, -1); 30 31 (void) __sync_fetch_and_sub (&sc, -1); 32 (void) __sync_fetch_and_sub (&uc, -1); 33 (void) __sync_fetch_and_sub (&ss, -1); 34 (void) __sync_fetch_and_sub (&us, -1); 35 (void) __sync_fetch_and_sub (&si, -1); 36 (void) __sync_fetch_and_sub (&ui, -1); 37 (void) __sync_fetch_and_sub (&sl, -1); 38 (void) __sync_fetch_and_sub (&ul, -1); 39 (void) __sync_fetch_and_sub (&sll, -1); 40 (void) __sync_fetch_and_sub (&ull, -1); 41 42 (void) __sync_fetch_and_or (&sc, -1); 43 (void) __sync_fetch_and_or (&uc, -1); 44 (void) __sync_fetch_and_or (&ss, -1); 45 (void) __sync_fetch_and_or (&us, -1); 46 (void) __sync_fetch_and_or (&si, -1); 47 (void) __sync_fetch_and_or (&ui, -1); 48 (void) __sync_fetch_and_or (&sl, -1); 49 (void) __sync_fetch_and_or (&ul, -1); 50 (void) __sync_fetch_and_or (&sll, -1); 51 (void) __sync_fetch_and_or (&ull, -1); 52 53 (void) __sync_fetch_and_xor (&sc, -1); 54 (void) __sync_fetch_and_xor (&uc, -1); 55 (void) __sync_fetch_and_xor (&ss, -1); 56 (void) __sync_fetch_and_xor (&us, -1); 57 (void) __sync_fetch_and_xor (&si, -1); 58 (void) __sync_fetch_and_xor (&ui, -1); 59 (void) __sync_fetch_and_xor (&sl, -1); 60 (void) __sync_fetch_and_xor (&ul, -1); 61 (void) __sync_fetch_and_xor (&sll, -1); 62 (void) __sync_fetch_and_xor (&ull, -1); 63 64 (void) __sync_fetch_and_and (&sc, -1); 65 (void) __sync_fetch_and_and (&uc, -1); 66 (void) __sync_fetch_and_and (&ss, -1); 67 (void) __sync_fetch_and_and (&us, -1); 68 (void) __sync_fetch_and_and (&si, -1); 69 (void) __sync_fetch_and_and (&ui, -1); 70 (void) __sync_fetch_and_and (&sl, -1); 71 (void) __sync_fetch_and_and (&ul, -1); 72 (void) __sync_fetch_and_and (&sll, -1); 73 (void) __sync_fetch_and_and (&ull, -1); 74 75 (void) __sync_fetch_and_nand (&sc, -1); 76 (void) __sync_fetch_and_nand (&uc, -1); 77 (void) __sync_fetch_and_nand (&ss, -1); 78 (void) __sync_fetch_and_nand (&us, -1); 79 (void) __sync_fetch_and_nand (&si, -1); 80 (void) __sync_fetch_and_nand (&ui, -1); 81 (void) __sync_fetch_and_nand (&sl, -1); 82 (void) __sync_fetch_and_nand (&ul, -1); 83 (void) __sync_fetch_and_nand (&sll, -1); 84 (void) __sync_fetch_and_nand (&ull, -1); 85} 86 87void test_fetch_and_op (void) 88{ 89 sc = __sync_fetch_and_add (&sc, -11); 90 uc = __sync_fetch_and_add (&uc, -11); 91 ss = __sync_fetch_and_add (&ss, -11); 92 us = __sync_fetch_and_add (&us, -11); 93 si = __sync_fetch_and_add (&si, -11); 94 ui = __sync_fetch_and_add (&ui, -11); 95 sl = __sync_fetch_and_add (&sl, -11); 96 ul = __sync_fetch_and_add (&ul, -11); 97 sll = __sync_fetch_and_add (&sll, -11); 98 ull = __sync_fetch_and_add (&ull, -11); 99 100 sc = __sync_fetch_and_sub (&sc, -11); 101 uc = __sync_fetch_and_sub (&uc, -11); 102 ss = __sync_fetch_and_sub (&ss, -11); 103 us = __sync_fetch_and_sub (&us, -11); 104 si = __sync_fetch_and_sub (&si, -11); 105 ui = __sync_fetch_and_sub (&ui, -11); 106 sl = __sync_fetch_and_sub (&sl, -11); 107 ul = __sync_fetch_and_sub (&ul, -11); 108 sll = __sync_fetch_and_sub (&sll, -11); 109 ull = __sync_fetch_and_sub (&ull, -11); 110 111 sc = __sync_fetch_and_or (&sc, -11); 112 uc = __sync_fetch_and_or (&uc, -11); 113 ss = __sync_fetch_and_or (&ss, -11); 114 us = __sync_fetch_and_or (&us, -11); 115 si = __sync_fetch_and_or (&si, -11); 116 ui = __sync_fetch_and_or (&ui, -11); 117 sl = __sync_fetch_and_or (&sl, -11); 118 ul = __sync_fetch_and_or (&ul, -11); 119 sll = __sync_fetch_and_or (&sll, -11); 120 ull = __sync_fetch_and_or (&ull, -11); 121 122 sc = __sync_fetch_and_xor (&sc, -11); 123 uc = __sync_fetch_and_xor (&uc, -11); 124 ss = __sync_fetch_and_xor (&ss, -11); 125 us = __sync_fetch_and_xor (&us, -11); 126 si = __sync_fetch_and_xor (&si, -11); 127 ui = __sync_fetch_and_xor (&ui, -11); 128 sl = __sync_fetch_and_xor (&sl, -11); 129 ul = __sync_fetch_and_xor (&ul, -11); 130 sll = __sync_fetch_and_xor (&sll, -11); 131 ull = __sync_fetch_and_xor (&ull, -11); 132 133 sc = __sync_fetch_and_and (&sc, -11); 134 uc = __sync_fetch_and_and (&uc, -11); 135 ss = __sync_fetch_and_and (&ss, -11); 136 us = __sync_fetch_and_and (&us, -11); 137 si = __sync_fetch_and_and (&si, -11); 138 ui = __sync_fetch_and_and (&ui, -11); 139 sl = __sync_fetch_and_and (&sl, -11); 140 ul = __sync_fetch_and_and (&ul, -11); 141 sll = __sync_fetch_and_and (&sll, -11); 142 ull = __sync_fetch_and_and (&ull, -11); 143 144 sc = __sync_fetch_and_nand (&sc, -11); 145 uc = __sync_fetch_and_nand (&uc, -11); 146 ss = __sync_fetch_and_nand (&ss, -11); 147 us = __sync_fetch_and_nand (&us, -11); 148 si = __sync_fetch_and_nand (&si, -11); 149 ui = __sync_fetch_and_nand (&ui, -11); 150 sl = __sync_fetch_and_nand (&sl, -11); 151 ul = __sync_fetch_and_nand (&ul, -11); 152 sll = __sync_fetch_and_nand (&sll, -11); 153 ull = __sync_fetch_and_nand (&ull, -11); 154} 155 156void test_lock (void) 157{ 158 sc = __sync_lock_test_and_set (&sc, -1); 159 uc = __sync_lock_test_and_set (&uc, -1); 160 ss = __sync_lock_test_and_set (&ss, -1); 161 us = __sync_lock_test_and_set (&us, -1); 162 si = __sync_lock_test_and_set (&si, -1); 163 ui = __sync_lock_test_and_set (&ui, -1); 164 sl = __sync_lock_test_and_set (&sl, -1); 165 ul = __sync_lock_test_and_set (&ul, -1); 166 sll = __sync_lock_test_and_set (&sll, -1); 167 ull = __sync_lock_test_and_set (&ull, -1); 168} 169