summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/cris/peep2-andu1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/cris/peep2-andu1.c')
-rw-r--r--gcc/testsuite/gcc.target/cris/peep2-andu1.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/cris/peep2-andu1.c b/gcc/testsuite/gcc.target/cris/peep2-andu1.c
new file mode 100644
index 000000000..3b54c3295
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/peep2-andu1.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { 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;
+}