| 1 |
/* PR target/98737 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -masm=att" } */ |
| 4 |
/* { dg-additional-options "-march=i686" { target ia32 } } */ |
| 5 |
/* { dg-final { scan-assembler "lock\[^\n\r]\*xorq\t" { target lp64 } } } */ |
| 6 |
/* { dg-final { scan-assembler "lock\[^\n\r]\*xorl\t" } } */ |
| 7 |
/* { dg-final { scan-assembler "lock\[^\n\r]\*xorw\t" } } */ |
| 8 |
/* { dg-final { scan-assembler "lock\[^\n\r]\*xorb\t" } } */ |
| 9 |
/* { dg-final { scan-assembler-not "lock\[^\n\r]\*xadd" } } */ |
| 10 |
/* { dg-final { scan-assembler-not "lock\[^\n\r]\*cmpxchg" } } */ |
| 11 |
|
| 12 |
long a; |
| 13 |
int b; |
| 14 |
short c; |
| 15 |
char d; |
| 16 |
|
| 17 |
int |
| 18 |
f1 (long x) |
| 19 |
{ |
| 20 |
return __atomic_xor_fetch (&a, x, __ATOMIC_RELEASE) == 0; |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
f2 (int x) |
| 25 |
{ |
| 26 |
return __atomic_xor_fetch (&b, x, __ATOMIC_RELEASE) == 0; |
| 27 |
} |
| 28 |
|
| 29 |
int |
| 30 |
f3 (short x) |
| 31 |
{ |
| 32 |
return __atomic_xor_fetch (&c, x, __ATOMIC_RELEASE) == 0; |
| 33 |
} |
| 34 |
|
| 35 |
int |
| 36 |
f4 (char x) |
| 37 |
{ |
| 38 |
return __atomic_xor_fetch (&d, x, __ATOMIC_RELEASE) == 0; |
| 39 |
} |
| 40 |
|
| 41 |
int |
| 42 |
f5 (long x) |
| 43 |
{ |
| 44 |
return __atomic_xor_fetch (&a, x, __ATOMIC_RELEASE) != 0; |
| 45 |
} |
| 46 |
|
| 47 |
int |
| 48 |
f6 (int x) |
| 49 |
{ |
| 50 |
return __atomic_xor_fetch (&b, x, __ATOMIC_RELEASE) != 0; |
| 51 |
} |
| 52 |
|
| 53 |
int |
| 54 |
f7 (short x) |
| 55 |
{ |
| 56 |
return __atomic_xor_fetch (&c, x, __ATOMIC_RELEASE) != 0; |
| 57 |
} |
| 58 |
|
| 59 |
int |
| 60 |
f8 (char x) |
| 61 |
{ |
| 62 |
return __atomic_xor_fetch (&d, x, __ATOMIC_RELEASE) != 0; |
| 63 |
} |
| 64 |
|
| 65 |
int |
| 66 |
f9 (long x) |
| 67 |
{ |
| 68 |
return __atomic_xor_fetch (&a, x, __ATOMIC_RELEASE) < 0; |
| 69 |
} |
| 70 |
|
| 71 |
int |
| 72 |
f10 (int x) |
| 73 |
{ |
| 74 |
return __atomic_xor_fetch (&b, x, __ATOMIC_RELEASE) < 0; |
| 75 |
} |
| 76 |
|
| 77 |
int |
| 78 |
f11 (short x) |
| 79 |
{ |
| 80 |
return __atomic_xor_fetch (&c, x, __ATOMIC_RELEASE) < 0; |
| 81 |
} |
| 82 |
|
| 83 |
int |
| 84 |
f12 (char x) |
| 85 |
{ |
| 86 |
return __atomic_xor_fetch (&d, x, __ATOMIC_RELEASE) < 0; |
| 87 |
} |
| 88 |
|
| 89 |
int |
| 90 |
f13 (long x) |
| 91 |
{ |
| 92 |
return __atomic_xor_fetch (&a, x, __ATOMIC_RELEASE) >= 0; |
| 93 |
} |
| 94 |
|
| 95 |
int |
| 96 |
f14 (int x) |
| 97 |
{ |
| 98 |
return __atomic_xor_fetch (&b, x, __ATOMIC_RELEASE) >= 0; |
| 99 |
} |
| 100 |
|
| 101 |
int |
| 102 |
f15 (short x) |
| 103 |
{ |
| 104 |
return __atomic_xor_fetch (&c, x, __ATOMIC_RELEASE) >= 0; |
| 105 |
} |
| 106 |
|
| 107 |
int |
| 108 |
f16 (char x) |
| 109 |
{ |
| 110 |
return __atomic_xor_fetch (&d, x, __ATOMIC_RELEASE) >= 0; |
| 111 |
} |
| 112 |
|
| 113 |
int |
| 114 |
f17 (long x) |
| 115 |
{ |
| 116 |
return __sync_xor_and_fetch (&a, x) == 0; |
| 117 |
} |
| 118 |
|
| 119 |
int |
| 120 |
f18 (int x) |
| 121 |
{ |
| 122 |
return __sync_xor_and_fetch (&b, x) == 0; |
| 123 |
} |
| 124 |
|
| 125 |
int |
| 126 |
f19 (short x) |
| 127 |
{ |
| 128 |
return __sync_xor_and_fetch (&c, x) == 0; |
| 129 |
} |
| 130 |
|
| 131 |
int |
| 132 |
f20 (char x) |
| 133 |
{ |
| 134 |
return __sync_xor_and_fetch (&d, x) == 0; |
| 135 |
} |
| 136 |
|
| 137 |
int |
| 138 |
f21 (long x) |
| 139 |
{ |
| 140 |
return __sync_xor_and_fetch (&a, x) != 0; |
| 141 |
} |
| 142 |
|
| 143 |
int |
| 144 |
f22 (int x) |
| 145 |
{ |
| 146 |
return __sync_xor_and_fetch (&b, x) != 0; |
| 147 |
} |
| 148 |
|
| 149 |
int |
| 150 |
f23 (short x) |
| 151 |
{ |
| 152 |
return __sync_xor_and_fetch (&c, x) != 0; |
| 153 |
} |
| 154 |
|
| 155 |
int |
| 156 |
f24 (char x) |
| 157 |
{ |
| 158 |
return __sync_xor_and_fetch (&d, x) != 0; |
| 159 |
} |
| 160 |
|
| 161 |
int |
| 162 |
f25 (long x) |
| 163 |
{ |
| 164 |
return __sync_xor_and_fetch (&a, x) < 0; |
| 165 |
} |
| 166 |
|
| 167 |
int |
| 168 |
f26 (int x) |
| 169 |
{ |
| 170 |
return __sync_xor_and_fetch (&b, x) < 0; |
| 171 |
} |
| 172 |
|
| 173 |
int |
| 174 |
f27 (short x) |
| 175 |
{ |
| 176 |
return __sync_xor_and_fetch (&c, x) < 0; |
| 177 |
} |
| 178 |
|
| 179 |
int |
| 180 |
f28 (char x) |
| 181 |
{ |
| 182 |
return __sync_xor_and_fetch (&d, x) < 0; |
| 183 |
} |
| 184 |
|
| 185 |
int |
| 186 |
f29 (long x) |
| 187 |
{ |
| 188 |
return __sync_xor_and_fetch (&a, x) >= 0; |
| 189 |
} |
| 190 |
|
| 191 |
int |
| 192 |
f30 (int x) |
| 193 |
{ |
| 194 |
return __sync_xor_and_fetch (&b, x) >= 0; |
| 195 |
} |
| 196 |
|
| 197 |
int |
| 198 |
f31 (short x) |
| 199 |
{ |
| 200 |
return __sync_xor_and_fetch (&c, x) >= 0; |
| 201 |
} |
| 202 |
|
| 203 |
int |
| 204 |
f32 (char x) |
| 205 |
{ |
| 206 |
return __sync_xor_and_fetch (&d, x) >= 0; |
| 207 |
} |
| 208 |
|
| 209 |
int |
| 210 |
f33 (long x) |
| 211 |
{ |
| 212 |
return __atomic_xor_fetch (&a, x, __ATOMIC_RELEASE) <= 0; |
| 213 |
} |
| 214 |
|
| 215 |
int |
| 216 |
f34 (int x) |
| 217 |
{ |
| 218 |
return __atomic_xor_fetch (&b, x, __ATOMIC_RELEASE) <= 0; |
| 219 |
} |
| 220 |
|
| 221 |
int |
| 222 |
f35 (short x) |
| 223 |
{ |
| 224 |
return __atomic_xor_fetch (&c, x, __ATOMIC_RELEASE) <= 0; |
| 225 |
} |
| 226 |
|
| 227 |
int |
| 228 |
f36 (char x) |
| 229 |
{ |
| 230 |
return __atomic_xor_fetch (&d, x, __ATOMIC_RELEASE) <= 0; |
| 231 |
} |
| 232 |
|
| 233 |
int |
| 234 |
f37 (long x) |
| 235 |
{ |
| 236 |
return __atomic_xor_fetch (&a, x, __ATOMIC_RELEASE) > 0; |
| 237 |
} |
| 238 |
|
| 239 |
int |
| 240 |
f38 (int x) |
| 241 |
{ |
| 242 |
return __atomic_xor_fetch (&b, x, __ATOMIC_RELEASE) > 0; |
| 243 |
} |
| 244 |
|
| 245 |
int |
| 246 |
f39 (short x) |
| 247 |
{ |
| 248 |
return __atomic_xor_fetch (&c, x, __ATOMIC_RELEASE) > 0; |
| 249 |
} |
| 250 |
|
| 251 |
int |
| 252 |
f40 (char x) |
| 253 |
{ |
| 254 |
return __atomic_xor_fetch (&d, x, __ATOMIC_RELEASE) > 0; |
| 255 |
} |
| 256 |
|
| 257 |
int |
| 258 |
f41 (long x) |
| 259 |
{ |
| 260 |
return __sync_xor_and_fetch (&a, x) <= 0; |
| 261 |
} |
| 262 |
|
| 263 |
int |
| 264 |
f42 (int x) |
| 265 |
{ |
| 266 |
return __sync_xor_and_fetch (&b, x) <= 0; |
| 267 |
} |
| 268 |
|
| 269 |
int |
| 270 |
f43 (short x) |
| 271 |
{ |
| 272 |
return __sync_xor_and_fetch (&c, x) <= 0; |
| 273 |
} |
| 274 |
|
| 275 |
int |
| 276 |
f44 (char x) |
| 277 |
{ |
| 278 |
return __sync_xor_and_fetch (&d, x) <= 0; |
| 279 |
} |
| 280 |
|
| 281 |
int |
| 282 |
f45 (long x) |
| 283 |
{ |
| 284 |
return __sync_xor_and_fetch (&a, x) > 0; |
| 285 |
} |
| 286 |
|
| 287 |
int |
| 288 |
f46 (int x) |
| 289 |
{ |
| 290 |
return __sync_xor_and_fetch (&b, x) > 0; |
| 291 |
} |
| 292 |
|
| 293 |
int |
| 294 |
f47 (short x) |
| 295 |
{ |
| 296 |
return __sync_xor_and_fetch (&c, x) > 0; |
| 297 |
} |
| 298 |
|
| 299 |
int |
| 300 |
f48 (char x) |
| 301 |
{ |
| 302 |
return __sync_xor_and_fetch (&d, x) > 0; |
| 303 |
} |