https://llvm.org/bugs/show_bug.cgi?id=23027

            Bug ID: 23027
           Summary: [X86][AVX] suboptimal splats of high elements of
                    256-bit vectors
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

AVX shuffling of 256-bit vectors isn't supported very well in hardware. It
looks like real instructions for this don't show up until AVX2.

But I think we can do better than this by using vpermild + vperm2f128:

define <4 x double> @shuffle_splat_v4f64_3(<4 x double> %v) {
  %z = shufflevector <4 x double> %v, <4 x double> undef, <4 x i32> <i32 3, i32
3, i32 3, i32 3>
  ret <4 x double> %z
}

$ ./llc -o - -mattr=avx splat256.ll 
...
    vextractf128    $1, %ymm0, %xmm0
    vmovhlps    %xmm0, %xmm0, %xmm0 ## xmm0 = xmm0[1,1]
    vinsertf128    $1, %xmm0, %ymm0, %ymm0
    retq

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to