[llvm-bugs] [Bug 40500] New: [x86] try harder to shuffle lower to vpermi2pd

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 28 10:17:31 PST 2019


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

            Bug ID: 40500
           Summary: [x86] try harder to shuffle lower to vpermi2pd
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

Filing this based on a regression seen in the proposed D57336:
https://reviews.llvm.org/D57336

This example is based on
"test/CodeGen/X86/avx512-shuffles/partial_permute.ll::test_8xdouble_to_4xdouble_perm_mask3()"

define <4 x double> @extract_splat(<8 x double> %x) {
  %x0123 = shufflevector <8 x double> %x, <8 x double> undef, <4 x i32> <i32 0,
i32 1, i32 2, i32 3>
  %x4567 = shufflevector <8 x double> %x, <8 x double> undef, <4 x i32> <i32 4,
i32 5, i32 6, i32 7>
  %x45 = shufflevector <4 x double> %x4567, <4 x double> undef, <2 x i32> <i32
0, i32 1>
  %x4444 = shufflevector <2 x double> %x45, <2 x double> undef, <4 x i32> <i32
0, i32 0, i32 0, i32 0>
  %x0214 = shufflevector <4 x double> %x0123, <4 x double> %x4444, <4 x i32>
<i32 0, i32 2, i32 1, i32 4>
  ret <4 x double> %x0214
}

$ llc -o - extractsplat.ll -mattr=avx512f
        vextractf64x4   $1, %zmm0, %ymm1
        vpermpd $216, %ymm0, %ymm0      # ymm0 = ymm0[0,2,1,3]
        vbroadcastsd    %xmm1, %ymm1
        vblendps        $192, %ymm1, %ymm0, %ymm0 # ymm0 =
ymm0[0,1,2,3,4,5],ymm1[6,7]
        retq

If I got the shuffles right, that's the same as:
vextractf64x4 $1, %zmm0, %ymm2
vmovapd {{.*#+}} ymm1 = [0,2,1,4]
vpermi2pd %ymm2, %ymm0, %ymm1
vmovapd %ymm1, %ymm0


So the more general "vpermi2pd" with constant-loaded permute op can be used to
replace the permpd+broadcast+blend.

-- 
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/20190128/3aff4254/attachment.html>


More information about the llvm-bugs mailing list