https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115571
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <[email protected]>: https://gcc.gnu.org/g:b46390257fecccc5cbc6708fa524b525fefd26f7 commit r17-1939-gb46390257fecccc5cbc6708fa524b525fefd26f7 Author: Andrew Pinski <[email protected]> Date: Mon May 11 17:23:10 2026 -0700 match: Canonicalize `(float)(a CMP b)` into `(a CMP b) ? 1.0 : 0.0` [PR115571] Canonicalize `(type) (a CMP b)` to `(a CMP b) ? (type) true : (type) false` for floating point types. fold-const already does this so it makes sense to do it on the gimple level too. This also improves vectorization because a conversion from a comparison to a float does not need to implemented and also if it is implemented then selection of 1.0/0.0 is easier than the conversion would be. Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/115571 gcc/ChangeLog: * match.pd (`(float)(a CMP b)`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/float-conv-1.c: New test. Signed-off-by: Andrew Pinski <[email protected]>
