OSDN Git Service

* config/mips/mips.c (mips_gen_conditional_trap): Fix mode.
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Aug 2004 20:04:57 +0000 (20:04 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Aug 2004 20:04:57 +0000 (20:04 +0000)
* config/mips/mips.md (*conditional_trap[sd]i): Name previously unnamed
patterns.  Redefine using :GPR.  Give the match_operator a mode.
Use '%2' rather than '%z2' for operand 2.

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

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/config/mips/mips.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/iftrap-3.c [new file with mode: 0644]

index 4af8dcf..31adda2 100644 (file)
@@ -1,5 +1,12 @@
 2004-08-24  Richard Sandiford  <rsandifo@redhat.com>
 
+       * config/mips/mips.c (mips_gen_conditional_trap): Fix mode.
+       * config/mips/mips.md (*conditional_trap[sd]i): Name previously unnamed
+       patterns.  Redefine using :GPR.  Give the match_operator a mode.
+       Use '%2' rather than '%z2' for operand 2.
+
+2004-08-24  Richard Sandiford  <rsandifo@redhat.com>
+
        * config/mips/mips.md (load_call[sd]i): Redefine using :P.  Add mode
        attribute.
 
index 5067324..9f0bf68 100644 (file)
@@ -2578,20 +2578,20 @@ mips_gen_conditional_trap (rtx *operands)
     }
   if (cmp_code == GET_CODE (operands[0]))
     {
-      op0 = force_reg (mode, cmp_operands[0]);
+      op0 = cmp_operands[0];
       op1 = cmp_operands[1];
     }
   else
     {
-      op0 = force_reg (mode, cmp_operands[1]);
+      op0 = cmp_operands[1];
       op1 = cmp_operands[0];
     }
-  if (GET_CODE (op1) == CONST_INT && ! SMALL_INT (op1))
+  op0 = force_reg (mode, op0);
+  if (!arith_operand (op1, mode))
     op1 = force_reg (mode, op1);
 
   emit_insn (gen_rtx_TRAP_IF (VOIDmode,
-                             gen_rtx_fmt_ee (cmp_code, GET_MODE (operands[0]),
-                                             op0, op1),
+                             gen_rtx_fmt_ee (cmp_code, mode, op0, op1),
                              operands[1]));
 }
 \f
index 251ec68..46ec8cf 100644 (file)
   else
     return "break";
 }
-  [(set_attr "type"    "trap")])
+  [(set_attr "type" "trap")])
 
 (define_expand "conditional_trap"
   [(trap_if (match_operator 0 "comparison_operator"
            (match_operand 1 "const_int_operand"))]
   "ISA_HAS_COND_TRAP"
 {
-  if (operands[1] == const0_rtx)
+  if (GET_MODE_CLASS (GET_MODE (cmp_operands[0])) == MODE_INT
+      && operands[1] == const0_rtx)
     {
       mips_gen_conditional_trap (operands);
       DONE;
     FAIL;
 })
 
-(define_insn ""
-  [(trap_if (match_operator 0 "trap_comparison_operator"
-                            [(match_operand:SI 1 "reg_or_0_operand" "dJ")
-                             (match_operand:SI 2 "arith_operand" "dI")])
+(define_insn "*conditional_trap<mode>"
+  [(trap_if (match_operator:GPR 0 "trap_comparison_operator"
+                               [(match_operand:GPR 1 "reg_or_0_operand" "dJ")
+                                (match_operand:GPR 2 "arith_operand" "dI")])
            (const_int 0))]
   "ISA_HAS_COND_TRAP"
-  "t%C0\t%z1,%z2"
-  [(set_attr "type"    "trap")])
-
-(define_insn ""
-  [(trap_if (match_operator 0 "trap_comparison_operator"
-                            [(match_operand:DI 1 "reg_or_0_operand" "dJ")
-                             (match_operand:DI 2 "arith_operand" "dI")])
-           (const_int 0))]
-  "TARGET_64BIT && ISA_HAS_COND_TRAP"
-  "t%C0\t%z1,%z2"
-  [(set_attr "type"    "trap")])
+  "t%C0\t%z1,%2"
+  [(set_attr "type" "trap")])
 \f
 ;;
 ;;  ....................
index 3bf74a0..c49b149 100644 (file)
@@ -1,3 +1,7 @@
+2004-08-24  Richard Sandiford  <rsandifo@redhat.com>
+
+       * gcc.c-torture/compile/iftrap-3.c: New test.
+
 2004-08-24  Paul Brook  <paul@codesourcery.com>
 
        * gfortran.dg/entry_2.f90: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-3.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-3.c
new file mode 100644 (file)
index 0000000..52278e1
--- /dev/null
@@ -0,0 +1,4 @@
+/* Check that the conditional_trap pattern handles floating-point
+   comparisons correctly.  */
+void f1 (float x, float y) { if (x == y) __builtin_trap (); }
+void f2 (double x, double y) { if (x == y) __builtin_trap (); }