https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45434
--- Comment #9 from Uroš Bizjak ---
The current mainline compiles:
--cut here--
_Bool foo(int i)
{
return (i & 0xFF) == ((i & 0xFF00) >> 8);
}
_Bool bar(int i)
{
return (i & 0xFF) <= ((i & 0xFF00) >> 8);
}
--cut here--
with -O2 to:
foo:
movl%edi, %eax
sarl$8, %eax
xorl%edi, %eax
testb %al, %al
sete%al
ret
bar:
movl%edi, %eax
cmpb%al, %ah
setnb %al
ret
While ._original dump reads:
;; Function foo (null)
{
return ((i >> 8 ^ i) & 255) == 0;
}
;; Function bar (null)
{
return (i & 255) <= (i >> 8 & 255);
}
The test for equivalence goes through XOR which interferes with the ability of
the combine pass to form the compare with zero-extracted argument RTX.