[llvm-bugs] [Bug 32866] New: [x86] failed to select vblendv with casted vector ops

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 1 09:15:18 PDT 2017


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

            Bug ID: 32866
           Summary: [x86] failed to select vblendv with casted vector ops
           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: llvm-bugs at lists.llvm.org

Forking this off from bug 14657.

This test exists in test/CodeGen/X86/cast-vsel.ll:

define <8 x i16> @trunc(<8 x i16> %a, <8 x i16> %b, <8 x i32> %c, <8 x i32> %d)
{
  %cmp = icmp eq <8 x i16> %a, %b
  %sel = select <8 x i1> %cmp, <8 x i32> %c, <8 x i32> %d
  %tr = trunc <8 x i32> %sel to <8 x i16>
  ret <8 x i16> %tr
}

After https://reviews.llvm.org/rL301781 , this is effectively:

define <8 x i16> @trunc_first(<8 x i16> %a, <8 x i16> %b, <8 x i32> %c, <8 x
i32> %d) {
  %cmp = icmp eq <8 x i16> %a, %b
  %ctr = trunc <8 x i32> %c to <8 x i16>
  %dtr = trunc <8 x i32> %d to <8 x i16>
  %sel = select <8 x i1> %cmp, <8 x i16> %ctr, <8 x i16> %dtr
  ret <8 x i16> %sel
}

For both AVX1 and AVX2, we fail to use vblendv in either case (avx2 shown
here):

_trunc_first:                           ## @trunc_first
        .cfi_startproc
## BB#0:
        vpcmpeqw        %xmm1, %xmm0, %xmm0
        vmovdqa LCPI1_0(%rip), %ymm1    ## ymm1 =
[0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15,16,17,20,21,24,25,28,29,24,25,28,29,28,29,30,31]
        vpshufb %ymm1, %ymm2, %ymm2
        vpermq  $232, %ymm2, %ymm2      ## ymm2 = ymm2[0,2,2,3]
        vpshufb %ymm1, %ymm3, %ymm1
        vpermq  $232, %ymm1, %ymm1      ## ymm1 = ymm1[0,2,2,3]
        vpandn  %xmm1, %xmm0, %xmm1
        vpand   %xmm0, %xmm2, %xmm0
        vpor    %xmm1, %xmm0, %xmm0
        vzeroupper

-- 
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/20170501/b9a044a2/attachment-0001.html>


More information about the llvm-bugs mailing list