re PR target/14888 (ICE with -O2 -ffast-math in final_scan_insn())

PR target/14888
	* config/i386/i386.md (truncdfsf2_noop, truncxfsf2_noop,
	truncxfdf2_noop): Provide dummy "fmov" implementations.

	* g++.dg/opt/pr14888.C: New test case.

From-SVN: r80539
This commit is contained in:
Roger Sayle 2004-04-09 01:36:49 +00:00 committed by Roger Sayle
parent 2a782c52ee
commit 82a6a7583c
4 changed files with 66 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2004-04-08 Roger Sayle <roger@eyesopen.com>
PR target/14888
* config/i386/i386.md (truncdfsf2_noop, truncxfsf2_noop,
truncxfdf2_noop): Provide dummy "fmov" implementations.
2004-04-08 Ian Lance Taylor <ian@wasabisystems.com>
* gcc.c (default_compilers): Add missing initializers.

View File

@ -3677,7 +3677,17 @@
[(set (match_operand:SF 0 "register_operand" "=f")
(float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
"TARGET_80387 && flag_unsafe_math_optimizations"
"#")
{
if (REG_P (operands[1])
&& find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
return "fstp\t%y0";
else if (STACK_TOP_P (operands[0]))
return "fld%z1\t%y1";
else
return "fst\t%y0";
}
[(set_attr "type" "fmov")
(set_attr "mode" "SF")])
(define_insn "*truncdfsf2_1"
[(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
@ -3920,7 +3930,17 @@
[(set (match_operand:SF 0 "register_operand" "=f")
(float_truncate:SF (match_operand:XF 1 "register_operand" "f")))]
"TARGET_80387 && flag_unsafe_math_optimizations"
"#")
{
if (REG_P (operands[1])
&& find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
return "fstp\t%y0";
else if (STACK_TOP_P (operands[0]))
return "fld%z1\t%y1";
else
return "fst\t%y0";
}
[(set_attr "type" "fmov")
(set_attr "mode" "SF")])
(define_insn "*truncxfsf2_1"
[(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
@ -3999,7 +4019,17 @@
[(set (match_operand:DF 0 "register_operand" "=f")
(float_truncate:DF (match_operand:XF 1 "register_operand" "f")))]
"TARGET_80387 && flag_unsafe_math_optimizations"
"#")
{
if (REG_P (operands[1])
&& find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
return "fstp\t%y0";
else if (STACK_TOP_P (operands[0]))
return "fld%z1\t%y1";
else
return "fst\t%y0";
}
[(set_attr "type" "fmov")
(set_attr "mode" "DF")])
(define_insn "*truncxfdf2_1"
[(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f#rY,?r#fY,?Y#rf")

View File

@ -1,3 +1,8 @@
2004-04-08 Roger Sayle <roger@eyesopen.com>
PR target/14888
* g++.dg/opt/pr14888.C: New test case.
2004-04-08 Geoffrey Keating <geoffk@apple.com>
* gcc.dg/pch/valid-1.c, gcc.dg/pch/valid-2.c, gcc.dg/pch/valid-3.c,

View File

@ -0,0 +1,22 @@
// PR target/14888
// This used to ICE because the truncdfsf2 isn't completely eliminated
// { dg-do compile }
// { dg-options "-O2 -ffast-math" }
class xcomplex
{
public:
float re, im;
xcomplex &operator*= (const float &fact)
{ re*=fact; im*=fact; return *this; }
};
void foo (xcomplex &almT, xcomplex &almG)
{
double gb;
almT*=gb;
almG*=gb*42;
}