summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/scd42-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/arm/scd42-3.c')
-rw-r--r--gcc/testsuite/gcc.target/arm/scd42-3.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/arm/scd42-3.c b/gcc/testsuite/gcc.target/arm/scd42-3.c
new file mode 100644
index 000000000..eb90e43c4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/scd42-3.c
@@ -0,0 +1,17 @@
+/* Verify that ldr is preferred on XScale for loading a 3 or 4 byte constant. */
+/* { dg-do compile } */
+/* { dg-skip-if "Test is specific to Xscale" { arm*-*-* } { "-march=*" } { "-march=xscale" } } */
+/* { dg-skip-if "Test is specific to Xscale" { arm*-*-* } { "-mcpu=*" } { "-mcpu=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\[ ].*" } } */