re PR rtl-optimization/10764 (ICE when using log(), -fast-math and optimization)

PR optimization/10764
	* config/i386/i386.md (atan2df3, atan2sf3, atan2xf3, atan2tf3):
	Add an explicit clobber to show that UNSPEC_FPATAN clobbers st(1).
	(*fyl2x_sfxf3, *fyl2x_dfxf3, *fyl2x_xf3, *fyl2x_tfxf3):  Likewise,
	add an explicit clobber to show that UNSPEC_FYL2X clobbers st(1).
	(logsf2, logdf2, logxf2, logtf2): Update expander patterns to match
	the corresponding *fyl2x_?fxf3 instructions.

	* gcc.dg/builtins-15.c: New test case.

From-SVN: r66811
This commit is contained in:
Roger Sayle 2003-05-14 21:13:49 +00:00 committed by Roger Sayle
parent f42f5a1b1e
commit e43736ad2e
4 changed files with 87 additions and 44 deletions

View File

@ -1,3 +1,13 @@
2003-05-14 Roger Sayle <roger@eyesopen.com>
PR optimization/10764
* config/i386/i386.md (atan2df3, atan2sf3, atan2xf3, atan2tf3):
Add an explicit clobber to show that UNSPEC_FPATAN clobbers st(1).
(*fyl2x_sfxf3, *fyl2x_dfxf3, *fyl2x_xf3, *fyl2x_tfxf3): Likewise,
add an explicit clobber to show that UNSPEC_FYL2X clobbers st(1).
(logsf2, logdf2, logxf2, logtf2): Update expander patterns to match
the corresponding *fyl2x_?fxf3 instructions.
2003-05-14 Richard Henderson <rth@redhat.com>
* config/ia64/ia64.c (ia64_expand_load_address): Force destination

View File

@ -15481,10 +15481,11 @@
(set_attr "mode" "XF")])
(define_insn "atan2df3"
[(set (match_operand:DF 0 "register_operand" "=f")
(unspec:DF [(match_operand:DF 2 "register_operand" "0")
(match_operand:DF 1 "register_operand" "u")]
UNSPEC_FPATAN))]
[(parallel [(set (match_operand:DF 0 "register_operand" "=f")
(unspec:DF [(match_operand:DF 2 "register_operand" "0")
(match_operand:DF 1 "register_operand" "u")]
UNSPEC_FPATAN))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
"fpatan"
@ -15492,10 +15493,11 @@
(set_attr "mode" "DF")])
(define_insn "atan2sf3"
[(set (match_operand:SF 0 "register_operand" "=f")
(unspec:SF [(match_operand:SF 2 "register_operand" "0")
(match_operand:SF 1 "register_operand" "u")]
UNSPEC_FPATAN))]
[(parallel [(set (match_operand:SF 0 "register_operand" "=f")
(unspec:SF [(match_operand:SF 2 "register_operand" "0")
(match_operand:SF 1 "register_operand" "u")]
UNSPEC_FPATAN))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
"fpatan"
@ -15503,10 +15505,11 @@
(set_attr "mode" "SF")])
(define_insn "atan2xf3"
[(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FPATAN))]
[(parallel [(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FPATAN))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
"fpatan"
@ -15514,10 +15517,11 @@
(set_attr "mode" "XF")])
(define_insn "atan2tf3"
[(set (match_operand:TF 0 "register_operand" "=f")
(unspec:TF [(match_operand:TF 2 "register_operand" "0")
(match_operand:TF 1 "register_operand" "u")]
UNSPEC_FPATAN))]
[(parallel [(set (match_operand:TF 0 "register_operand" "=f")
(unspec:TF [(match_operand:TF 2 "register_operand" "0")
(match_operand:TF 1 "register_operand" "u")]
UNSPEC_FPATAN))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
"fpatan"
@ -15525,10 +15529,11 @@
(set_attr "mode" "XF")])
(define_insn "*fyl2x_sfxf3"
[(set (match_operand:SF 0 "register_operand" "=f")
(unspec:SF [(match_operand:SF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))]
[(parallel [(set (match_operand:SF 0 "register_operand" "=f")
(unspec:SF [(match_operand:SF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
"fyl2x"
@ -15536,10 +15541,11 @@
(set_attr "mode" "SF")])
(define_insn "*fyl2x_dfxf3"
[(set (match_operand:DF 0 "register_operand" "=f")
(unspec:DF [(match_operand:DF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))]
[(parallel [(set (match_operand:DF 0 "register_operand" "=f")
(unspec:DF [(match_operand:DF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
"fyl2x"
@ -15547,10 +15553,11 @@
(set_attr "mode" "DF")])
(define_insn "*fyl2x_xf3"
[(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))]
[(parallel [(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
"fyl2x"
@ -15558,10 +15565,11 @@
(set_attr "mode" "XF")])
(define_insn "*fyl2x_tfxf3"
[(set (match_operand:TF 0 "register_operand" "=f")
(unspec:TF [(match_operand:TF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))]
[(parallel [(set (match_operand:TF 0 "register_operand" "=f")
(unspec:TF [(match_operand:TF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
"fyl2x"
@ -15569,9 +15577,10 @@
(set_attr "mode" "XF")])
(define_expand "logsf2"
[(set (match_operand:SF 0 "register_operand" "")
(unspec:SF [(match_operand:SF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))]
[(parallel [(set (match_operand:SF 0 "register_operand" "")
(unspec:SF [(match_operand:SF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))
(clobber (match_dup 2))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
{
@ -15583,9 +15592,10 @@
})
(define_expand "logdf2"
[(set (match_operand:DF 0 "register_operand" "")
(unspec:DF [(match_operand:DF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))]
[(parallel [(set (match_operand:DF 0 "register_operand" "")
(unspec:DF [(match_operand:DF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))
(clobber (match_dup 2))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
{
@ -15597,9 +15607,10 @@
})
(define_expand "logxf2"
[(set (match_operand:XF 0 "register_operand" "")
(unspec:XF [(match_operand:XF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))]
[(parallel [(set (match_operand:XF 0 "register_operand" "")
(unspec:XF [(match_operand:XF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))
(clobber (match_dup 2))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
{
@ -15611,9 +15622,10 @@
})
(define_expand "logtf2"
[(set (match_operand:TF 0 "register_operand" "")
(unspec:TF [(match_operand:TF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))]
[(parallel [(set (match_operand:TF 0 "register_operand" "")
(unspec:TF [(match_operand:TF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))
(clobber (match_dup 2))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations"
{

View File

@ -1,3 +1,7 @@
2003-05-14 Roger Sayle <roger@eyesopen.com>
* gcc.dg/builtins-15.c: New test case.
2003-05-13 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/const-elim-1.c: Tighten scan-assembler-not regexp.

View File

@ -0,0 +1,17 @@
/* Derived from PR optimization/10764 */
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math" } */
double log(double x);
double ndtri(double y0)
{
double x;
x = log(y0);
x = log(x);
return x;
}