[llvm-bugs] [Bug 41145] New: [Codegen] convert select+store to conditional stores or vice-versa?
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Mar 19 13:46:17 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41145
Bug ID: 41145
Summary: [Codegen] convert select+store to conditional stores
or vice-versa?
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvm-bugs at lists.llvm.org
This is a reduction of 1 part of the problem noted in the post-commit thread
for r355741 - [x86] scalarize extract element 0 of FP cmp:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190311/635516.html
In that case, we have IR with a select and repeated identical compare
conditions (courtesy of CGP), and we're generating the x86 SSE (no blendv)
bitwise select sequence for it, but before r355741 it was getting converted to
compare and branch.
We don't appear to do that transform consistently, so I'm not sure if we want
to blame that exact example on something else, but here's a generalization:
target triple = "x86_64-unknown-unknown"
define void @select_store(double %x, double %y, double %z, double %w, double*
%p) {
entry:
%cmp = fcmp ult double %x, %y
%sel = select i1 %cmp, double %z, double %w
store double %sel, double* %p
ret void
}
define void @branch_store(double %x, double %y, double %z, double %w, double*
%p) {
entry:
%cmp = fcmp ult double %x, %y
br i1 %cmp, label %t, label %f
t:
store double %z, double* %p
ret void
f:
store double %w, double* %p
ret void
}
-----------------------------------------------------------------------------
select_store:
cmpnlesd %xmm0, %xmm1
andpd %xmm1, %xmm2
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
movsd %xmm1, (%rdi)
retq
branch_store:
ucomisd %xmm1, %xmm0
jae .LBB1_2
# %bb.1: # %t
movsd %xmm2, (%rdi)
retq
.LBB1_2: # %f
movsd %xmm3, (%rdi)
retq
-----------------------------------------------------------------------------
Absent any profile info, we should be picking one form or the other?
Note: SimplifyCFG doesn't appear to do anything with these in IR either. There
are a bunch of debug options that would seem to apply, but I don't see any
differences using those.
--
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/20190319/39fe79d7/attachment.html>
More information about the llvm-bugs
mailing list