[LLVMbugs] [Bug 18054] New: (sext (vzext x)) -> (vsext x) in sign_extend_inreg lowering incorrectly optimize the case when input type is a vector of i1

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 25 01:02:29 PST 2013


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

            Bug ID: 18054
           Summary: (sext (vzext x)) -> (vsext x) in sign_extend_inreg
                    lowering incorrectly optimize the case when input type
                    is a vector of i1
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: michael.liao at intel.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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

During lowering of sign_extend_inreg, (sext (vzext x)) is optimized to (vsext
x), however, it doesn't check the in-register type as that optimization is only
valid when in-register type is a vector of i8, i16, or i32. E.g. if the
in-register type is a vector of i1, (vsext x) cannot extend sign-bit.

A test case is attached. Run 'llc -mcpu=penryn < ss.ll' (with SSE only), it
produces the following code

foo:                                    # @foo
    .cfi_startproc
# BB#0:
    movdqa    %xmm0, %xmm1
    pshufb    .LCPI0_0(%rip), %xmm1
    pslld    $31, %xmm1
    psrad    $31, %xmm1
    movdqa    %xmm0, %xmm2
    pshufb    .LCPI0_1(%rip), %xmm2
    pslld    $31, %xmm2
    psrad    $31, %xmm2
    pmovsxbd    %xmm0, %xmm3
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    pshufb    .LCPI0_2(%rip), %xmm0
    pslld    $31, %xmm0
    psrad    $31, %xmm0
    movdqa    %xmm3, (%rdi)
    movdqa    %xmm0, 48(%rdi)
    movdqa    %xmm2, 32(%rdi)
    movdqa    %xmm1, 16(%rdi)
    ret
.Ltmp0:
    .size    foo, .Ltmp0-foo
    .cfi_endproc

Note that pmovsxbd marked. It's incorrect as the value in xmm0 is still i1.

-- 
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/20131125/99381b1c/attachment.html>


More information about the llvm-bugs mailing list