aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-01-23 07:00:29 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-01-23 07:00:29 -0500
commitad25ba1779f5e1a0e2a640e12dda3f6c7a53a163 (patch)
treec80f3964fca696ddf817b152ee5f48f23cc293d7 /gcc
parent2f607b946a7052254062f863a36ba1e7b6de80d1 (diff)
downloadgcc-ad25ba1779f5e1a0e2a640e12dda3f6c7a53a163.zip
gcc-ad25ba1779f5e1a0e2a640e12dda3f6c7a53a163.tar.gz
gcc-ad25ba1779f5e1a0e2a640e12dda3f6c7a53a163.tar.bz2
(simplify_comparison): Can remove NOT on both operands if we swap
comparison code. From-SVN: r6410
Diffstat (limited to 'gcc')
-rw-r--r--gcc/combine.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index d699367..1737e6e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -8429,7 +8429,7 @@ simplify_comparison (code, pop0, pop1)
&& GET_CODE (XEXP (XEXP (op0, 0), 0)) == SUBREG
&& GET_CODE (XEXP (XEXP (op1, 0), 0)) == SUBREG
&& (GET_MODE (SUBREG_REG (XEXP (XEXP (op0, 0), 0)))
- == GET_MODE (SUBREG_REG (XEXP (XEXP (op0, 0), 0))))
+ == GET_MODE (SUBREG_REG (XEXP (XEXP (op1, 0), 0))))
&& GET_CODE (XEXP (op0, 1)) == CONST_INT
&& GET_CODE (XEXP (op1, 1)) == CONST_INT
&& GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT
@@ -8517,12 +8517,13 @@ simplify_comparison (code, pop0, pop1)
code = unsigned_condition (code);
}
- /* If both operands are NOT or both are NEG, we can strip off the
- outer operation if this is just an equality comparison. */
- else if ((code == EQ || code == NE)
- && ((GET_CODE (op0) == NOT && GET_CODE (op1) == NOT)
- || (GET_CODE (op0) == NEG && GET_CODE (op1) == NEG)))
- op0 = XEXP (op0, 0), op1 = XEXP (op1, 0);
+ /* If both operands are NOT, we can strip off the outer operation
+ and adjust the comparison code for swapped operands; similarly for
+ NEG, except that this must be an equality comparison. */
+ else if ((GET_CODE (op0) == NOT && GET_CODE (op1) == NOT)
+ || (GET_CODE (op0) == NEG && GET_CODE (op1) == NEG
+ && (code == EQ || code == NE)))
+ op0 = XEXP (op0, 0), op1 = XEXP (op1, 0), code = swap_condition (code);
else
break;