[llvm-bugs] [Bug 50939] New: [VectorCombine] Combining permute+blend with zero into a two-source permute

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 30 04:09:04 PDT 2021


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

            Bug ID: 50939
           Summary: [VectorCombine] Combining permute+blend with zero into
                    a two-source permute
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org

Not sure how useful this would be, but we could do the following:
https://godbolt.org/z/qnc87j9dd

define <4 x i32> @src(<4 x i32> %x) local_unnamed_addr #0 {
    %permil = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> <i32
undef, i32 0, i32 undef, i32 undef>
    %blend = shufflevector <4 x i32> <i32 0, i32 poison, i32 0, i32 0>, <4 x
i32> %permil, <4 x i32> <i32 0, i32 5, i32 2, i32 3>
    ret <4 x i32> %blend
}
define <4 x i32> @tgt(<4 x i32> %x) local_unnamed_addr #0 {
    %shuf = shufflevector <4 x i32> %x, <4 x i32> zeroinitializer, <4 x i32>
<i32 4, i32 0, i32 5, i32 6>
    ret <4 x i32> %shuf
}

Iff SK_PermuteTwoSrc is not costlier than SK_PermuteSingleSrc+SK_Select.

Though, for non-zero second source, looks like we fail to drop unneeded
vpermilps:
https://godbolt.org/z/3qhzEM933

-- 
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/20210630/27abc7fd/attachment.html>


More information about the llvm-bugs mailing list