| 1 |
/* Test whether an AND mask or'ed with the know zero bits that equals a mode |
| 2 |
mask is a candidate for zero extendion. */ |
| 3 |
|
| 4 |
/* { dg-do compile { target i?86-*-* x86_64-*-* s390*-*-* aarch64*-*-* } } */ |
| 5 |
/* { dg-require-effective-target lp64 } */ |
| 6 |
/* { dg-options "-O3 -dP -fdump-rtl-combine" } */ |
| 7 |
|
| 8 |
unsigned long foo (unsigned char c) |
| 9 |
{ |
| 10 |
unsigned long l; |
| 11 |
unsigned int i; |
| 12 |
|
| 13 |
i = ((unsigned int)c) << 8; |
| 14 |
i |= ((unsigned int)c) << 20; |
| 15 |
asm volatile ("":::); |
| 16 |
i = i & 0x0fe0fe00; |
| 17 |
asm volatile ("":::); |
| 18 |
l = (unsigned long)i; |
| 19 |
|
| 20 |
return l; |
| 21 |
} |
| 22 |
|
| 23 |
unsigned long bar (unsigned char c) |
| 24 |
{ |
| 25 |
unsigned long l; |
| 26 |
unsigned int i; |
| 27 |
|
| 28 |
i = ((unsigned int)c) << 8; |
| 29 |
i |= ((unsigned int)c) << 20; |
| 30 |
asm volatile ("":::); |
| 31 |
i = i & 0x07f007f0; |
| 32 |
asm volatile ("":::); |
| 33 |
l = (unsigned long)i; |
| 34 |
|
| 35 |
return l; |
| 36 |
} |
| 37 |
|
| 38 |
/* Check that an AND expression was used. */ |
| 39 |
/* { dg-final { scan-assembler-times "\\(and:" 2 { target { ! aarch64*-*-* } } } } */ |
| 40 |
/* { dg-final { scan-rtl-dump "\\(and:DI" "combine" { target aarch64*-*-* } } } */ |
| 41 |
/* { dg-final { scan-rtl-dump "\\(and:SI" "combine" { target aarch64*-*-* } } } */ |