[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #18 from rguenth at gcc dot gnu dot org 2006-11-06 09:33 --- Subject: Bug 19116 Author: rguenth Date: Mon Nov 6 09:33:16 2006 New Revision: 118517 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=118517 Log: 2006-11-06 Richard Guenther [EMAIL PROTECTED] Backport from mainline: 2006-10-21 Richard Guenther [EMAIL PROTECTED] PR target/19116 * config/i386/i386.c (override_options): Do not set MASK_IEEE_FP if flag_unsafe_math_optimizations is specified. We have flag_finite_math_only for that. * config/i386/i386.md (sqrtxf2): Do not require TARGET_IEEE_FP or flag_unsafe_math_optimizations. PR middle-end/28796 * simplify-rtx.c (simplify_const_relational_operation): Do not constant-fold ORDERED and UNORDERED for flag_unsafe_math_optimizations but only we do not need to honor NaNs for the given mode. Modified: branches/gcc-4_2-branch/gcc/ChangeLog branches/gcc-4_2-branch/gcc/config/i386/i386.c branches/gcc-4_2-branch/gcc/config/i386/i386.md branches/gcc-4_2-branch/gcc/simplify-rtx.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #19 from rguenth at gcc dot gnu dot org 2006-11-06 09:34 --- Fixed for 4.2.0. The RM decided it's not worth the change in behavior during the 4.1/4.0 series (I agree). -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||FIXED Target Milestone|4.3.0 |4.2.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #14 from ubizjak at gmail dot com 2006-11-04 10:53 --- According to PR 29705 (testcase is included in the PR) this is a wrong code bug on 4.2 (and possibly others) branch. -- ubizjak at gmail dot com changed: What|Removed |Added CC||ubizjak at gmail dot com Status|RESOLVED|REOPENED Known to fail||4.0.0 4.1.0 4.2.0 Known to work||4.3.0 Resolution|FIXED | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #15 from rguenth at gcc dot gnu dot org 2006-11-04 13:30 --- But it's not a regression. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #16 from james dot me at gmail dot com 2006-11-04 16:26 --- I applied Richard Guenther's patch to my own 4.2 svn branch to get this fixed locally, but the change had no effect. I am a little puzzled by this, because what I can discern from the discussion and comments the change: /* If we're doing fast math, we don't care about comparison order wrt NaNs. This lets us use a shorter comparison sequence. */ - if (flag_unsafe_math_optimizations) + if (flag_finite_math_only) target_flags = ~MASK_IEEE_FP; is a definitive fix. What else is going on here? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #17 from rguenth at gcc dot gnu dot org 2006-11-04 16:32 --- There is another one in simplify-rtx.c: Author: rguenth Date: Sat Oct 21 10:13:13 2006 New Revision: 117928 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=117928 Log: 2006-10-21 Richard Guenther [EMAIL PROTECTED] PR middle-end/28796 * simplify-rtx.c (simplify_const_relational_operation): Do not constant-fold ORDERED and UNORDERED for flag_unsafe_math_optimizations but only we do not need to honor NaNs for the given mode. Modified: trunk/gcc/ChangeLog trunk/gcc/simplify-rtx.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #13 from pinskia at gcc dot gnu dot org 2006-11-03 22:35 --- *** Bug 29705 has been marked as a duplicate of this bug. *** -- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||james dot me at gmail dot ||com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #11 from rguenth at gcc dot gnu dot org 2006-10-21 10:41 --- Subject: Bug 19116 Author: rguenth Date: Sat Oct 21 10:40:57 2006 New Revision: 117930 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=117930 Log: 2006-10-21 Richard Guenther [EMAIL PROTECTED] PR target/19116 * config/i386/i386.c (override_options): Do not set MASK_IEEE_FP if flag_unsafe_math_optimizations is specified. We have flag_finite_math_only for that. * config/i386/i386.md (sqrtxf2): Do not require TARGET_IEEE_FP or flag_unsafe_math_optimizations. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/config/i386/i386.md -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #12 from rguenth at gcc dot gnu dot org 2006-10-21 10:42 --- Fixed. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Comment #10 from rguenth at gcc dot gnu dot org 2006-08-25 09:01 --- Mine. This regression was introduced at the time we got rid of flag_fast_math and changed it to either flag_unsafe_math_optimizations or flag_trapping_math. +2001-03-07 Brad Lucier [EMAIL PROTECTED] + + * builtins.c (expand_builtin_mathfn): Check + flag_unsafe_math_optimizations, not flag_fast_math. + (expand_builtin): Likewise + * combine.c (combine_simplify_rtx): Likewise. + (simplify_if_then_else): Likewise. + * cse.c (fold_rtx): Likewise. + * flags.h: Remove flag_fast_math. Add + flag_unsafe_math_optimizations and flag_trapping_math. + * fold-const.c (negate_expr): Check + flag_unsafe_math_optimizations, not flag_fast_math. + (invert_truthvalue): Likewise. + (fold): Likewise. Before associating operands, check that + code == MULT_EXPR, not code != MULT_EXPR. + * ifcvt.c (noce_try_minmax): Check + flag_unsafe_math_optimizations, not flag_fast_math. + (noce_operand_ok): Check flag_trapping_math, not flag_fast_math. + * invoke.texi: Document -funsafe-math-optimizations and + -fno-trapping-math. Change documentation for -ffast-math. + * jump.c (reversed_comparison_code_parts): Likewise. + (rtx_equal_for_thread_p): Likewise. + * optabs.c (emit_conditional_move): Likewise. + * simplify-rtx.c (simplify_binary_operation): Likewise. + (simplify_relational_operation): Likewise. + (simplify_ternary_operation): Likewise. + * toplev.c: Remove flag_fast_math. Add flag_trapping_math and + flag_unsafe_math_optimizations. Remove fast-math entry from f_options. + Add trapping-math and unsafe-math-optimizations entries to f_options. + (set_fast_math_flags): New, sets flags for -ffast-math. + (set_no_fast_math_flags): New, sets flags for -fno-fast-math. + (decode_f_option): Add code to handle -ffast-math and -fno-fast-math. + * toplev.h: Declare set_fast_math_flags and set_no_fast_math_flags. + + * config/alpha/alpha.c (alpha_emit_conditional_branch): Likewise. + (alpha_emit_conditional_move): Initialize local_fast_math to + flag_unsafe_math_optimizations, not flat_fast_math. + * config/c4x/c4x.c (c4x_override_options): Call set_fast_math_flags + instead of setting flag_fast_math to 1. + * config/convex/convex.md: Check flag_unsafe_math_optimizations, + not flag_fast_math. + * config/i386/i386.c (override_options): Likewise + * config/i386/i386.md: Likewise. + * config/m68k/m68k.md: Likewise. + * config/mips/mips.md: Likewise. + * config/rs6000/rs6000.c (validate_condition_mode): Likewise. + (rs6000_generate_compare): Likewise. Later flag_finite_math_only was introduced but not all other places fixed. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2005-09-24 16:53:42 |2006-08-25 09:01:01 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Additional Comments From hunor at cs dot bme dot hu 2005-01-17 13:42 --- Are you sure this is wrong? It seems to me that the RS6000 port has just been changed to behave liked this two days ago. If you still think this is a bug, though... This is caused by -mno-ieee-fp being implied by -funsafe-math-optimizations on i386: /* If we're doing fast math, we don't care about comparison order wrt NaNs. This lets us use a shorter comparison sequence. */ if (flag_unsafe_math_optimizations) target_flags = ~MASK_IEEE_FP; If I interpret the documentation correctly, NaN == NaN may happen if either -mno-ieee-fp or -ffinite-math-only is given (-ffinite-math-only should not imply -mno-ieee-fp either as that changes the behavior of square root calculations too). I can send you my patch if you reach the conclusion that this is a bug. -- What|Removed |Added CC||hunor at cs dot bme dot hu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
[Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
--- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-27 14:00 --- Yep, I was right, thanks for testing. -- What|Removed |Added Summary|-fno-finite-math-only does |-funsafe-math-optimizations |not override -ffast-math|make nan compares equal to ||one another (-finite-math- ||only should be doing that) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116