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

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 12 16:17:00 PDT 2016


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

            Bug ID: 28530
           Summary: [AArch64] recognize the shufflevector equivalent of a
                    vector select
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: AArch64
          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
}

I'm guessing that one of these is generally better than the other (and there
may be a better way than either of these?):

$ ./llc shufsel.ll -o - -mtriple=aarch64
    .LCPI0_0:
    .word    4294967295              // 0xffffffff
    .word    0                       // 0x0
    .word    0                       // 0x0
    .word    4294967295              // 0xffffffff
foo:
    adrp    x8, .LCPI0_0
    ldr    q2, [x8, :lo12:.LCPI0_0]
    bsl    v2.16b, v0.16b, v1.16b
    mov        v0.16b, v2.16b
    ret
goo:                                    // @goo
    ext    v1.16b, v0.16b, v1.16b, #12
    ext    v0.16b, v1.16b, v0.16b, #4
    ext    v1.16b, v1.16b, v1.16b, #8
    ext    v0.16b, v0.16b, v1.16b, #12
    ret

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

-- 
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/b9e284ef/attachment.html>


More information about the llvm-bugs mailing list