| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -march=zEC12 -mzarch" } */ |
| 3 |
|
| 4 |
static __attribute__((always_inline)) inline |
| 5 |
int __atomic_dec_and_test(int *ptr) |
| 6 |
{ |
| 7 |
int cc; |
| 8 |
asm volatile( |
| 9 |
" alsi %[ptr],-1\n" |
| 10 |
: "=@cc" (cc), [ptr] "+QS" (*ptr) : : "memory"); |
| 11 |
return (cc == 0) || (cc == 2); |
| 12 |
} |
| 13 |
|
| 14 |
int a; |
| 15 |
void dummy(void); |
| 16 |
long fu(void) |
| 17 |
{ |
| 18 |
if (__atomic_dec_and_test(&a)) |
| 19 |
return 5; |
| 20 |
return 8; |
| 21 |
} |
| 22 |
|
| 23 |
void bar(void) |
| 24 |
{ |
| 25 |
if (__atomic_dec_and_test(&a)) |
| 26 |
dummy(); |
| 27 |
} |
| 28 |
|
| 29 |
int foo(int x) |
| 30 |
{ |
| 31 |
int cc; |
| 32 |
asm volatile ("ahi %[x],42\n" |
| 33 |
: [x] "+d" (x), "=@cc" (cc)); |
| 34 |
return !(cc == 0 || cc == 2) ? 42 : 13; |
| 35 |
} |
| 36 |
|
| 37 |
/* { dg-final { scan-assembler-not {ipm} } } */ |