https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94880
Bug ID: 94880
Summary: Failure to recognize andn pattern
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
int f(int x, int y)
{
return (x | y) - y;
}
This can be optimized to a single andn :
f(int, int): # @f(int, int)
andn eax, esi, edi
ret
(LLVM output with -O3 -mbmi)
GCC currently outputs this :
f(int, int):
or edi, esi
mov eax, edi
sub eax, esi
ret