+2006-11-04 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/26915
+ * config/i386/i386.c (standard_80387_constant_p): Treat -0.0 and -1.0
+ as a valid 80387 constant.
+ (standard_80387_constant_opcode): Return "#" for -0.0 and -1.0.
+ * config/i386/i386.md (unnamed splitter): Split the load of
+ constant -0.0 or -1.0 into the load of 0.0 or 1.0, followed
+ by negation.
+
2006-11-04 Richard Earnshaw <rearnsha@arm.com>
* arm.c (thumb_legitimate_addres_p): Allow any constant offset
* config/i386/i386.md (*movxf_nointeger, *movxf_integer): Enable
patterns for standard 80387 constants.
-
2006-11-03 Paolo Bonzini <bonzini@gnu.org>
Steven Bosscher <steven@gcc.gnu.org>
int
standard_80387_constant_p (rtx x)
{
+ REAL_VALUE_TYPE r;
+
if (GET_CODE (x) != CONST_DOUBLE || !FLOAT_MODE_P (GET_MODE (x)))
return -1;
if (x == CONST1_RTX (GET_MODE (x)))
return 2;
+ REAL_VALUE_FROM_CONST_DOUBLE (r, x);
+
/* For XFmode constants, try to find a special 80387 instruction when
optimizing for size or on those CPUs that benefit from them. */
if (GET_MODE (x) == XFmode
&& (optimize_size || x86_ext_80387_constants & TUNEMASK))
{
- REAL_VALUE_TYPE r;
int i;
if (! ext_80387_constants_init)
init_ext_80387_constants ();
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
for (i = 0; i < 5; i++)
if (real_identical (&r, &ext_80387_constants_table[i]))
return i + 3;
}
+ /* Load of the constant -0.0 or -1.0 will be split as
+ fldz;fchs or fld1;fchs sequence. */
+ if (real_isnegzero (&r))
+ return 8;
+ if (real_identical (&r, &dconstm1))
+ return 9;
+
return 0;
}
return "fldl2t";
case 7:
return "fldpi";
+ case 8:
+ case 9:
+ return "#";
default:
gcc_unreachable ();
}
[(set_attr "type" "fxch")
(set_attr "mode" "XF")])
+;; Split the load of -0.0 or -1.0 into fldz;fchs or fld1;fchs sequence
+(define_split
+ [(set (match_operand:X87MODEF 0 "register_operand" "")
+ (match_operand:X87MODEF 1 "immediate_operand" ""))]
+ "reload_completed && FP_REGNO_P (REGNO (operands[0]))
+ && (standard_80387_constant_p (operands[1]) == 8
+ || standard_80387_constant_p (operands[1]) == 9)"
+ [(set (match_dup 0)(match_dup 1))
+ (set (match_dup 0)
+ (neg:X87MODEF (match_dup 0)))]
+{
+ REAL_VALUE_TYPE r;
+
+ REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
+ if (real_isnegzero (&r))
+ operands[1] = CONST0_RTX (<MODE>mode);
+ else
+ operands[1] = CONST1_RTX (<MODE>mode);
+})
+
(define_expand "movtf"
[(set (match_operand:TF 0 "nonimmediate_operand" "")
(match_operand:TF 1 "nonimmediate_operand" ""))]
+2006-11-04 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/26915
+ * gcc.target/i386/387-12.c: New test.
+
2006-11-04 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/29713
--- /dev/null
+/* PR target/26915 */
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O" } */
+
+double testm0(void)
+{
+ return -0.0;
+}
+
+double testm1(void)
+{
+ return -1.0;
+}
+
+/* { dg-final { scan-assembler "fldz" } } */
+/* { dg-final { scan-assembler "fld1" } } */