On 6/27/25 7:59 AM, Oleg Endo wrote:
On Fri, 2025-06-27 at 10:51 -0300, Raphael Moreira Zinsly wrote:
A right shift of 31 will become 0 or 1, this can be checked for
treg_set_expr_not_const01 to avoid matching addc_t_r as this
can expand to a 3 insn sequence instead.
This improves tests 023 to 026 from gcc.target/sh/pr54236-2.c, e.g.:
test_023:
shll r5
mov #0,r1
mov r4,r0
rts
addc r1,r0
With this change:
test_023:
shll r5
movt r0
rts
add r4,r0
We noticed this while evaluating a patch to improve how we handle
selecting between two constants based on the output of a LT/GE 0
test.
gcc/ChangeLog:
* config/sh/predicates.md
(treg_set_expr_not_const01): call sh_recog_treg_set_expr_not_01
* config/sh/sh-protos.h
(sh_recog_treg_set_expr_not_01): New function
config/sh/sh.cc (sh_recog_treg_set_expr_not_01): Likewise
gcc/testsuite/ChangeLog:
* gcc.target/sh/pr54236-2.c: Fix comments and expected output
Assuming that this passes the usual regression tests, it looks OK to me.
Please apply.
I ran it in my tester for Raphael. So sh3/sh3eb linux crosses. The
sh4/sh4eb bootstraps won't fire off until Sun/Mon if I remember the
scheduling correctly.
jeff