From: segher Date: Tue, 6 Jan 2015 04:29:03 +0000 (+0000) Subject: * simplify-rtx.c (simplify_binary_operation_1): Handle more cases X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e377fe09d910912527c6c53f37abd37e7319daf1;p=thirdparty%2Fgcc.git * simplify-rtx.c (simplify_binary_operation_1): Handle more cases for the "(and X (ior (not X) Y) -> (and X Y)" transform. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219217 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e85a9fdf0b19..12c2f939fe66 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-01-05 Segher Boessenkool + + * 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 * combine.c (combine_validate_cost): Do not count the cost of a diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 4c2ba4c5b941..56de54d9bcb8 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;