re PR rtl-optimization/50749 (Auto-inc-dec does not find subsequent contiguous mem...
authorOleg Endo <olegendo@gcc.gnu.org>
Tue, 12 Jun 2012 07:09:52 +0000 (07:09 +0000)
committerOleg Endo <olegendo@gcc.gnu.org>
Tue, 12 Jun 2012 07:09:52 +0000 (07:09 +0000)
PR target/50749
* gcc.target/sh/pr50749-sf-postinc-2.c: New.
* gcc.target/sh/pr50749-sf-postinc-4.c: New.
* gcc.target/sh/pr50749-qihisi-postinc-2.c: New.
* gcc.target/sh/pr50749-qihisi-postinc-4.c: New.
* gcc.target/sh/pr50749-sf-predec-2.c: New.
* gcc.target/sh/pr50749-sf-predec-4.c: New.
* gcc.target/sh/pr50749-qihisi-predec-1.c: New.
* gcc.target/sh/pr50749-qihisi-predec-3.c: New.
* gcc.target/sh/pr50749-sf-postinc-1.c: New.
* gcc.target/sh/pr50749-sf-postinc-3.c: New.
* gcc.target/sh/pr50749-qihisi-postinc-1.c: New.
* gcc.target/sh/pr50749-qihisi-postinc-3.c: New.
* gcc.target/sh/pr50749-sf-predec-1.c: New.
* gcc.target/sh/pr50749-sf-predec-3.c: New.
* gcc.target/sh/pr50749-qihisi-predec-2.c: New.
* gcc.target/sh/pr50749-qihisi-predec-4.c: New.

From-SVN: r188426

17 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-sf-predec-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-sf-predec-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-sf-predec-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sh/pr50749-sf-predec-4.c [new file with mode: 0644]

index 6dc98f4..04725bd 100644 (file)
@@ -1,3 +1,23 @@
+2012-06-12  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       PR target/50749
+       * gcc.target/sh/pr50749-sf-postinc-2.c: New.
+       * gcc.target/sh/pr50749-sf-postinc-4.c: New.
+       * gcc.target/sh/pr50749-qihisi-postinc-2.c: New.
+       * gcc.target/sh/pr50749-qihisi-postinc-4.c: New.
+       * gcc.target/sh/pr50749-sf-predec-2.c: New.
+       * gcc.target/sh/pr50749-sf-predec-4.c: New.
+       * gcc.target/sh/pr50749-qihisi-predec-1.c: New.
+       * gcc.target/sh/pr50749-qihisi-predec-3.c: New.
+       * gcc.target/sh/pr50749-sf-postinc-1.c: New.
+       * gcc.target/sh/pr50749-sf-postinc-3.c: New.
+       * gcc.target/sh/pr50749-qihisi-postinc-1.c: New.
+       * gcc.target/sh/pr50749-qihisi-postinc-3.c: New.
+       * gcc.target/sh/pr50749-sf-predec-1.c: New.
+       * gcc.target/sh/pr50749-sf-predec-3.c: New.
+       * gcc.target/sh/pr50749-qihisi-predec-2.c: New.
+       * gcc.target/sh/pr50749-qihisi-predec-4.c: New.
+
 2012-06-11  Sriraman Tallam  <tmsriram@google.com>
 
        * gcc.target/i386/builtin_target.c (vendor_signatures): New enum.
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-1.c b/gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-1.c
new file mode 100644 (file)
index 0000000..8852b8f
--- /dev/null
@@ -0,0 +1,34 @@
+/* PR target/50749: Verify that post-increment addressing is generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+
+char*
+test_func_00 (char* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+short*
+test_func_01 (short* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+int*
+test_func_02 (int* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-2.c b/gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-2.c
new file mode 100644 (file)
index 0000000..b101e8d
--- /dev/null
@@ -0,0 +1,70 @@
+/* PR target/50749: Verify that subsequent post-increment addressings
+   are generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 5 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 5 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 5 { xfail *-*-*} } } */
+
+char*
+test_func_00 (char* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+char*
+test_func_01 (char* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+short*
+test_func_02 (short* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+short*
+test_func_03 (short* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+int*
+test_func_04 (int* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+int*
+test_func_05 (int* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-3.c b/gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-3.c
new file mode 100644 (file)
index 0000000..99f16b6
--- /dev/null
@@ -0,0 +1,40 @@
+/* PR target/50749: Verify that post-increment addressing is generated
+   inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+
+int
+test_func_00 (char* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
+int
+test_func_01 (short* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
+int
+test_func_02 (int* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+  } while (--c);
+  return r;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-4.c b/gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-4.c
new file mode 100644 (file)
index 0000000..01050c6
--- /dev/null
@@ -0,0 +1,46 @@
+/* PR target/50749: Verify that post-increment addressing is generated
+   inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 3 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 3 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 3 { xfail *-*-*} } } */
+
+int
+test_func_00 (char* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+    r += *p++;
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
+int
+test_func_01 (short* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+    r += *p++;
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
+int
+test_func_02 (int* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+    r += *p++;
+    r += *p++;
+  } while (--c);
+  return r;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-1.c b/gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-1.c
new file mode 100644 (file)
index 0000000..5f816e9
--- /dev/null
@@ -0,0 +1,28 @@
+/* PR target/50749: Verify that pre-decrement addressing is generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\tr\[0-9]\+,@-r\[0-9]\+" 1 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 1 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 1 { xfail *-*-*} } } */
+
+char*
+test_func_00 (char* p, int c)
+{
+  *--p = (char)c;
+  return p;
+}
+
+short*
+test_func_01 (short* p, int c)
+{
+  *--p = (short)c;
+  return p;
+}
+
+int*
+test_func_02 (int* p, int c)
+{
+  *--p = c;
+  return p;
+}
+
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-2.c b/gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-2.c
new file mode 100644 (file)
index 0000000..73e19f3
--- /dev/null
@@ -0,0 +1,58 @@
+/* PR target/50749: Verify that subsequent pre-decrement addressings
+   are generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\tr\[0-9]\+,@-r\[0-9]\+" 5 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 5 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 5 { xfail *-*-*} } } */
+
+char*
+test_func_00 (char* p, int c)
+{
+  *--p = (char)c;
+  *--p = (char)c;
+  return p;
+}
+
+char*
+test_func_01 (char* p, int c)
+{
+  *--p = (char)c;
+  *--p = (char)c;
+  *--p = (char)c;
+  return p;
+}
+
+short*
+test_func_02 (short* p, int c)
+{
+  *--p = (short)c;
+  *--p = (short)c;
+  return p;
+}
+
+short*
+test_func_03 (short* p, int c)
+{
+  *--p = (short)c;
+  *--p = (short)c;
+  *--p = (short)c;
+  return p;
+}
+
+int*
+test_func_04 (int* p, int c)
+{
+  *--p = c;
+  *--p = c;
+  return p;
+}
+
+int*
+test_func_05 (int* p, int c)
+{
+  *--p = c;
+  *--p = c;
+  *--p = c;
+  return p;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-3.c b/gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-3.c
new file mode 100644 (file)
index 0000000..f242bf3
--- /dev/null
@@ -0,0 +1,37 @@
+/* PR target/50749: Verify that pre-decrement addressing is generated
+   inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+
+char*
+test_func_00 (char* p, int c, int x)
+{
+  do
+  {
+    *--p = (char)x;
+  } while (--c);
+  return p;
+}
+
+short*
+test_func_01 (short* p, int c, int x)
+{
+  do
+  {
+    *--p = (short)x;
+  } while (--c);
+  return p;
+}
+
+int*
+test_func_02 (int* p, int c, int x)
+{
+  do
+  {
+    *--p = x;
+  } while (--c);
+  return p;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-4.c b/gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-4.c
new file mode 100644 (file)
index 0000000..24601ca
--- /dev/null
@@ -0,0 +1,43 @@
+/* PR target/50749: Verify that pre-decrement addressing is generated
+   inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\tr\[0-9]\+,@-r\[0-9]\+" 3 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 3 { xfail *-*-*} } } */
+/* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 3 { xfail *-*-*} } } */
+
+char*
+test_func_00 (char* p, int c, int x)
+{
+  do
+  {
+    *--p = (char)x;
+    *--p = (char)x;
+    *--p = (char)x;
+  } while (--c);
+  return p;
+}
+
+short*
+test_func_01 (short* p, int c, int x)
+{
+  do
+  {
+    *--p = (short)x;
+    *--p = (short)x;
+    *--p = (short)x;
+  } while (--c);
+  return p;
+}
+
+int*
+test_func_02 (int* p, int c, int x)
+{
+  do
+  {
+    *--p = x;
+    *--p = x;
+    *--p = x;
+  } while (--c);
+  return p;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-1.c b/gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-1.c
new file mode 100644 (file)
index 0000000..9408461
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR target/50749: Verify that post-increment addressing is generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 1 } } */
+
+float*
+test_func_00 (float* p, float* x)
+{
+  float r = 0;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-2.c b/gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-2.c
new file mode 100644 (file)
index 0000000..b40becd
--- /dev/null
@@ -0,0 +1,27 @@
+/* PR target/50749: Verify that subsequent post-increment addressings
+   are generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 5 { xfail *-*-*} } } */
+
+float*
+test_func_00 (float* p, float* x)
+{
+  float r = 0;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+float*
+test_func_01 (float* p, float* x)
+{
+  float r = 0;
+  r += *p++;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-3.c b/gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-3.c
new file mode 100644 (file)
index 0000000..ebc9651
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR target/50749: Verify that post-increment addressing is generated
+   inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 1 } } */
+
+float
+test_func_00 (float* p, int c)
+{
+  float r = 0;
+  do
+  {
+    r += *p++;
+  } while (--c);
+  return r;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-4.c b/gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-4.c
new file mode 100644 (file)
index 0000000..66d29f0
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR target/50749: Verify that post-increment addressing is generated
+   inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 3 { xfail *-*-*} } } */
+
+float
+test_func_00 (float* p, int c)
+{
+  float r = 0;
+  do
+  {
+    r += *p++;
+    r += *p++;
+    r += *p++;
+  } while (--c);
+  return r;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-sf-predec-1.c b/gcc/testsuite/gcc.target/sh/pr50749-sf-predec-1.c
new file mode 100644 (file)
index 0000000..bd4e2cb
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR target/50749: Verify that pre-decrement addressing is generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+
+float*
+test_func_00 (float* p, float c)
+{
+  *--p = c;
+  return p;
+}
+
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-sf-predec-2.c b/gcc/testsuite/gcc.target/sh/pr50749-sf-predec-2.c
new file mode 100644 (file)
index 0000000..96d9a6c
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR target/50749: Verify that subsequent pre-decrement addressings
+   are generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 5 { xfail *-*-*} } } */
+
+float*
+test_func_00 (float* p, float c)
+{
+  *--p = c;
+  *--p = c;
+  return p;
+}
+
+float*
+test_func_01 (float* p, float c)
+{
+  *--p = c;
+  *--p = c;
+  *--p = c;
+  return p;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-sf-predec-3.c b/gcc/testsuite/gcc.target/sh/pr50749-sf-predec-3.c
new file mode 100644 (file)
index 0000000..d1996a2
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR target/50749: Verify that pre-decrement addressing is generated
+   inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+
+float*
+test_func_00 (float* p, int c, float x)
+{
+  do
+  {
+    *--p = x;
+  } while (--c);
+  return p;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr50749-sf-predec-4.c b/gcc/testsuite/gcc.target/sh/pr50749-sf-predec-4.c
new file mode 100644 (file)
index 0000000..6d7b905
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR target/50749: Verify that pre-decrement addressing is generated
+   inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 3 { xfail *-*-*} } } */
+
+float*
+test_func_00 (float* p, int c, float x)
+{
+  do
+  {
+    *--p = x;
+    *--p = x;
+    *--p = x;
+  } while (--c);
+  return p;
+}