Hi,
Some scan-assembler-times tests fail with -mlra for
gcc.target/sh/pr49263-2.c and gcc.target/sh/pr64345-2.c.
A reduced test case
int foo (int x) { return (x & 255) == 0;}
gives a code like
mov r4,r0
tst #255,r0
rts
movt r0
with -mno-lra and
mov.w .L2,r1
tst r1,r4
rts
movt r0
.align 1
.L2:
.short 255
with -mlra. These tst instructions come from tstsi_t insn:
(define_insn_and_split "tstsi_t"
[(set (reg:SI T_REG)
(eq:SI (and:SI (match_operand:SI 0 "arith_reg_operand" "%z,r")
(match_operand:SI 1 "arith_or_int_operand" "K08,r"))
(const_int 0)))]
It looks that LRA somtimes prefers r/r alternative to z/K08.
The attached patch tunes it with disparaging r/r slightly. Tested
on sh4-unknown-linux-gnu with no new failures for -mlra/-mno-lra.
There are no visible changes over generated objects with -mno-lra
in CSiBE. Committed on trunk.
Regards,
kaz
--
2015-06-10 Kaz Kojima <[email protected]>
* config/sh/sh.md (tstsi_t): Add '?' modifier to 'r' alternative
of the second operand.
diff --git a/config/sh/sh.md b/config/sh/sh.md
index 33241a8..e88d249 100644
--- a/config/sh/sh.md
+++ b/config/sh/sh.md
@@ -616,7 +616,7 @@
(define_insn_and_split "tstsi_t"
[(set (reg:SI T_REG)
(eq:SI (and:SI (match_operand:SI 0 "arith_reg_operand" "%z,r")
- (match_operand:SI 1 "arith_or_int_operand" "K08,r"))
+ (match_operand:SI 1 "arith_or_int_operand" "K08,?r"))
(const_int 0)))]
"TARGET_SH1
&& (can_create_pseudo_p () || arith_reg_operand (operands[1], SImode)