https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123312
--- 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:e0a8b636253b21aae0ce4b66348163171322c7f9 commit r16-6747-ge0a8b636253b21aae0ce4b66348163171322c7f9 Author: Andrew Pinski <[email protected]> Date: Fri Jan 9 23:14:22 2026 -0800 ifcvt: Improve `cmp?a&b:a` to try with -1 [PR123312] After the current improvements to ifcvt, on some targets for cmp?a&b:a it is better to produce `(cmp?b:-1) & a` rather than `(!cmp?a:0)|(a & b)`. So this extends noce_try_cond_zero_arith (with a rename to noce_try_cond_arith) to see if `cmp ? a : -1` is cheaper than `!cmp?a:0`. Bootstrapped and tested on x86_64-linux-gnu. PR rtl-optimization/123312 gcc/ChangeLog: * ifcvt.cc (noce_try_cond_zero_arith): Rename to ... (noce_try_cond_arith): This. For AND try `cmp ? a : -1` also to see which one cost less. (noce_process_if_block): Handle the rename. Signed-off-by: Andrew Pinski <[email protected]>
