[llvm-bugs] [Bug 42755] New: [SLPVectorizer] Failure to use vectorize integer minimum loop

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 25 07:55:05 PDT 2019


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

            Bug ID: 42755
           Summary: [SLPVectorizer] Failure to use vectorize integer
                    minimum loop
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: llvm-bugs at lists.llvm.org

Current codegen: https://gcc.godbolt.org/z/smAJKe

#include <x86intrin.h>

auto minmaxi(__v4si x, __v4si min) {
    for (int i = 0; i != 4; ++i)
      if (x[i] < min[i])
        min[i] = x[i];
    return min;
}


_Z7minmaxiDv4_iS_:
        vmovd   %xmm0, %eax
        vmovd   %xmm1, %ecx
        cmpl    %ecx, %eax
        jl      .LBB0_1
        vpextrd $1, %xmm0, %eax
        vpextrd $1, %xmm1, %ecx
        cmpl    %ecx, %eax
        jl      .LBB0_3
.LBB0_4:
        vpextrd $2, %xmm0, %eax
        vpextrd $2, %xmm1, %ecx
        cmpl    %ecx, %eax
        jl      .LBB0_5
.LBB0_6:
        vpextrd $3, %xmm0, %eax
        vpextrd $3, %xmm1, %ecx
        cmpl    %ecx, %eax
        jl      .LBB0_7
.LBB0_8:
        vmovdqa %xmm1, %xmm0
        retq
.LBB0_1:
        vpblendw        $3, %xmm0, %xmm1, %xmm1 # xmm1 =
xmm0[0,1],xmm1[2,3,4,5,6,7]
        vpextrd $1, %xmm0, %eax
        vpextrd $1, %xmm1, %ecx
        cmpl    %ecx, %eax
        jge     .LBB0_4
.LBB0_3:
        vpblendw        $12, %xmm0, %xmm1, %xmm1 # xmm1 =
xmm1[0,1],xmm0[2,3],xmm1[4,5,6,7]
        vpextrd $2, %xmm0, %eax
        vpextrd $2, %xmm1, %ecx
        cmpl    %ecx, %eax
        jge     .LBB0_6
.LBB0_5:
        vpblendw        $48, %xmm0, %xmm1, %xmm1 # xmm1 =
xmm1[0,1,2,3],xmm0[4,5],xmm1[6,7]
        vpextrd $3, %xmm0, %eax
        vpextrd $3, %xmm1, %ecx
        cmpl    %ecx, %eax
        jge     .LBB0_8
.LBB0_7:
        vpblendw        $192, %xmm0, %xmm1, %xmm1 # xmm1 =
xmm1[0,1,2,3,4,5],xmm0[6,7]
        vmovdqa %xmm1, %xmm0
        retq

-- 
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/20190725/f2c420a2/attachment-0001.html>


More information about the llvm-bugs mailing list