re PR target/16144 (Bogus reference to __divdf3 when -O1)
authorRichard Sandiford <rsandifo@redhat.com>
Fri, 25 Jun 2004 06:57:14 +0000 (06:57 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 25 Jun 2004 06:57:14 +0000 (06:57 +0000)
PR target/16144
* config/mips/mips.md (divsf, divdf): Don't FAIL if the first operand
is 1.0; force it into a register instead.

From-SVN: r83639

gcc/ChangeLog
gcc/config/mips/mips.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/mips-div-1.c [new file with mode: 0644]

index c0ea1b7dea60b0934b60f2a16543464b21e24bdb..c99ac822775e507b924d33f9d60641471b885f24 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-25  Richard Sandiford  <rsandifo@redhat.com>
+
+       PR target/16144
+       * config/mips/mips.md (divsf, divdf): Don't FAIL if the first operand
+       is 1.0; force it into a register instead.
+
 2004-06-25  Bernardo Innocenti  <bernie@develer.com>
 
        * config/m68k/m68k.h: Restore valid comment removed by mistake with
index 3dfb98dc005d482a9e1c83a35d35b65355b5c716..545565ce760d9a2af6a383911a4b3168bcaa1626 100644 (file)
 {
   if (const_float_1_operand (operands[1], DFmode))
     if (!(ISA_HAS_FP4 && flag_unsafe_math_optimizations))
-      FAIL;
+      operands[1] = force_reg (DFmode, operands[1]);
 })
 
 ;; This pattern works around the early SB-1 rev2 core "F1" erratum:
 {
   if (const_float_1_operand (operands[1], SFmode))
     if (!(ISA_HAS_FP4 && flag_unsafe_math_optimizations))
-      FAIL;
+      operands[1] = force_reg (SFmode, operands[1]);
 })
 
 ;; This pattern works around the early SB-1 rev2 core "F1" erratum (see
index f7acf36ee0b5c70ab6c08e583d4cb4125202736f..54850865be22a7765b1c6ffa882414a33bf10d94 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-25  Richard Sandiford  <rsandifo@redhat.com>
+
+       * gcc.dg/torture/mips-div-1.c: New test.
+
 2004-06-24  Jeff Law  <law@redhat.com>
 
        * gcc.dg/tree-ssa/20040624-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/mips-div-1.c b/gcc/testsuite/gcc.dg/torture/mips-div-1.c
new file mode 100644 (file)
index 0000000..6345000
--- /dev/null
@@ -0,0 +1,9 @@
+/* Check that hard-float MIPS code doesn't use library calls for 1.0/x.  */
+/* { dg-options "-fno-delayed-branch" } */
+/* { dg-do compile { target mips*-*-* } } */
+
+float f1 (float x) { return 1.0f / x; }
+double f2 (double x) { return 1.0 / x; }
+
+/* { dg-final { scan-assembler-not {lwc1.*__divsf3} } } */
+/* { dg-final { scan-assembler-not {ldc1.*__divdf3} } } */