On 12/5/23 01:12, Fei Gao wrote:
op=[PLUS, MINUS, IOR, XOR]

Conditional op, if zero
rd = (rc == 0) ? (rs1 op rs2) : rs1
-->
czero.nez rd, rs2, rc
op rd, rs1, rd

Conditional op, if non-zero
rd = (rc != 0) ? (rs1 op rs2) : rs1
-->
czero.eqz rd, rs2, rc
op rd, rs1, rd

Co-authored-by: Xiao Zeng<zengx...@eswincomputing.com>

gcc/ChangeLog:

        * ifcvt.cc (noce_try_cond_zero_arith):handler for condtional zero based 
ifcvt
         (noce_emit_czero): helper for noce_try_cond_zero_arith
         (noce_cond_zero_binary_op_supported): check supported OPs for 
condtional zero based ifcvt
         (get_base_reg): get the reg itself or NULL_RTX if not a reg
         (noce_bbs_ok_for_cond_zero_arith): check if BBs are OK for condtional 
zero based ifcvt
         (noce_process_if_block): add noce_try_cond_zero_arith

gcc/testsuite/ChangeLog:

        * gcc.target/riscv/zicond_ifcvt_opt.c: New test.
Thanks. In the future make sure to note testing you've done. Given this is a change to target independent code it must be bootstrapped and regression tested on a primary platform.

FTR I've done the bootstrap and regression test on x86_64 in addition to regression testing on rv64gc.

I'll push this to the trunk momentarily.

jeff



Reply via email to