This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Handle LSHIFTRT in try_widen_shift_mode
- From: Adam Nemet <anemet at caviumnetworks dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 9 Jul 2009 23:53:16 -0700
- Subject: [PATCH] Handle LSHIFTRT in try_widen_shift_mode
This adds the LSHIFTRT counterpart of the ASHIFTRT changes from my previous
patch:
http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00406.html
The assembly change on gcc.c-torture/execute for MIPS is:
7 files changed, 187 insertions(+), 324 deletions(-)
and for x86_64:
6 files changed, 13 insertions(+), 21 deletions(-)
Boostrapped and regtested on {mips64octeon,x86_64}-linux. Also regtested on
mipsisa64r2-elf.
OK after the previous patch?
Adam
* combine.c (try_widen_shift_mode) <LSHIFTRT>: Allow widening if the
high-order bits are zero.
Index: gcc/combine.c
===================================================================
--- gcc.orig/combine.c 2009-07-07 15:13:18.000000000 -0700
+++ gcc/combine.c 2009-07-07 15:16:34.000000000 -0700
@@ -9005,8 +9005,15 @@ try_widen_shift_mode (enum rtx_code code
> (unsigned) (GET_MODE_BITSIZE (mode)
- GET_MODE_BITSIZE (orig_mode)))
return mode;
- /* fall through */
+ return orig_mode;
+
case LSHIFTRT:
+ /* Similarly here but with zero bits. */
+ if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
+ && (nonzero_bits (op, mode) & ~GET_MODE_MASK (orig_mode)) == 0)
+ return mode;
+ /* fall through */
+
case ROTATE:
return orig_mode;