[llvm-bugs] [Bug 51745] New: LLVM 13 regression: lost transformation x < C && y < C && z < C to (x | y | z) < C
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Sep 4 02:30:24 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51745
Bug ID: 51745
Summary: LLVM 13 regression: lost transformation x < C && y < C
&& z < C to (x | y | z) < C
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
x < C && y < C && z < C to (x | y | z) < C where C is power of two.
bool
src1 (unsigned x, unsigned y, unsigned z, unsigned w)
{
return x < 1024 && y < 1024 && z < 1024 && w < 1024;
}
bool
tgt1 (unsigned x, unsigned y, unsigned z, unsigned w)
{
return (x | y | z | w) < 1024;
}
GCC:
src1(unsigned int, unsigned int, unsigned int, unsigned int):
or edx, ecx
or edx, esi
or edx, edi
cmp edx, 1023
setbe al
ret
tgt1(unsigned int, unsigned int, unsigned int, unsigned int):
or edx, ecx
or edx, esi
or edx, edi
cmp edx, 1023
setbe al
ret
Clang trunk:
src1(unsigned int, unsigned int, unsigned int, unsigned int):
# @src1(unsigned int, unsigned int, unsigned int, unsigned int)
cmp edi, 1024
setb al
cmp esi, 1024
setb sil
and sil, al
cmp edx, 1024
setb dl
cmp ecx, 1024
setb al
and al, dl
and al, sil
ret
tgt1(unsigned int, unsigned int, unsigned int, unsigned int):
# @tgt1(unsigned int, unsigned int, unsigned int, unsigned int)
or edi, esi
or edx, ecx
or edx, edi
cmp edx, 1024
setb al
ret
Regressed with LLVM 13 which disabled select-to-or optimization.
--
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/20210904/3b17f224/attachment.html>
More information about the llvm-bugs
mailing list