diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-25 22:29:48 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-25 22:29:48 +0000 |
commit | c11ee82609faee40620ebe18ae6b627060effab7 (patch) | |
tree | 3639946e27528ed722acbb12268a53cb71913145 /gcc/simplify-rtx.c | |
parent | 47da8b49c58ee20fa06791b9ca20965339301a87 (diff) | |
download | gcc-c11ee82609faee40620ebe18ae6b627060effab7.tar.gz |
* simplify-rtx.c (simplify_relational_operation_1): Simplify
(X^Y) == 0 as X == Y and (X^Y) != 0 as X != Y. Simplify (X^Y) == Y
as X == 0, and some symmetry related transformations.
Simplify (X^C1) == C2 as X == (C1^C2). Split long comment line.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111443 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 8b1f6fd1b95..e84beda68b4 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -3512,7 +3512,8 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode, { if (INTVAL (op1) == 0 && COMPARISON_P (op0)) { - /* If op0 is a comparison, extract the comparison arguments form it. */ + /* If op0 is a comparison, extract the comparison arguments + from it. */ if (code == NE) { if (GET_MODE (op0) == mode) @@ -3561,6 +3562,37 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode, ? simplify_gen_unary (ZERO_EXTEND, mode, op0, cmp_mode) : lowpart_subreg (mode, op0, cmp_mode); + /* (eq/ne (xor x y) 0) simplifies to (eq/ne x y). */ + if ((code == EQ || code == NE) + && op1 == const0_rtx + && op0code == XOR) + return simplify_gen_relational (code, mode, cmp_mode, + XEXP (op0, 0), XEXP (op0, 1)); + + /* (eq/ne (xor x y) x) simplifies to (eq/ne x 0). */ + if ((code == EQ || code == NE) + && op0code == XOR + && rtx_equal_p (XEXP (op0, 0), op1) + && !side_effects_p (XEXP (op0, 1))) + return simplify_gen_relational (code, mode, cmp_mode, op1, const0_rtx); + /* Likewise (eq/ne (xor x y) y) simplifies to (eq/ne y 0). */ + if ((code == EQ || code == NE) + && op0code == XOR + && rtx_equal_p (XEXP (op0, 1), op1) + && !side_effects_p (XEXP (op0, 0))) + return simplify_gen_relational (code, mode, cmp_mode, op1, const0_rtx); + + /* (eq/ne (xor x C1) C2) simplifies to (eq/ne x (C1^C2)). */ + if ((code == EQ || code == NE) + && op0code == XOR + && (GET_CODE (op1) == CONST_INT + || GET_CODE (op1) == CONST_DOUBLE) + && (GET_CODE (XEXP (op0, 1)) == CONST_INT + || GET_CODE (XEXP (op0, 1)) == CONST_DOUBLE)) + return simplify_gen_relational (code, mode, cmp_mode, XEXP (op0, 0), + simplify_gen_binary (XOR, cmp_mode, + XEXP (op0, 1), op1)); + return NULL_RTX; } |