From: hp Date: Thu, 22 Jul 2004 10:08:29 +0000 (+0000) Subject: * gcc.dg/cris-peep2-xsrand.c, gcc.dg/cris-peep2-andu1.c, X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=449c7e0a68ee6daf64e5a61ce667679f5cd1a105;p=pf3gnuchains%2Fgcc-fork.git * gcc.dg/cris-peep2-xsrand.c, gcc.dg/cris-peep2-andu1.c, gcc.dg/cris-peep2-andu2.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85040 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 501da15db6f..650195c3ea2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-07-22 Hans-Peter Nilsson + + * gcc.dg/cris-peep2-xsrand.c, gcc.dg/cris-peep2-andu1.c, + gcc.dg/cris-peep2-andu2.c: New tests. + 2004-07-22 Joseph S. Myers PR c/15052 diff --git a/gcc/testsuite/gcc.dg/cris-peep2-andu1.c b/gcc/testsuite/gcc.dg/cris-peep2-andu1.c new file mode 100644 index 00000000000..2e546e6256d --- /dev/null +++ b/gcc/testsuite/gcc.dg/cris-peep2-andu1.c @@ -0,0 +1,42 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler-not "and.d " } } */ +/* { dg-final { scan-assembler-not "move.d " } } */ +/* { dg-final { scan-assembler "cLear.b" } } */ +/* { dg-final { scan-assembler "movu.b" } } */ +/* { dg-final { scan-assembler "and.b" } } */ +/* { dg-final { scan-assembler "movu.w" } } */ +/* { dg-final { scan-assembler "and.w" } } */ +/* { dg-final { scan-assembler "andq" } } */ +/* { dg-options "-O2" } */ + +/* Test the "andu" peephole2 trivially, memory operand. */ + +int +clearb (int x, int *y) +{ + return *y & 0xff00; +} + +int +andb (int x, int *y) +{ + return *y & 0x3f; +} + +int +andw (int x, int *y) +{ + return *y & 0xfff; +} + +int +andq (int x, int *y) +{ + return *y & 0xf0; +} + +int +andq2 (int x, int *y) +{ + return *y & 0xfff0; +} diff --git a/gcc/testsuite/gcc.dg/cris-peep2-andu2.c b/gcc/testsuite/gcc.dg/cris-peep2-andu2.c new file mode 100644 index 00000000000..4f687cc081c --- /dev/null +++ b/gcc/testsuite/gcc.dg/cris-peep2-andu2.c @@ -0,0 +1,32 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler "movu.w \\\$r10,\\\$r" } } */ +/* { dg-final { scan-assembler "and.w 2047,\\\$r" } } */ +/* { dg-final { scan-assembler-not "move.d \\\$r10,\\\$r" } } */ +/* { dg-final { scan-assembler "movu.b \\\$r10,\\\$r" } } */ +/* { dg-final { scan-assembler "and.b 95,\\\$r" } } */ +/* { dg-final { scan-assembler "andq -2,\\\$r" } } */ +/* { dg-options "-O2" } */ + +/* 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; +} diff --git a/gcc/testsuite/gcc.dg/cris-peep2-xsrand.c b/gcc/testsuite/gcc.dg/cris-peep2-xsrand.c new file mode 100644 index 00000000000..9cfe40fb6e1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cris-peep2-xsrand.c @@ -0,0 +1,32 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-final { scan-assembler "and.w " } } */ +/* { dg-final { scan-assembler "and.b " } } */ +/* { dg-final { scan-assembler-not "and.d" } } */ +/* { dg-options "-O2" } */ + +/* Test the "asrandb", "asrandw", "lsrandb" and "lsrandw" peephole2:s + trivially. */ + +unsigned int +andwlsr (unsigned int x) +{ + return (x >> 17) & 0x7ff; +} + +unsigned int +andblsr (unsigned int x) +{ + return (x >> 25) & 0x5f; +} + +int +andwasr (int x) +{ + return (x >> 17) & 0x7ff; +} + +int +andbasr (int x) +{ + return (x >> 25) & 0x5f; +}