aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorUros Bizjak <uros@gcc.gnu.org>2012-10-01 17:00:41 +0200
committerUros Bizjak <uros@gcc.gnu.org>2012-10-01 17:00:41 +0200
commit992103ad6991bfbd908d10b18b3fba28196ff7a8 (patch)
treecc5f6d3ec972893a489639fb23536628899e340c /gcc/simplify-rtx.c
parent4f39564266a2c44145e02cda4effd42a33cf66e9 (diff)
downloadgcc-992103ad6991bfbd908d10b18b3fba28196ff7a8.zip
gcc-992103ad6991bfbd908d10b18b3fba28196ff7a8.tar.gz
gcc-992103ad6991bfbd908d10b18b3fba28196ff7a8.tar.bz2
re PR rtl-optimization/54457 ([x32] Fail to combine 64bit index + constant)
PR rtl-optimization/54457 * simplify-rtx.c (simplify_subreg): Simplify (subreg:M (op:N ((x:N) (y:N)), 0) to (op:M (subreg:M (x:N) 0) (subreg:M (x:N) 0)), where the outer subreg is effectively a truncation to the original mode M. testsuite/ChangeLog: PR rtl-optimization/54457 * gcc.target/i386/pr54457.c: New test. From-SVN: r191928
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index aebe6bb..c3e8a0a 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -5724,6 +5724,28 @@ simplify_subreg (enum machine_mode outermode, rtx op,
return CONST0_RTX (outermode);
}
+ /* Simplify (subreg:SI (op:DI ((x:DI) (y:DI)), 0)
+ to (op:SI (subreg:SI (x:DI) 0) (subreg:SI (x:DI) 0)), where
+ the outer subreg is effectively a truncation to the original mode. */
+ if ((GET_CODE (op) == PLUS
+ || GET_CODE (op) == MINUS
+ || GET_CODE (op) == MULT)
+ && SCALAR_INT_MODE_P (outermode)
+ && SCALAR_INT_MODE_P (innermode)
+ && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode)
+ && byte == subreg_lowpart_offset (outermode, innermode))
+ {
+ rtx op0 = simplify_gen_subreg (outermode, XEXP (op, 0),
+ innermode, byte);
+ if (op0)
+ {
+ rtx op1 = simplify_gen_subreg (outermode, XEXP (op, 1),
+ innermode, byte);
+ if (op1)
+ return simplify_gen_binary (GET_CODE (op), outermode, op0, op1);
+ }
+ }
+
/* Simplify (subreg:QI (lshiftrt:SI (sign_extend:SI (x:QI)) C), 0) into
to (ashiftrt:QI (x:QI) C), where C is a suitable small constant and
the outer subreg is effectively a truncation to the original mode. */