[Bug tree-optimization/122286] fold (a < b) ? -1 : (a > b ? 1 : 0) into (a < b) - (a > b) or the other way around
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Oct 20 19:09:29 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122286
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For aarch64, cmp_double_asc and cmp_double_asc_2 are better than
cmp_double_asc_branchless.
fcmpe d0, d1
cset w0, gt
csinv w0, w0, wzr, ge
ret
vs:
fcmpe d0, d1
cset w1, mi
cset w0, gt
sub w0, w1, w0
ret
This is because forming -1/0 is easy done in csinv/cset and doing `b?-a:c` is
also easy.
More information about the Gcc-bugs
mailing list