diff options
author | Oleg Endo <olegendo@gcc.gnu.org> | 2015-01-08 11:07:45 +0000 |
---|---|---|
committer | Oleg Endo <olegendo@gcc.gnu.org> | 2015-01-08 11:07:45 +0000 |
commit | 3aa8dfe36031ded18994076d290f1ed3456dc197 (patch) | |
tree | ee0407280e2fc184f1d628f7ae41d272663195c9 /gcc | |
parent | bd84df1879c9f7acf4e25a2b7d638013d17e6896 (diff) | |
download | gcc-3aa8dfe36031ded18994076d290f1ed3456dc197.zip gcc-3aa8dfe36031ded18994076d290f1ed3456dc197.tar.gz gcc-3aa8dfe36031ded18994076d290f1ed3456dc197.tar.bz2 |
re PR target/55212 ([SH] Switch to LRA)
gcc/
PR target/55212
* config/sh/sh.md (*addsi3_compact): Emit reg-reg copy instead of
constant load if constant operand fits into I08.
From-SVN: r219341
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/sh/sh.md | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2661550..2d5fcb3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-01-08 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/55212 + * config/sh/sh.md (*addsi3_compact): Emit reg-reg copy instead of + constant load if constant operand fits into I08. + 2015-01-08 Jakub Jelinek <jakub@redhat.com> PR sanitizer/64336 diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 6e0b97f..bbbdc19 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -2061,8 +2061,9 @@ ;; The problem is that LRA expects something like ;; (set rA (plus rB (const_int N))) ;; to work. We can do that, but we have to split out an additional reg-reg -;; copy before the actual add insn. Use u constraint for that case to avoid -;; the invalid value in the stack pointer. +;; copy or constant load before the actual add insn. +;; Use u constraint for that case to avoid the invalid value in the stack +;; pointer. (define_insn_and_split "*addsi3_compact" [(set (match_operand:SI 0 "arith_reg_dest" "=r,&u") (plus:SI (match_operand:SI 1 "arith_operand" "%0,r") @@ -2078,7 +2079,11 @@ && ! reg_overlap_mentioned_p (operands[0], operands[1])" [(set (match_dup 0) (match_dup 2)) (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))] - "" +{ + /* Prefer 'mov r0,r1; add #imm8,r1' over 'mov #imm8,r1; add r0,r1' */ + if (satisfies_constraint_I08 (operands[2])) + std::swap (operands[1], operands[2]); +} [(set_attr "type" "arith")]) ;; ------------------------------------------------------------------------- |