summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-15 04:50:09 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-15 04:50:09 +0000
commit0e1e143e7727845141bf440a9ec2969f611accfb (patch)
tree6884eb392c55198115c06f8cb78b15c8588568a1 /gcc/combine.c
parent7546642c0a93d93246a02771866aac666609a6e3 (diff)
downloadgcc-0e1e143e7727845141bf440a9ec2969f611accfb.tar.gz
* fold-const.c (fold): Move bit_rotate code to the EXPR_PLUS case,
falltrought to assocate code. Convert XOR to OR in code like (a&c1)^(a&c2) where c1 and c2 don't have bits in common. * combine.c (simplify_logical): Convert XOR to IOR if operands have no bits in common; remove XOR to ROTATE conversion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29998 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index a7b9c0c6d4a..7273e8f237e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5163,6 +5163,15 @@ simplify_logical (x, last)
break;
case XOR:
+ /* If we are XORing two things that have no bits in common,
+ convert them into an IOR. This helps to detect rotation encoded
+ using those methods and possibly other simplifications. */
+
+ if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
+ && (nonzero_bits (op0, mode)
+ & nonzero_bits (op1, mode)) == 0)
+ return (gen_binary (IOR, mode, op0, op1));
+
/* Convert (XOR (NOT x) (NOT y)) to (XOR x y).
Also convert (XOR (NOT x) y) to (NOT (XOR x y)), similarly for
(NOT y). */
@@ -5232,20 +5241,6 @@ simplify_logical (x, last)
return gen_rtx_combine (reverse_condition (GET_CODE (op0)),
mode, XEXP (op0, 0), XEXP (op0, 1));
- /* Convert (xor (ashift A CX) (lshiftrt A CY)) where CX+CY equals the
- mode size to (rotate A CX). */
-
- if (((GET_CODE (op0) == ASHIFT && GET_CODE (op1) == LSHIFTRT)
- || (GET_CODE (op1) == ASHIFT && GET_CODE (op0) == LSHIFTRT))
- && rtx_equal_p (XEXP (op0, 0), XEXP (op1, 0))
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && GET_CODE (XEXP (op1, 1)) == CONST_INT
- && (INTVAL (XEXP (op0, 1)) + INTVAL (XEXP (op1, 1))
- == GET_MODE_BITSIZE (mode)))
- return gen_rtx_ROTATE (mode, XEXP (op0, 0),
- (GET_CODE (op0) == ASHIFT
- ? XEXP (op0, 1) : XEXP (op1, 1)));
-
break;
default: