]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/7245 (ICE in find_reloads)
authorJakub Jelinek <jakub@redhat.com>
Mon, 15 Jul 2002 06:54:37 +0000 (08:54 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 15 Jul 2002 06:54:37 +0000 (08:54 +0200)
PR middle-end/7245
* config/i386/i386.c (const_int_1_31_operand): New.
* config/i386/i386.h (PREDICATE_CODES): Add it.
* config/i386/i386.md (ashlsi3_cmp, ashlsi3_cmp_zext, ashlhi3_cmp,
ashlqi3_cmp, ashrsi3_cmp, ashrsi3_cmp_zext, ashrhi3_cmp, ashrqi3_cmp,
lshrsi3_cmp, lshrsi3_cmp_zext, lshrhi3_cmp, lshrqi3_cmp): Use it.

* gcc.c-torture/compile/20020710-1.c: New test.

From-SVN: r55450

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20020710-1.c [new file with mode: 0644]

index bc5faa0854d9b463c02ed828365c38fe551007c4..8166b8722f6f4c1c526391e4bbfec4f16b1556bb 100644 (file)
@@ -1,3 +1,12 @@
+2002-07-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/7245
+       * config/i386/i386.c (const_int_1_31_operand): New.
+       * config/i386/i386.h (PREDICATE_CODES): Add it.
+       * config/i386/i386.md (ashlsi3_cmp, ashlsi3_cmp_zext, ashlhi3_cmp,
+       ashlqi3_cmp, ashrsi3_cmp, ashrsi3_cmp_zext, ashrhi3_cmp, ashrqi3_cmp,
+       lshrsi3_cmp, lshrsi3_cmp_zext, lshrhi3_cmp, lshrqi3_cmp): Use it.
+
 2002-06-11  Andreas Schwab  <schwab@suse.de>
 
        * config/m68k/m68k.h (PREDICATE_CODES): Define.
index 47e3256d5b18865c00299494207126408633c9ef..a34831ed4c74f0a6ab9df2fbc8698aec448eb6c0 100644 (file)
@@ -2896,6 +2896,18 @@ const_int_1_operand (op, mode)
   return (GET_CODE (op) == CONST_INT && INTVAL (op) == 1);
 }
 
+/* Return nonzero if OP is CONST_INT >= 1 and <= 31 (a valid operand
+   for shift & compare patterns, as shifting by 0 does not change flags),
+   else return zero.  */
+
+int
+const_int_1_31_operand (op, mode)
+     rtx op;
+     enum machine_mode mode ATTRIBUTE_UNUSED;
+{
+  return (GET_CODE (op) == CONST_INT && INTVAL (op) >= 1 && INTVAL (op) <= 31);
+}
+
 /* Returns 1 if OP is either a symbol reference or a sum of a symbol
    reference and a constant.  */
 
index fc5898bdc6a4b2640b18721ff909ceacd6213987..07502a20d39217767f96b4eba6c290f57d015754 100644 (file)
@@ -3029,6 +3029,7 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
                                       SYMBOL_REF, LABEL_REF}},         \
   {"shiftdi_operand", {SUBREG, REG, MEM}},                             \
   {"const_int_1_operand", {CONST_INT}},                                        \
+  {"const_int_1_31_operand", {CONST_INT}},                             \
   {"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}},                        \
   {"aligned_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF,     \
                       LABEL_REF, SUBREG, REG, MEM}},                   \
index 8db3fb75243db54b4ca71d300b00776bfc54022c..c1a4eb980740d7600bea120d2d3b0b2971b09ef9 100644 (file)
   [(set (reg 17)
        (compare
          (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0")
-                    (match_operand:QI 2 "immediate_operand" "I"))
+                    (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
        (ashift:SI (match_dup 1) (match_dup 2)))]
   [(set (reg 17)
        (compare
          (ashift:SI (match_operand:SI 1 "register_operand" "0")
-                    (match_operand:QI 2 "immediate_operand" "I"))
+                    (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:DI 0 "register_operand" "=r")
        (zero_extend:DI (ashift:SI (match_dup 1) (match_dup 2))))]
   [(set (reg 17)
        (compare
          (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
-                    (match_operand:QI 2 "immediate_operand" "I"))
+                    (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
        (ashift:HI (match_dup 1) (match_dup 2)))]
   [(set (reg 17)
        (compare
          (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0")
-                    (match_operand:QI 2 "immediate_operand" "I"))
+                    (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
        (ashift:QI (match_dup 1) (match_dup 2)))]
   [(set (reg 17)
        (compare
          (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
-                      (match_operand:QI 2 "immediate_operand" "I"))
+                      (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
        (ashiftrt:SI (match_dup 1) (match_dup 2)))]
   [(set (reg 17)
        (compare
          (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
-                      (match_operand:QI 2 "immediate_operand" "I"))
+                      (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:DI 0 "register_operand" "=r")
        (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
   [(set (reg 17)
        (compare
          (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
-                      (match_operand:QI 2 "immediate_operand" "I"))
+                      (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
        (ashiftrt:HI (match_dup 1) (match_dup 2)))]
   [(set (reg 17)
        (compare
          (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
-                      (match_operand:QI 2 "immediate_operand" "I"))
+                      (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
        (ashiftrt:QI (match_dup 1) (match_dup 2)))]
   [(set (reg 17)
        (compare
          (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
-                      (match_operand:QI 2 "immediate_operand" "I"))
+                      (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
        (lshiftrt:SI (match_dup 1) (match_dup 2)))]
   [(set (reg 17)
        (compare
          (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
-                      (match_operand:QI 2 "immediate_operand" "I"))
+                      (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:DI 0 "register_operand" "=r")
        (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
   [(set (reg 17)
        (compare
          (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
-                      (match_operand:QI 2 "immediate_operand" "I"))
+                      (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
        (lshiftrt:HI (match_dup 1) (match_dup 2)))]
   [(set (reg 17)
        (compare
          (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
-                      (match_operand:QI 2 "immediate_operand" "I"))
+                      (match_operand:QI 2 "const_int_1_31_operand" "I"))
          (const_int 0)))
    (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
        (lshiftrt:QI (match_dup 1) (match_dup 2)))]
index 9563beddc08c6f984748061dc8a46c1cab9fa12b..0ffb3051aaa005eb2006020553cade8706ac70b7 100644 (file)
@@ -1,3 +1,7 @@
+2002-07-15  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.c-torture/compile/20020710-1.c: New test.
+
 2002-07-11  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/7224
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020710-1.c b/gcc/testsuite/gcc.c-torture/compile/20020710-1.c
new file mode 100644 (file)
index 0000000..bf6c906
--- /dev/null
@@ -0,0 +1,12 @@
+/* Red Hat bugzilla #68395
+   PR middle-end/7245
+   This testcase ICEd on IA-32 because shift & compare patterns
+   predicates allowed any immediate, but constraints allowed only
+   numbers from 1 to 31.  */
+
+void foo (int *x, unsigned int y)
+{
+  int a = y >> -13;
+  if (a)
+    *x = a;
+}