[Bug rtl-optimization/110305] Incorrect optimization with -O3 -fsignaling-nans -fno-signed-zeros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110305 --- Comment #9 from Michael Morrell --- And what about when -frounding-math is used? The transformation will still occur in simplify_binary_operation_1 if -frounding-math -fno-signed-zeros -fno-signaling-nans is used. Note that fold_real_zero_addition_p checks HONOR_SIGN_DEPENDENT_ROUNDING.
[Bug rtl-optimization/110305] Incorrect optimization with -O3 -fsignaling-nans -fno-signed-zeros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110305 --- Comment #8 from Michael Morrell --- Interesting information. I still feel that perhaps both functions should use the same logic to determine whether to make this transformation, but, for example, the extra checking for the vector case done by fold_real_zero_addition_p may not be needed in simplify_binary_operation_1 because of when the latter is used.
[Bug rtl-optimization/110305] Incorrect optimization with -O3 -fsignaling-nans -fno-signed-zeros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110305 --- Comment #7 from Andrew Pinski --- (In reply to Michael Morrell from comment #6) > I'm curious why this transformation is being done by both > fold_real_zero_addition_p AND simplify_binary_operation_1. The answer there involves the history of GCC and the history of how optimizations were done in GCC. Basically fold_real_zero_addition_p (fold) would only act a statement while simplify_binary_operation_1 could happen between statements (while doing CSE and combine, etc.). That changed with the merge of tree-ssa in r0-58166-g6de9cd9a886ea6 (2004). simplify_binary_operation_1 had the optimization since the begining of git (though it moved from cse.c to simplify-rtx in r0-24738-g0cedb36cbd7e0c and the HONOR_SIGNED_ZEROS was done by r0-41258-g71925bc04f24a4, in 2002 before it was just checking ieee float format and unsafe-math). fold had it since the begining of git also (and changed in a similar fashion as simplify-rtx for the HONOR_SIGNED_ZEROS).
[Bug rtl-optimization/110305] Incorrect optimization with -O3 -fsignaling-nans -fno-signed-zeros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110305 Michael Morrell changed: What|Removed |Added CC||mmorrell at tachyum dot com --- Comment #6 from Michael Morrell --- I'm curious why this transformation is being done by both fold_real_zero_addition_p AND simplify_binary_operation_1. The checks in fold_real_zero_addition_p are more complex and will leave "a + 0.0" unchanged in more cases, yet later simplify_binary_operation_1 transforms the expression for less complex reasons. I also wonder if there aren't similar expressions (perhaps "a * 1.0" -> a) that need to be looked at.
[Bug rtl-optimization/110305] Incorrect optimization with -O3 -fsignaling-nans -fno-signed-zeros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110305 --- Comment #5 from CVS Commits --- The master branch has been updated by Jeff Law : https://gcc.gnu.org/g:827b2a279fc6ad5bb76e4d2c2eb3432955b5e11c commit r14-1952-g827b2a279fc6ad5bb76e4d2c2eb3432955b5e11c Author: Toru Kisuki Date: Mon Jun 19 11:51:09 2023 -0600 Do not allow "x + 0.0" to "x" optimization with -fsignaling-nans gcc/ PR rtl-optimization/110305 * simplify-rtx.cc (simplify_context::simplify_binary_operation_1): Handle HONOR_SNANS for x + 0.0.
[Bug rtl-optimization/110305] Incorrect optimization with -O3 -fsignaling-nans -fno-signed-zeros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110305 --- Comment #4 from tkisuki at tachyum dot com --- (In reply to Richard Biener from comment #3) > Confirmed. GENERIC properly handles signalling NaNs via > fold_real_zero_addition_p. > > If you send a patch to gcc-patches@ I'll approve it. Thank you, I just sent the patch to gcc-patches.
[Bug rtl-optimization/110305] Incorrect optimization with -O3 -fsignaling-nans -fno-signed-zeros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110305 Richard Biener changed: What|Removed |Added Last reconfirmed||2023-06-19 Version|og12 (devel/omp/gcc-12) |14.0 Status|UNCONFIRMED |NEW Keywords||wrong-code Component|c |rtl-optimization Ever confirmed|0 |1 --- Comment #3 from Richard Biener --- Confirmed. GENERIC properly handles signalling NaNs via fold_real_zero_addition_p. If you send a patch to gcc-patches@ I'll approve it.