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: [email protected]
Reporter: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs