[PATCH] PR rtl-optimization/126521: Don't generate ABS in RTL ifcvt with NaNs.
Roger Sayle
roger@nextmovesoftware.com
Mon Oct 5 15:06:00 GMT 2026
This patch addresses PR rtl-optimization/126521 where ifcvt transforms
x < 0 ? -x : x (and x < 0 ? x : -x) into ABS (and NABS respectively).
Unfortunately, these transformations are unsafe in the presence of NaNs.
The simple fix is a one-line change to noce_try_abs.
This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
and make -k check, both with and without --target_board=unix{-m32}
with no new failures. Ok for mainline?
2026-10-05 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR rtl-optimization/126521
* ifcvt.c (noce_try_abs): These conversions are unsafe in the
presence of NaNs.
gcc/testsuite/ChangeLog
PR rtl-optimization/126521
* gcc.target/i386/pr126521.c: New test case.
Thanks in advance,
Roger
--
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patchnn.txt
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20261005/a80a6dda/attachment.txt>
More information about the Gcc-patches
mailing list