[LLVMbugs] [Bug 22415] New: Vector shuffle punpck+pshufb+punpck+pshufb should be just a single pshufb

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 30 13:37:54 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22415

            Bug ID: 22415
           Summary: Vector shuffle punpck+pshufb+punpck+pshufb should be
                    just a single pshufb
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: grosbach at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13786
  --> http://llvm.org/bugs/attachment.cgi?id=13786&action=edit
Test case.

#include <simd/simd.h>                                                          

vector_char4 bar(vector_short4 x) { return ((vector_char8)x).even; }            
vector_char3 baz(vector_short3 x) { return bar(x.xyzz).xyz; }

Generates the shuffle sequence for baz() as:
    punpcklwd    %xmm0, %xmm0    ## xmm0 = xmm0[0,0,1,1,2,2,3,3]
    pshufb    LCPI1_0(%rip), %xmm0    ## xmm0 =
xmm0[0,1,4,5,8,9,8,9,8,9,8,9,8,9,10,11]
    movd    %xmm0, %rax
    movd    %rax, %xmm0
    punpcklbw    %xmm0, %xmm0    ## xmm0 =
xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
    pshufb    LCPI1_1(%rip), %xmm0    ## xmm0 =
xmm0[0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u]

The operation can be done instead in a single pshufb.

IR attached.

-- 
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/20150130/3bb65ad6/attachment.html>


More information about the llvm-bugs mailing list