On 12/23/2025 11:54 PM, Andrew Pinski wrote:
On Tue, Dec 23, 2025 at 8:33 PM Jeffrey Law <[email protected]> wrote:
On 12/23/2025 6:44 PM, Andrew Pinski wrote:
I noticed that on x86_64 and aarch64, noce_try_cond_zero_arith
would produce worse code than noce_try_cmove_arith.
So we should do noce_try_cond_zero_arith last instead
of before noce_try_cmove_arith.
Pushed as obvious after bootstrap/test on x86_64-linux-gnu.
Also checked to make sure riscv testcases still work.
gcc/ChangeLog:
* ifcvt.cc (noce_process_if_block): Move noce_try_cond_zero_arith
last.
Please no. We very much want to use condzero_arith rather than cmove
based things -- that would be pretty bad in general for RISC-V. We
really should dive into why the code isn't as good as we'd like on other
patforms.
I looked and I noticed noce_try_cmove_arith fails for riscv for most
(all?) of the testcases I tried.
Something else to keep in mind. The cmove_arith path is supposed to be
more general than the conzero_arith path. So cmove_arith should come
second. If conzero_arith is doing something dumb for targets with more
generalized conditional move support, then we should be fixing
condzero_arith, not reordering the two approaches.
Jeff