diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2015-01-06 05:29:03 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2015-01-06 05:29:03 +0100 |
commit | 31dd2a8669278673c731a23ea8f5564ded39c258 (patch) | |
tree | 2d0db45778dedaebdb013ed23d854fb070f4daae /gcc | |
parent | 2f48c66c9deb7c5f008c8c6152aee28d18d4126a (diff) | |
download | gcc-31dd2a8669278673c731a23ea8f5564ded39c258.zip gcc-31dd2a8669278673c731a23ea8f5564ded39c258.tar.gz gcc-31dd2a8669278673c731a23ea8f5564ded39c258.tar.bz2 |
simplify-rtx.c (simplify_binary_operation_1): Handle more cases for the "(and X (ior (not X) Y) -> (and X Y)" transform.
* simplify-rtx.c (simplify_binary_operation_1): Handle more cases
for the "(and X (ior (not X) Y) -> (and X Y)" transform.
From-SVN: r219217
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/simplify-rtx.c | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e85a9fd..12c2f93 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2015-01-05 Segher Boessenkool <segher@kernel.crashing.org> + * simplify-rtx.c (simplify_binary_operation_1): Handle more cases + for the "(and X (ior (not X) Y) -> (and X Y)" transform. + +2015-01-05 Segher Boessenkool <segher@kernel.crashing.org> + * combine.c (combine_validate_cost): Do not count the cost of a split I2 twice. Do not display it twice in the dump, either. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 4c2ba4c..56de54d 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2933,15 +2933,27 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode, /* (and X (ior (not X) Y) -> (and X Y) */ if (GET_CODE (op1) == IOR && GET_CODE (XEXP (op1, 0)) == NOT - && op0 == XEXP (XEXP (op1, 0), 0)) + && rtx_equal_p (op0, XEXP (XEXP (op1, 0), 0))) return simplify_gen_binary (AND, mode, op0, XEXP (op1, 1)); /* (and (ior (not X) Y) X) -> (and X Y) */ if (GET_CODE (op0) == IOR && GET_CODE (XEXP (op0, 0)) == NOT - && op1 == XEXP (XEXP (op0, 0), 0)) + && rtx_equal_p (op1, XEXP (XEXP (op0, 0), 0))) return simplify_gen_binary (AND, mode, op1, XEXP (op0, 1)); + /* (and X (ior Y (not X)) -> (and X Y) */ + if (GET_CODE (op1) == IOR + && GET_CODE (XEXP (op1, 1)) == NOT + && rtx_equal_p (op0, XEXP (XEXP (op1, 1), 0))) + return simplify_gen_binary (AND, mode, op0, XEXP (op1, 0)); + + /* (and (ior Y (not X)) X) -> (and X Y) */ + if (GET_CODE (op0) == IOR + && GET_CODE (XEXP (op0, 1)) == NOT + && rtx_equal_p (op1, XEXP (XEXP (op0, 1), 0))) + return simplify_gen_binary (AND, mode, op1, XEXP (op0, 0)); + tem = simplify_byte_swapping_operation (code, mode, op0, op1); if (tem) return tem; |