[llvm-bugs] [Bug 28531] New: [PPC] recognize the shufflevector equivalent of a vector select

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 12 16:26:28 PDT 2016


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

            Bug ID: 28531
           Summary: [PPC] recognize the shufflevector equivalent of a
                    vector select
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ cat shufsel.ll 
define <4 x i32> @foo(<4 x i32> %a, <4 x i32> %b) {
  %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i32> %a,
<4 x i32> %b
  ret <4 x i32> %sel
}

define <4 x i32> @goo(<4 x i32> %a, <4 x i32> %b) {
  %shuf = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 5,
i32 6, i32 3>
  ret <4 x i32> %shuf
}

These are functionally equivalent. Note that in http://reviews.llvm.org/D22114
, there's a proposal to canonicalize to the shufflevector form of the IR.

We generate 'xxsel' and 'vperm' for a target with VSX. Is one better than the
other?

For an altivec target, the lowering to vsel is missed:

$ ./llc shufsel.ll -o - -mtriple=powerpc64 -mattr=altivec
foo:                                    # @foo    
    addis 3, 2, .LCPI0_0 at toc@ha
    addis 4, 2, .LCPI0_1 at toc@ha
    addi 3, 3, .LCPI0_0 at toc@l
    addi 4, 4, .LCPI0_1 at toc@l
    lvx 4, 0, 3
    lvx 5, 0, 4
    vand 3, 3, 4
    vand 2, 2, 5
    vor 2, 2, 3
    blr

-- 
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/20160712/5fcd7c00/attachment-0001.html>


More information about the llvm-bugs mailing list