[LLVMbugs] [Bug 20767] New: rL213897 introduced a regression on 32-bit code due to SEXTLOAD not utilized

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 27 04:11:57 PDT 2014


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

            Bug ID: 20767
           Summary: rL213897 introduced a regression on 32-bit code due to
                    SEXTLOAD not utilized
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: zinovy.nis at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

rL213897 (http://reviews.llvm.org/rL213897) introduced a significant regression
for 32bit code.

> llc -march=x86 -mcpu=core-avx2 -O2 -o - test.ll

; test.ll
define <4 x i32> @sextload(<4 x i16>* %ptr).
{
entry:
    %l = load<4 x i16>* %ptr
    %m = sext<4 x i16> %l to <4 x i32>
    ret <4 x i32> %m
}

is compiled into:

        movl    4(%esp), %eax
        movswl  2(%eax), %ecx
        movswl  (%eax), %edx
        vmovd   %edx, %xmm0
        vpinsrd $1, %ecx, %xmm0, %xmm0
        movswl  4(%eax), %ecx
        vpinsrd $2, %ecx, %xmm0, %xmm0
        movswl  6(%eax), %eax
        vpinsrd $3, %eax, %xmm0, %xmm0
        retl

Note lots of insert instructions. These instructions appeared due to 

    if (Subtarget->is64Bit()) {
      setLoadExtAction(ISD::SEXTLOAD, MVT::v4i16, Custom);
      setLoadExtAction(ISD::SEXTLOAD, MVT::v8i8, Custom);
    }

in lib/Target/X86/X86ISelLowering.cpp.

Eliminating "if", we get:

        movl    4(%esp), %eax
        vpmovsxwd       (%eax), %xmm0
        retl

which is optimal.

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


More information about the llvm-bugs mailing list