re PR target/33438 (ICE in cselib_record_set, at cselib.c:1515 on x86)
authorUros Bizjak <ubizjak@gmail.com>
Fri, 14 Sep 2007 19:24:26 +0000 (21:24 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Fri, 14 Sep 2007 19:24:26 +0000 (21:24 +0200)
        PR target/33438
        * config/i386/i386.md (fmodxf3): Copy operands[2] to temporary register
        when operands[2] equals operands[1].
        (remainderxf3): Ditto.

testsuite/ChangeLog:

        PR target/33438
        * gcc.target/i386/pr33438.c: New test.

From-SVN: r128502

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr33483.c [new file with mode: 0644]

index c51ce01730ea14aa9a775b31ba1cef43101756ce..728309eda9e6ffdc0b47c69018a721b444c7b441 100644 (file)
@@ -1,3 +1,10 @@
+2007-09-14  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/33438
+       * config/i386/i386.md (fmodxf3): Copy operands[2] to temporary register
+       when operands[2] equals operands[1].
+       (remainderxf3): Ditto.
+
 2007-09-14  Sandra Loosemore  <sandra@codesourcery.com>
            Nigel Stephens  <nigel@mips.com>
 
        (lshr<mode>3): Ditto.
        (ashl<mode>3): Ditto.
        (vec_shl_<mode>): Use const_0_to_255_mul_8_operand predicate for op2.
-       (vec_shr_<mode>): Use const_0_to_255_mul_8_operand predicate for op2.
-
+       (vec_shr_<mode>): Ditto.
        * gcc/config/i386/i386.c (ix86_expand_builtin) [IX86_BUILTIN_PSLL?128,
        IX86_BUILTIN_PSRA*?128, IX86_BUILTIN_PSRL?128]: Convert op1 to SImode.
 
index a0e0c8217050864850b26765b2129501cf2a7c51..622686beeaf109b1e6d9c9c3a42e25db6d7eae2d 100644 (file)
 {
   rtx label = gen_label_rtx ();
 
-  emit_label (label);
+  rtx op2;
+
+  if (rtx_equal_p (operands[1], operands[2]))
+    {
+      op2 = gen_reg_rtx (XFmode);
+      emit_move_insn (op2, operands[2]);
+    }
+  else
+    op2 = operands[2];
 
-  emit_insn (gen_fpremxf4_i387 (operands[1], operands[2],
-                               operands[1], operands[2]));
+  emit_label (label);
+  emit_insn (gen_fpremxf4_i387 (operands[1], op2, operands[1], op2));
   ix86_emit_fp_unordered_jump (label);
   LABEL_NUSES (label) = 1;
 
 {
   rtx label = gen_label_rtx ();
 
-  emit_label (label);
+  rtx op2;
+
+  if (rtx_equal_p (operands[1], operands[2]))
+    {
+      op2 = gen_reg_rtx (XFmode);
+      emit_move_insn (op2, operands[2]);
+    }
+  else
+    op2 = operands[2];
 
-  emit_insn (gen_fprem1xf4_i387 (operands[1], operands[2],
-                                operands[1], operands[2]));
+  emit_label (label);
+  emit_insn (gen_fprem1xf4_i387 (operands[1], op2, operands[1], op2));
   ix86_emit_fp_unordered_jump (label);
   LABEL_NUSES (label) = 1;
 
index 9c18500cc7cdf3b122246e9db3f727bd33de7aee..884f3f93984f2877ca54f2f5756a30e3629b3c27 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-14  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/33438
+       * gcc.target/i386/pr33438.c: New test.
+
 2007-09-14  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        * gfortran.dg/nint_2.f90: Revert previous commit.
diff --git a/gcc/testsuite/gcc.target/i386/pr33483.c b/gcc/testsuite/gcc.target/i386/pr33483.c
new file mode 100644 (file)
index 0000000..8fe2a94
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+long double f1 (long double x)
+{
+  return __builtin_fmodl (x, x);
+}
+
+long double f2 (long double x)
+{
+  return __builtin_remainderl (x, x);
+}