OSDN Git Service

* gcc.dg/cris-peep2-xsrand.c, gcc.dg/cris-peep2-andu1.c,
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Jul 2004 10:08:29 +0000 (10:08 +0000)
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Jul 2004 10:08:29 +0000 (10:08 +0000)
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

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cris-peep2-andu1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cris-peep2-andu2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cris-peep2-xsrand.c [new file with mode: 0644]

index 501da15..650195c 100644 (file)
@@ -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 (file)
index 0000000..2e546e6
--- /dev/null
@@ -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 (file)
index 0000000..4f687cc
--- /dev/null
@@ -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 (file)
index 0000000..9cfe40f
--- /dev/null
@@ -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;
+}