Commit e43736ad by Roger Sayle Committed by Roger Sayle

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
parent f42f5a1b
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> 2003-05-14 Richard Henderson <rth@redhat.com>
* config/ia64/ia64.c (ia64_expand_load_address): Force destination * config/ia64/ia64.c (ia64_expand_load_address): Force destination
......
...@@ -15481,10 +15481,11 @@ ...@@ -15481,10 +15481,11 @@
(set_attr "mode" "XF")]) (set_attr "mode" "XF")])
(define_insn "atan2df3" (define_insn "atan2df3"
[(set (match_operand:DF 0 "register_operand" "=f") [(parallel [(set (match_operand:DF 0 "register_operand" "=f")
(unspec:DF [(match_operand:DF 2 "register_operand" "0") (unspec:DF [(match_operand:DF 2 "register_operand" "0")
(match_operand:DF 1 "register_operand" "u")] (match_operand:DF 1 "register_operand" "u")]
UNSPEC_FPATAN))] UNSPEC_FPATAN))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
"fpatan" "fpatan"
...@@ -15492,10 +15493,11 @@ ...@@ -15492,10 +15493,11 @@
(set_attr "mode" "DF")]) (set_attr "mode" "DF")])
(define_insn "atan2sf3" (define_insn "atan2sf3"
[(set (match_operand:SF 0 "register_operand" "=f") [(parallel [(set (match_operand:SF 0 "register_operand" "=f")
(unspec:SF [(match_operand:SF 2 "register_operand" "0") (unspec:SF [(match_operand:SF 2 "register_operand" "0")
(match_operand:SF 1 "register_operand" "u")] (match_operand:SF 1 "register_operand" "u")]
UNSPEC_FPATAN))] UNSPEC_FPATAN))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
"fpatan" "fpatan"
...@@ -15503,10 +15505,11 @@ ...@@ -15503,10 +15505,11 @@
(set_attr "mode" "SF")]) (set_attr "mode" "SF")])
(define_insn "atan2xf3" (define_insn "atan2xf3"
[(set (match_operand:XF 0 "register_operand" "=f") [(parallel [(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 2 "register_operand" "0") (unspec:XF [(match_operand:XF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")] (match_operand:XF 1 "register_operand" "u")]
UNSPEC_FPATAN))] UNSPEC_FPATAN))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
"fpatan" "fpatan"
...@@ -15514,10 +15517,11 @@ ...@@ -15514,10 +15517,11 @@
(set_attr "mode" "XF")]) (set_attr "mode" "XF")])
(define_insn "atan2tf3" (define_insn "atan2tf3"
[(set (match_operand:TF 0 "register_operand" "=f") [(parallel [(set (match_operand:TF 0 "register_operand" "=f")
(unspec:TF [(match_operand:TF 2 "register_operand" "0") (unspec:TF [(match_operand:TF 2 "register_operand" "0")
(match_operand:TF 1 "register_operand" "u")] (match_operand:TF 1 "register_operand" "u")]
UNSPEC_FPATAN))] UNSPEC_FPATAN))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
"fpatan" "fpatan"
...@@ -15525,10 +15529,11 @@ ...@@ -15525,10 +15529,11 @@
(set_attr "mode" "XF")]) (set_attr "mode" "XF")])
(define_insn "*fyl2x_sfxf3" (define_insn "*fyl2x_sfxf3"
[(set (match_operand:SF 0 "register_operand" "=f") [(parallel [(set (match_operand:SF 0 "register_operand" "=f")
(unspec:SF [(match_operand:SF 2 "register_operand" "0") (unspec:SF [(match_operand:SF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")] (match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))] UNSPEC_FYL2X))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
"fyl2x" "fyl2x"
...@@ -15536,10 +15541,11 @@ ...@@ -15536,10 +15541,11 @@
(set_attr "mode" "SF")]) (set_attr "mode" "SF")])
(define_insn "*fyl2x_dfxf3" (define_insn "*fyl2x_dfxf3"
[(set (match_operand:DF 0 "register_operand" "=f") [(parallel [(set (match_operand:DF 0 "register_operand" "=f")
(unspec:DF [(match_operand:DF 2 "register_operand" "0") (unspec:DF [(match_operand:DF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")] (match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))] UNSPEC_FYL2X))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
"fyl2x" "fyl2x"
...@@ -15547,10 +15553,11 @@ ...@@ -15547,10 +15553,11 @@
(set_attr "mode" "DF")]) (set_attr "mode" "DF")])
(define_insn "*fyl2x_xf3" (define_insn "*fyl2x_xf3"
[(set (match_operand:XF 0 "register_operand" "=f") [(parallel [(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 2 "register_operand" "0") (unspec:XF [(match_operand:XF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")] (match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))] UNSPEC_FYL2X))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
"fyl2x" "fyl2x"
...@@ -15558,10 +15565,11 @@ ...@@ -15558,10 +15565,11 @@
(set_attr "mode" "XF")]) (set_attr "mode" "XF")])
(define_insn "*fyl2x_tfxf3" (define_insn "*fyl2x_tfxf3"
[(set (match_operand:TF 0 "register_operand" "=f") [(parallel [(set (match_operand:TF 0 "register_operand" "=f")
(unspec:TF [(match_operand:TF 2 "register_operand" "0") (unspec:TF [(match_operand:TF 2 "register_operand" "0")
(match_operand:XF 1 "register_operand" "u")] (match_operand:XF 1 "register_operand" "u")]
UNSPEC_FYL2X))] UNSPEC_FYL2X))
(clobber (match_dup 1))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
"fyl2x" "fyl2x"
...@@ -15569,9 +15577,10 @@ ...@@ -15569,9 +15577,10 @@
(set_attr "mode" "XF")]) (set_attr "mode" "XF")])
(define_expand "logsf2" (define_expand "logsf2"
[(set (match_operand:SF 0 "register_operand" "") [(parallel [(set (match_operand:SF 0 "register_operand" "")
(unspec:SF [(match_operand:SF 1 "register_operand" "") (unspec:SF [(match_operand:SF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))] (match_dup 2)] UNSPEC_FYL2X))
(clobber (match_dup 2))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
{ {
...@@ -15583,9 +15592,10 @@ ...@@ -15583,9 +15592,10 @@
}) })
(define_expand "logdf2" (define_expand "logdf2"
[(set (match_operand:DF 0 "register_operand" "") [(parallel [(set (match_operand:DF 0 "register_operand" "")
(unspec:DF [(match_operand:DF 1 "register_operand" "") (unspec:DF [(match_operand:DF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))] (match_dup 2)] UNSPEC_FYL2X))
(clobber (match_dup 2))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
{ {
...@@ -15597,9 +15607,10 @@ ...@@ -15597,9 +15607,10 @@
}) })
(define_expand "logxf2" (define_expand "logxf2"
[(set (match_operand:XF 0 "register_operand" "") [(parallel [(set (match_operand:XF 0 "register_operand" "")
(unspec:XF [(match_operand:XF 1 "register_operand" "") (unspec:XF [(match_operand:XF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))] (match_dup 2)] UNSPEC_FYL2X))
(clobber (match_dup 2))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
{ {
...@@ -15611,9 +15622,10 @@ ...@@ -15611,9 +15622,10 @@
}) })
(define_expand "logtf2" (define_expand "logtf2"
[(set (match_operand:TF 0 "register_operand" "") [(parallel [(set (match_operand:TF 0 "register_operand" "")
(unspec:TF [(match_operand:TF 1 "register_operand" "") (unspec:TF [(match_operand:TF 1 "register_operand" "")
(match_dup 2)] UNSPEC_FYL2X))] (match_dup 2)] UNSPEC_FYL2X))
(clobber (match_dup 2))])]
"! TARGET_NO_FANCY_MATH_387 && TARGET_80387 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
&& flag_unsafe_math_optimizations" && flag_unsafe_math_optimizations"
{ {
......
2003-05-14 Roger Sayle <roger@eyesopen.com>
* gcc.dg/builtins-15.c: New test case.
2003-05-13 Zack Weinberg <zack@codesourcery.com> 2003-05-13 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/const-elim-1.c: Tighten scan-assembler-not regexp. * gcc.dg/const-elim-1.c: Tighten scan-assembler-not regexp.
......
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment