On 1/5/2022 1:12 PM, Navid Rahimi via Gcc-patches wrote:
Hi GCC community,
This patch will add the missed pattern described in bug 103514 [1] to the
match.pd. [1] includes proof of correctness for the patch too.
PR tree-optimization/103514
* match.pd (a & b) ^ (a == b) -> !(a | b):
00:00:54 -0800
Subject: [PATCH] tree-optimization/103514 Missing XOR-EQ-AND Optimization
* match.pd (a & b) ^ (a == b) -> !(a | b): New optimization.
* match.pd (a & b) == (a ^ b) -> !(a | b): New optimization.
* gcc.dg/tree-ssa/pr103514.c: Testcase for this opt
gcc.gnu.org
Cc: Navid Rahimi
Subject: [EXTERNAL] Re: [PATCH] tree-optimization/103514 Missing XOR-EQ-AND
Optimization
[You don't often get email from marc.gli...@inria.fr. Learn why this is
important at http://aka.ms/LearnAboutSenderIdentification.]
+/* (a & b) ^ (a == b) -> !(a | b) */
+/* (a &a
+/* (a & b) ^ (a == b) -> !(a | b) */
+/* (a & b) == (a ^ b) -> !(a | b) */
+(for first_op (bit_xor eq)
+ second_op (eq bit_xor)
+ (simplify
+ (first_op:c (bit_and:c @0 @1) (second_op:c @0 @1))
+ (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
+&& types_match (TREE_TYPE (@0), TREE_TYPE
) ^ (a == b) -> !(a | b): New optimization.
* gcc.dg/tree-ssa/pr102232.c: Testcase for this optimization.
1) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103514
Best wishes,
Navid.
0001-tree-optimization-103514-Missing-XOR-EQ-AND-Opt-v3.patch
Description: 0001-tree-optimization-103514-