diff options
author | Jeff Law <law@redhat.com> | 2015-05-22 14:08:43 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2015-05-22 14:08:43 -0600 |
commit | cc55969de9b20786ade9537e6497532972e6f566 (patch) | |
tree | 8753bdc32ff1157eb172568c94c63b6eb3e4fee9 /gcc/combine.c | |
parent | 83844a7d2a66a0c3b98687890419003980e4bf96 (diff) | |
download | gcc-cc55969de9b20786ade9537e6497532972e6f566.zip gcc-cc55969de9b20786ade9537e6497532972e6f566.tar.gz gcc-cc55969de9b20786ade9537e6497532972e6f566.tar.bz2 |
combine.c (try_combine): Canonicalize (plus (mult X pow2) Y) into (plus (ashift X log2) Y) if...
* combine.c (try_combine): Canonicalize (plus (mult X pow2) Y) into
(plus (ashift X log2) Y) if it is a split point.
* gcc.target/hppa/shadd-3.c: New test.
From-SVN: r223583
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 4a57557..0817af2 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -3746,6 +3746,21 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, split_code = GET_CODE (*split); } + /* Similarly for (plus (mult FOO (const_int pow2))). */ + if (split_code == PLUS + && GET_CODE (XEXP (*split, 0)) == MULT + && CONST_INT_P (XEXP (XEXP (*split, 0), 1)) + && INTVAL (XEXP (XEXP (*split, 0), 1)) > 0 + && (i = exact_log2 (UINTVAL (XEXP (XEXP (*split, 0), 1)))) >= 0) + { + rtx nsplit = XEXP (*split, 0); + SUBST (XEXP (*split, 0), gen_rtx_ASHIFT (GET_MODE (nsplit), + XEXP (nsplit, 0), GEN_INT (i))); + /* Update split_code because we may not have a multiply + anymore. */ + split_code = GET_CODE (*split); + } + #ifdef INSN_SCHEDULING /* If *SPLIT is a paradoxical SUBREG, when we split it, it should be written as a ZERO_EXTEND. */ |