https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122593

--- Comment #1 from Jeffrey A. Law <law at gcc dot gnu.org> ---
It's a bit more complex on rv64 with the provided testcase due to the
extensions.  We end up with something like:

(set (reg:DI 146)
    (sign_extend:DI (plus:SI (subreg:SI (smax:DI (sign_extend:DI (neg:SI
(subreg:SI (reg/v:DI 138 [ b ]) 0)))
                    (reg:DI 148 [ a ])) 0)
            (subreg:SI (reg/v:DI 138 [ b ]) 0))))

But it still a 3 insn sequence, so we can emit the addw+max style sequence to
get the desired code.  When the inputs are the same size as the target word,
then it'll have the struture Andrew noted in the original report.

Reply via email to