OSDN Git Service

xscale testcases from James Lemke
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Dec 2003 22:38:58 +0000 (22:38 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Dec 2003 22:38:58 +0000 (22:38 +0000)
* gcc.dg/arm-scd42-[123].c: New tests.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74712 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/arm-scd42-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/arm-scd42-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/arm-scd42-3.c [new file with mode: 0644]

index a2d9eaf..3bb7afc 100644 (file)
@@ -1,3 +1,7 @@
+2003-12-16  James Lemke  <jim@wasabisystems.com>
+
+       * gcc.dg/arm-scd42-[123].c: New tests.
+
 2003-12-16  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/9043
diff --git a/gcc/testsuite/gcc.dg/arm-scd42-1.c b/gcc/testsuite/gcc.dg/arm-scd42-1.c
new file mode 100644 (file)
index 0000000..70b34de
--- /dev/null
@@ -0,0 +1,15 @@
+/* Verify that mov is preferred on XScale for loading a 1 byte constant. */
+/* { dg-do compile { target xscale-*-* } } */
+/* { dg-options "-mcpu=xscale -O" } */
+
+unsigned load1(void) __attribute__ ((naked));
+unsigned load1(void)
+{
+    /* Best code would be:
+       mov r0, =17
+       mov pc, lr */
+
+    return 17;
+}
+
+/* { dg-final { scan-assembler "mov\[  ].*17" } } */
diff --git a/gcc/testsuite/gcc.dg/arm-scd42-2.c b/gcc/testsuite/gcc.dg/arm-scd42-2.c
new file mode 100644 (file)
index 0000000..75e7274
--- /dev/null
@@ -0,0 +1,17 @@
+/* Verify that mov is preferred on XScale for loading a 2 byte constant. */
+/* { dg-do compile { target xscale-*-* } } */
+/* { dg-options "-mcpu=xscale -O" } */
+
+unsigned load2(void) __attribute__ ((naked));
+unsigned load2(void)
+{
+    /* Best code would be:
+       mov r0, =272
+       add r0, r0, =1
+       mov pc, lr */
+
+    return 273;
+}
+
+/* We want to suppress running for -mthumb but not for -mthumb-interwork. */
+/* { dg-final { global compiler_flags; if ![string match "*-mthumb *" $compiler_flags] { scan-assembler "mov\[         ].*272" } } } */
diff --git a/gcc/testsuite/gcc.dg/arm-scd42-3.c b/gcc/testsuite/gcc.dg/arm-scd42-3.c
new file mode 100644 (file)
index 0000000..80a4ba8
--- /dev/null
@@ -0,0 +1,15 @@
+/* Verify that ldr is preferred on XScale for loading a 3 or 4 byte constant. */
+/* { dg-do compile { target xscale-*-* } } */
+/* { dg-options "-mcpu=xscale -O" } */
+
+unsigned load4(void) __attribute__ ((naked));
+unsigned load4(void)
+{
+    /* Best code would be:
+       ldr r0, =65809
+       mov pc, lr */
+
+    return 65809;
+}
+
+/* { dg-final { scan-assembler "ldr\[  ].*" } } */