aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2004-07-22 10:08:29 +0000
committerHans-Peter Nilsson <hp@gcc.gnu.org>2004-07-22 10:08:29 +0000
commit7413a13251eaeedb7e4a41b7110b9c064188816c (patch)
treeabb58c95cce77a7c78c8473a30c657ae1e56fc55
parent26277d41791a5f1817fbd3412ddb06f6efc961b9 (diff)
downloadgcc-7413a13251eaeedb7e4a41b7110b9c064188816c.zip
gcc-7413a13251eaeedb7e4a41b7110b9c064188816c.tar.gz
gcc-7413a13251eaeedb7e4a41b7110b9c064188816c.tar.bz2
cris-peep2-xsrand.c, [...]: New tests.
* gcc.dg/cris-peep2-xsrand.c, gcc.dg/cris-peep2-andu1.c, gcc.dg/cris-peep2-andu2.c: New tests. From-SVN: r85040
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/cris-peep2-andu1.c42
-rw-r--r--gcc/testsuite/gcc.dg/cris-peep2-andu2.c32
-rw-r--r--gcc/testsuite/gcc.dg/cris-peep2-xsrand.c32
4 files changed, 111 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 501da15..650195c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-22 Hans-Peter Nilsson <hp@axis.com>
+
+ * 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 <jsm@polyomino.org.uk>
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 0000000..2e546e6
--- /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 0000000..4f687cc
--- /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 0000000..9cfe40f
--- /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;
+}