diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2015-11-16 16:51:33 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2015-11-16 16:51:33 +0100 |
commit | 7d006b0d3477fc9463edd970868107a5f98e5c57 (patch) | |
tree | 6c7dc8b0f682801f705190ef1105fa30834b1e89 /gcc | |
parent | 513ecaea6f71665e75458188d26432c627392cc0 (diff) | |
download | gcc-7d006b0d3477fc9463edd970868107a5f98e5c57.zip gcc-7d006b0d3477fc9463edd970868107a5f98e5c57.tar.gz gcc-7d006b0d3477fc9463edd970868107a5f98e5c57.tar.bz2 |
simplify-rtx: Simplify sign_extend of lshiftrt to zero_extend (PR68330)
Since r230164, in PR68330 combine ends up with a sign_extend of an
lshiftrt by some constant, and it does not know to morph that into a
zero_extract (the extend will always extend with zeroes). I think
it is best to let simplify-rtx always replace such a sign_extend by
a zero_extend, after which everything works as expected.
2015-11-15 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/68330
* simplify-rtx.c (simplify_unary_operation_1): Simplify SIGN_EXTEND
of LSHIFTRT by a non-zero constant integer.
From-SVN: r230429
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/simplify-rtx.c | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 020a00c..d318d58 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-11-16 Segher Boessenkool <segher@kernel.crashing.org> + + PR rtl-optimization/68330 + * simplify-rtx.c (simplify_unary_operation_1): Simplify SIGN_EXTEND + of LSHIFTRT by a non-zero constant integer. + 2015-11-16 Richard Biener <rguenther@suse.de> PR tree-optimization/68306 diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index c4fc42a..413d61b 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -1462,6 +1462,13 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) } } + /* (sign_extend:M (lshiftrt:N <X> (const_int I))) is better as + (zero_extend:M (lshiftrt:N <X> (const_int I))) if I is not 0. */ + if (GET_CODE (op) == LSHIFTRT + && CONST_INT_P (XEXP (op, 1)) + && XEXP (op, 1) != const0_rtx) + return simplify_gen_unary (ZERO_EXTEND, mode, op, GET_MODE (op)); + #if defined(POINTERS_EXTEND_UNSIGNED) /* As we do not know which address space the pointer is referring to, we can do this only if the target does not support different pointer |