diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/cris/peep2-andu2.c')
-rw-r--r-- | gcc/testsuite/gcc.target/cris/peep2-andu2.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/cris/peep2-andu2.c b/gcc/testsuite/gcc.target/cris/peep2-andu2.c new file mode 100644 index 000000000..55f638cdb --- /dev/null +++ b/gcc/testsuite/gcc.target/cris/peep2-andu2.c @@ -0,0 +1,32 @@ +/* { dg-do assemble } */ +/* { dg-final { scan-assembler "movu.w \\\$r10,\\\$" } } */ +/* { dg-final { scan-assembler "and.w 2047,\\\$" } } */ +/* { dg-final { scan-assembler-not "move.d \\\$r10,\\\$" } } */ +/* { dg-final { scan-assembler "movu.b \\\$r10,\\\$" } } */ +/* { dg-final { scan-assembler "and.b 95,\\\$" } } */ +/* { dg-final { scan-assembler "andq -2,\\\$" } } */ +/* { dg-options "-O2 -save-temps" } */ + +/* Test the "andu" peephole2 trivially, register operand. */ + +unsigned int +and_peep2_hi (unsigned int y, unsigned int *x) +{ + *x = y & 0x7ff; + return y; +} + +unsigned int +and_peep2_qi (unsigned int y, unsigned int *x) +{ + *x = y & 0x5f; + return y; +} + + +unsigned int +and_peep2_q (unsigned int y, unsigned int *x) +{ + *x = y & 0xfe; + return y; +} |