[llvm-bugs] [Bug 47305] New: Failure to optimize comparison of variable with same variable involved in bitwise or using andnot
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 25 05:17:44 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47305
Bug ID: 47305
Summary: Failure to optimize comparison of variable with same
variable involved in bitwise or using andnot
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: gabravier at gmail.com
CC: llvm-bugs at lists.llvm.org
bool f(int a, int b)
{
return a == (a | b);
}
With -mbmi, GCC outputs this:
f(int, int):
andn eax, edi, esi
sete al
ret
LLVM outputs this:
f(int, int):
or esi, edi
cmp esi, edi
sete al
ret
I have no idea whether there is an LLVM instruction that fits along with this
pattern (if not, I guess you could make a new one or else just change this to
an x86-specific issue) but this transformation seems useful.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200825/2085c3e3/attachment-0001.html>
More information about the llvm-bugs
mailing list