On 3/2/2026 12:45 PM, Daniel Henrique Barboza wrote:
From: Daniel Barboza <[email protected]>
Also adding the variant "(A>>C) == (B>>C) -> (A^B) < (1<<C)"
Bootstrapped and regression tested on x86.
PR tree-optimization/110010
gcc/ChangeLog:
* match.pd (`(A>>C) NE|EQ (B>>C) -> (A^B) GE|LT (1<<C)`): New
pattern.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr110010.c: New test.
I think you need to verify that "A" and "B" are unsigned types. In
gimple a right shift's semantics are influenced by the type of the
argument. A signed argument has arithmetic shift semantics while and
unsigned argument has logical shift semantics.
You might consider a second test, perhaps an execution test which
triggers that problem.
WIth those changes I think this will be fine for gcc-17.
jeff