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

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:

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) {
  %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) {
  %cmp = fcmp ult double %x, %y
  br i1 %cmp, label %t, label %f

  store double %z, double* %p
  ret void

  store double %w, double* %p
  ret void


        cmpnlesd        %xmm0, %xmm1
        andpd   %xmm1, %xmm2
        andnpd  %xmm3, %xmm1
        orpd    %xmm2, %xmm1
        movsd   %xmm1, (%rdi)

        ucomisd %xmm1, %xmm0
        jae     .LBB1_2
# %bb.1:                                # %t
        movsd   %xmm2, (%rdi)
.LBB1_2:                                # %f
        movsd   %xmm3, (%rdi)


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.
llvm-bugs mailing list

Reply via email to