[LLVMbugs] [Bug 22283] New: suboptimal AVX splat

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 21 10:55:21 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22283

            Bug ID: 22283
           Summary: suboptimal AVX splat
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This is a follow-on to bug 22276, although this may be an independent bug.

In the case of a splat of a variable (such as the induction variable in a
vectorized loop), we may not be generating the optimal splat at least for an
AVX1 machine:

define <4 x i64> @splat(i64 %x) {
  %scalar_to_vector = insertelement <4 x i64> undef, i64 %x, i32 0
  %splat = shufflevector <4 x i64> %scalar_to_vector, <4 x i64> undef, <4 x
i32> zeroinitializer
  ret <4 x i64> %splat
}


$ ./llc -mcpu=btver2 zero_vector.ll -o -
...
    vmovq    %rdi, %xmm0
    vunpcklpd    %xmm0, %xmm0, %xmm0 ## xmm0 = xmm0[0,0]
    vinsertf128    $1, %xmm0, %ymm0, %ymm0
    retq


I would expect this to match what we're currently generating for AVX2:
$ ./llc -mcpu=haswell zero_vector.ll -o -
...
    vmovq    %rdi, %xmm0
    vbroadcastsd    %xmm0, %ymm0
    retq


If the splatted integer value is actually used in this function, then that
should be a 'vpbroadcastq' with AVX2 rather than an FP instruction.

-- 
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/20150121/593ccedb/attachment.html>


More information about the llvm-bugs mailing list