| 1 |
/* Machine description pattern tests. */ |
| 2 |
|
| 3 |
/* { dg-do compile } */ |
| 4 |
/* Starting with arch13 the and with complement instruction is |
| 5 |
available and the splitter is disabled. */ |
| 6 |
/* { dg-options "-march=z14 -save-temps -dP" } */ |
| 7 |
/* { dg-do run { target { s390_useable_hw } } } */ |
| 8 |
/* Skip test if -O0 is present on the command line: |
| 9 |
|
| 10 |
{ dg-skip-if "" { *-*-* } { "-O0" } { "" } } |
| 11 |
|
| 12 |
Skip test if the -O option is missing from the command line |
| 13 |
{ dg-skip-if "" { *-*-* } { "*" } { "-O*" } } |
| 14 |
*/ |
| 15 |
|
| 16 |
__attribute__ ((noinline)) |
| 17 |
unsigned int andc_vv(unsigned int a, unsigned int b) |
| 18 |
{ return ~b & a; } |
| 19 |
/* { dg-final { scan-assembler ":18:.\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ |
| 20 |
/* { dg-final { scan-assembler ":18:.\* \{\\*xorsi3\}" } } */ |
| 21 |
|
| 22 |
__attribute__ ((noinline)) |
| 23 |
unsigned int andc_pv(unsigned int *a, unsigned int b) |
| 24 |
{ return ~b & *a; } |
| 25 |
/* { dg-final { scan-assembler ":24:.\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ |
| 26 |
/* { dg-final { scan-assembler ":24:.\* \{\\*xorsi3\}" } } */ |
| 27 |
|
| 28 |
__attribute__ ((noinline)) |
| 29 |
unsigned int andc_vp(unsigned int a, unsigned int *b) |
| 30 |
{ return ~*b & a; } |
| 31 |
/* { dg-final { scan-assembler ":30:.\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ |
| 32 |
/* { dg-final { scan-assembler ":30:.\* \{\\*xorsi3\}" } } */ |
| 33 |
|
| 34 |
__attribute__ ((noinline)) |
| 35 |
unsigned int andc_pp(unsigned int *a, unsigned int *b) |
| 36 |
{ return ~*b & *a; } |
| 37 |
/* { dg-final { scan-assembler ":36:.\* \{\\*andsi3_\(esa\|zarch\)\}" } } */ |
| 38 |
/* { dg-final { scan-assembler ":36:.\* \{\\*xorsi3\}" } } */ |
| 39 |
|
| 40 |
/* { dg-final { scan-assembler-times "\tnr\?k\?\t" 4 } } */ |
| 41 |
/* { dg-final { scan-assembler-times "\txr\?k\?\t" 4 } } */ |
| 42 |
|
| 43 |
int |
| 44 |
main (void) |
| 45 |
{ |
| 46 |
unsigned int a = 0xc000000cu; |
| 47 |
unsigned int b = 0x5000000au; |
| 48 |
unsigned int e = 0x80000004u; |
| 49 |
unsigned int c; |
| 50 |
|
| 51 |
c = andc_vv (a, b); |
| 52 |
if (c != e) |
| 53 |
__builtin_abort (); |
| 54 |
c = andc_pv (&a, b); |
| 55 |
if (c != e) |
| 56 |
__builtin_abort (); |
| 57 |
c = andc_vp (a, &b); |
| 58 |
if (c != e) |
| 59 |
__builtin_abort (); |
| 60 |
c = andc_pp (&a, &b); |
| 61 |
if (c != e) |
| 62 |
__builtin_abort (); |
| 63 |
return 0; |
| 64 |
} |