summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/pr50751-5.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/sh/pr50751-5.c')
-rw-r--r--gcc/testsuite/gcc.target/sh/pr50751-5.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/sh/pr50751-5.c b/gcc/testsuite/gcc.target/sh/pr50751-5.c
new file mode 100644
index 00000000000..48d5403b2d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr50751-5.c
@@ -0,0 +1,27 @@
+/* Check that the mov.w displacement addressing insn is generated and the
+ base address is adjusted only once. On SH2A this test is skipped because
+ there is a 4 byte mov.w insn that can handle larger displacements. Thus
+ on SH2A the base address will not be adjusted in this case. */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O1" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */
+/* { dg-final { scan-assembler-times "add" 2 } } */
+
+void
+testfunc_00 (const short* ap, short* bp)
+{
+ bp[0] = ap[15];
+ bp[2] = ap[5];
+ bp[9] = ap[7];
+ bp[0] = ap[25];
+}
+
+void
+testfunc_01 (volatile const short* ap, volatile short* bp)
+{
+ bp[0] = ap[15];
+ bp[2] = ap[5];
+ bp[9] = ap[7];
+ bp[0] = ap[25];
+}
+