[Bug middle-end/123869] Negation of _Float16 should just flip the bit and not promote to _Float32
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 29 21:51:13 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123869
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:41f293e72c253301f71fefc5a5e1040cb468e4ed
commit r16-7160-g41f293e72c253301f71fefc5a5e1040cb468e4ed
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date: Wed Jan 28 16:50:52 2026 -0800
optabs: Fix expansion of abs and neg for Float16 [PR123869]
The problem here is we try to use the widening type before
doing the bitwise expansion of neg/and for floating point types.
This moves the code around to try the bitwise expansion first.
Note this mostly matters for NaNs where you widening (promotion)
would cause a NaN to be slightly different when doing the rounding
back.
Bootstrapped and tested on x86_64-linux-gnu.
PR middle-end/123869
gcc/ChangeLog:
* optabs.cc (expand_unop): Move the NEG optab
handling before the widening code.
Move the ABS bitwise expansion from expand_abs_nojump
to before the widening code.
(expand_abs_nojump): Remove the bitwise expansion trial
since expand_unop is called right above.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
More information about the Gcc-bugs
mailing list