aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1999-09-02 09:02:33 +0000
committerJeff Law <law@gcc.gnu.org>1999-09-02 03:02:33 -0600
commite6380233ffeef512f5db01c0543a37e68c61cb90 (patch)
tree0785d8c746f37a1f8ab7349ae33e718925c05cd1 /gcc/combine.c
parent08e105064ff2af90818c04eeeeef5de9203733a8 (diff)
downloadgcc-e6380233ffeef512f5db01c0543a37e68c61cb90.zip
gcc-e6380233ffeef512f5db01c0543a37e68c61cb90.tar.gz
gcc-e6380233ffeef512f5db01c0543a37e68c61cb90.tar.bz2
combine.c (simplify_rtx): Recognize another case of a synthesized sign extension.
* combine.c (simplify_rtx): Recognize another case of a synthesized sign extension. From-SVN: r29055
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 6886ba7..01703ba 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3913,12 +3913,14 @@ simplify_rtx (x, op0_mode, last, in_dest)
/* (plus (xor (and <foo> (const_int pow2 - 1)) <c>) <-c>)
when c is (const_int (pow2 + 1) / 2) is a sign extension of a
bit-field and can be replaced by either a sign_extend or a
- sign_extract. The `and' may be a zero_extend. */
+ sign_extract. The `and' may be a zero_extend and the two
+ <c>, -<c> constants may be reversed. */
if (GET_CODE (XEXP (x, 0)) == XOR
&& GET_CODE (XEXP (x, 1)) == CONST_INT
&& GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
&& INTVAL (XEXP (x, 1)) == - INTVAL (XEXP (XEXP (x, 0), 1))
- && (i = exact_log2 (INTVAL (XEXP (XEXP (x, 0), 1)))) >= 0
+ && ((i = exact_log2 (INTVAL (XEXP (XEXP (x, 0), 1)))) >= 0
+ || (i = exact_log2 (INTVAL (XEXP (x, 1)))) >= 0)
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
&& ((GET_CODE (XEXP (XEXP (x, 0), 0)) == AND
&& GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == CONST_INT