[llvm-bugs] [Bug 28160] hoist/sink vector cast ops to avoid illegal types?

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 29 06:49:24 PDT 2018


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

Sanjay Patel <spatel+llvm at rotateright.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Fixed By Commit(s)|                            |r301781
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #7 from Sanjay Patel <spatel+llvm at rotateright.com> ---
We try to match vector select operand sizes with vector compares operand sizes
with:
https://reviews.llvm.org/rL301781

There were several other improvements in shuffle combining/lowering that also
helped.

That means we have better codegen in all cases on x86 independent of what we do
in IR for this kind of pattern:

$   ./llc -o - 28160opt.ll 
        cmpltps %xmm1, %xmm0
        shufps  $136, %xmm5, %xmm4      ## xmm4 = xmm4[0,2],xmm5[0,2]
        shufps  $136, %xmm3, %xmm2      ## xmm2 = xmm2[0,2],xmm3[0,2]
        andps   %xmm0, %xmm2
        andnps  %xmm4, %xmm0
        orps    %xmm2, %xmm0
        retq

$   ./llc -o - 28160opt.ll -mattr=avx
        vcmpltps        %xmm1, %xmm0, %xmm0
        vextractf128    $1, %ymm2, %xmm1
        vshufps $136, %xmm1, %xmm2, %xmm1 ## xmm1 = xmm2[0,2],xmm1[0,2]
        vextractf128    $1, %ymm3, %xmm2
        vshufps $136, %xmm2, %xmm3, %xmm2 ## xmm2 = xmm3[0,2],xmm2[0,2]
        vblendvps       %xmm0, %xmm1, %xmm2, %xmm0
        vzeroupper
        retq

$   ./llc -o - 28160opt.ll -mattr=avx2
        vcmpltps        %xmm1, %xmm0, %xmm0
        vpermilps       $232, %ymm2, %ymm1 ## ymm1 = ymm2[0,2,2,3,4,6,6,7]
        vpermpd $232, %ymm1, %ymm1      ## ymm1 = ymm1[0,2,2,3]
        vpermilps       $232, %ymm3, %ymm2 ## ymm2 = ymm3[0,2,2,3,4,6,6,7]
        vpermpd $232, %ymm2, %ymm2      ## ymm2 = ymm2[0,2,2,3]
        vblendvps       %xmm0, %xmm1, %xmm2, %xmm0
        vzeroupper
        retq

Test coverage looks good already for these transforms, so I don't think we need
to add anything specifically for this bug report.

-- 
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/20181029/6edde1d3/attachment.html>


More information about the llvm-bugs mailing list