PR target/39423
authorolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 12 Aug 2012 13:23:20 +0000 (13:23 +0000)
committerolegendo <olegendo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 12 Aug 2012 13:23:20 +0000 (13:23 +0000)
* config/sh/predicates.md (mem_index_disp_operand): Check for
arith_reg_operand instead of REG_P.

PR target/39423
* gcc.c-torture/compile/pr39423-1.c: New.
* gcc.c-torture/compile/pr39423-2.c: New.

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

gcc/ChangeLog
gcc/config/sh/predicates.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr39423-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/pr39423-2.c [new file with mode: 0644]

index 0aabdc3..0fd7f72 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-12  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       PR target/39423
+       * config/sh/predicates.md (mem_index_disp_operand): Check for
+       arith_reg_operand instead of REG_P.
+
 2012-08-11  Bernd Schmidt  <bernds@codesourcery.com>
 
        * reload1.c (replaced_subreg, gen_reload): Add
index 209ff29..7defa77 100644 (file)
   plus1_rtx = XEXP (plus0_rtx, 0);
   if (GET_CODE (plus1_rtx) != PLUS)
     return 0;
+  if (! arith_reg_operand (XEXP (plus1_rtx, 1), GET_MODE (XEXP (plus1_rtx, 1))))
+    return 0;
 
   mult_rtx = XEXP (plus1_rtx, 0);
   if (GET_CODE (mult_rtx) != MULT)
     return 0;
-  return REG_P (XEXP (mult_rtx, 0)) && CONST_INT_P (XEXP (mult_rtx, 1))
-        && exact_log2 (INTVAL (XEXP (mult_rtx, 1))) > 0
-        && REG_P (XEXP (plus1_rtx, 1))
+  if (! arith_reg_operand (XEXP (mult_rtx, 0), GET_MODE (XEXP (mult_rtx, 0)))
+      || ! CONST_INT_P (XEXP (mult_rtx, 1)))
+    return 0;
+
+  return exact_log2 (INTVAL (XEXP (mult_rtx, 1))) > 0
         && sh_legitimate_index_p (mode, XEXP (plus0_rtx, 1), TARGET_SH2A, true);
 })
 
index a11888b..f9c8ff4 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-12  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       PR target/39423
+       * gcc.c-torture/compile/pr39423-1.c: New.
+       * gcc.c-torture/compile/pr39423-2.c: New.
+
 2012-08-12  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/54221
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39423-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39423-1.c
new file mode 100644 (file)
index 0000000..34ebb66
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR target/39423 */
+
+int
+foo (const char *name, int nmlen, char *flags)
+{
+  const char *nonspc;
+  int len, n, lfn;
+  int needlfn[2], dotspc[2];
+  unsigned char locale[2];
+  for (nonspc = &name[nmlen - 1]; nonspc >= name && *nonspc == ' '; ++n)
+    {
+      if (!nmlen)
+       {
+         needlfn[name >= nonspc] = !0, dotspc[n != 0] =
+           locale[0], --n, name += len, nmlen -= len;
+       }
+    }
+  if (!lfn && ((dotspc[0] == ' ' && !(len & 0x0010)) || dotspc[0] == '.'))
+    return 22;
+  if (!(needlfn[0] || needlfn[1]))
+    *flags |= 0x02;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39423-2.c b/gcc/testsuite/gcc.c-torture/compile/pr39423-2.c
new file mode 100644 (file)
index 0000000..5307846
--- /dev/null
@@ -0,0 +1,57 @@
+/* PR target/39423 */
+
+typedef unsigned short uint16_t;
+
+typedef struct
+{
+  short x, y;
+} P;
+
+typedef struct
+{
+  uint16_t w, h;
+} D;
+
+typedef struct
+{
+  P p;
+  D s;
+} A;
+
+typedef struct
+{
+  uint16_t f;
+} W;
+
+typedef struct
+{
+  void* w;
+  D s;
+} T;
+
+extern void* foo00 (void*, void*);
+
+void foo01 (W* w)
+{
+  void* it;
+  uint16_t c, i;
+  T* cl;
+  T* rs;
+  T* t;
+  uint16_t rh = 0;
+  uint16_t v = !(w->f & 0x8000);
+  A a = { };
+
+  for (c = 0, it = foo00 (w, 0); it; it = foo00 (w, it), c++);
+
+  for (it = foo00 (w, 0), i = 0; i <= c; it = foo00 (w, it), i++, cl++)
+    {
+      if (i)
+       for (t = rs; t < cl; t++)
+         *((uint16_t*)&t->s + ((!v) ? 1 : 0)) = rh;
+
+      rh = (rh > ((*((uint16_t*)&a.s + ((!v) ? 1 : 0)))))
+          ? rh
+          : ((*((uint16_t*)&a.s + ((!v) ? 1 : 0)))); 
+    }
+}