| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 --save-temps" } */ |
| 3 |
|
| 4 |
extern void abort (void); |
| 5 |
|
| 6 |
int __attribute__ ((noinline)) |
| 7 |
bics_si_test (int a, int b) |
| 8 |
{ |
| 9 |
if (a & ~b) |
| 10 |
return 1; |
| 11 |
else |
| 12 |
return 0; |
| 13 |
} |
| 14 |
|
| 15 |
int __attribute__ ((noinline)) |
| 16 |
bics_si_test2 (int a, int b) |
| 17 |
{ |
| 18 |
if (a & ~ (b << 2)) |
| 19 |
return 1; |
| 20 |
else |
| 21 |
return 0; |
| 22 |
} |
| 23 |
|
| 24 |
typedef long long s64; |
| 25 |
|
| 26 |
int __attribute__ ((noinline)) |
| 27 |
bics_di_test (s64 a, s64 b) |
| 28 |
{ |
| 29 |
if (a & ~b) |
| 30 |
return 1; |
| 31 |
else |
| 32 |
return 0; |
| 33 |
} |
| 34 |
|
| 35 |
int __attribute__ ((noinline)) |
| 36 |
bics_di_test2 (s64 a, s64 b) |
| 37 |
{ |
| 38 |
if (a & ~(b << 2)) |
| 39 |
return 1; |
| 40 |
else |
| 41 |
return 0; |
| 42 |
} |
| 43 |
|
| 44 |
int |
| 45 |
main (void) |
| 46 |
{ |
| 47 |
int a = 5; |
| 48 |
int b = 5; |
| 49 |
int c = 20; |
| 50 |
s64 d = 5; |
| 51 |
s64 e = 5; |
| 52 |
s64 f = 20; |
| 53 |
if (bics_si_test (a, b)) |
| 54 |
abort (); |
| 55 |
if (bics_si_test2 (c, b)) |
| 56 |
abort (); |
| 57 |
if (bics_di_test (d, e)) |
| 58 |
abort (); |
| 59 |
if (bics_di_test2 (f, e)) |
| 60 |
abort (); |
| 61 |
return 0; |
| 62 |
} |
| 63 |
|
| 64 |
/* { dg-final { scan-assembler-times "bics\twzr, w\[0-9\]+, w\[0-9\]+" 2 } } */ |
| 65 |
/* { dg-final { scan-assembler-times "bics\twzr, w\[0-9\]+, w\[0-9\]+, lsl 2" 1 } } */ |
| 66 |
/* { dg-final { scan-assembler-times "bics\txzr, x\[0-9\]+, x\[0-9\]+" 2 } } */ |
| 67 |
/* { dg-final { scan-assembler-times "bics\txzr, x\[0-9\]+, x\[0-9\]+, lsl 2" 1 } } */ |
| 68 |
|