[llvm-bugs] [Bug 48768] New: Failure to optimize using flags from blsi
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 15 18:20:32 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=48768
Bug ID: 48768
Summary: Failure to optimize using flags from blsi
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
int f(unsigned long x)
{
return 0 >= (int)(-x & x);
}
With -O3 -mbmi, GCC emits this:
f(unsigned long):
xor eax, eax
blsi edi, edi
setle al
ret
LLVM emits this:
f(unsigned long): # @f(unsigned long)
blsi ecx, edi
xor eax, eax
test ecx, ecx
setle al
ret
The usage of the `test` instruction is useless as the flags from `blsi` can
directly be used.
See also Godbolt comparison here : https://godbolt.org/z/dqb18e
--
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/20210116/463cf05b/attachment.html>
More information about the llvm-bugs
mailing list