On 8/29/26 5:52 PM, wangjue wrote:
From: juewang <[email protected]>

Handle conditional arithmetic wrapped in a sign or zero extension when
the unchanged value is known to have the same extension.  Use the RTL bit
property queries so equivalent forms such as masked values are recognized
as well as explicit extensions.

gcc/ChangeLog:

        * ifcvt.cc (noce_cond_arith_operation): New function.
        (noce_reg_known_extended_p): New function.
        (noce_try_cond_arith): Handle arithmetic operations wrapped in an
        extension.

gcc/testsuite/ChangeLog:

        * gcc.target/riscv/pr122769.c: Add the branch cost and restrict the
        test to compatible optimization options.
        * gcc.target/riscv/zicond-conditional-add-extend.c: New test.
Sorry, I wasn't clear.  When I suggested using num_sign_bit_copies I was referring to eliminating the entire search in noce_reg_known_extended_p.  Given a pseudo register or an RTL expression you can query num_sign_bit_copies rather than searching through the block to find suitable extensions.

jeff


Reply via email to