[PATCH] D83319: [x86] fix miscompile in buildvector v16i8 lowering
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 7 10:02:57 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG642eed37134d: [x86] fix miscompile in buildvector v16i8 lowering (authored by spatel).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83319/new/
https://reviews.llvm.org/D83319
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/buildvec-insertvec.ll
Index: llvm/test/CodeGen/X86/buildvec-insertvec.ll
===================================================================
--- llvm/test/CodeGen/X86/buildvec-insertvec.ll
+++ llvm/test/CodeGen/X86/buildvec-insertvec.ll
@@ -784,12 +784,13 @@
ret <4 x i32> %5
}
-; FIXME: If we do not define all bytes that are extracted, this is a miscompile.
+; If we do not define all bytes that are extracted, this is a miscompile.
define i32 @PR46586(i8* %p, <4 x i32> %v) {
; SSE2-LABEL: PR46586:
; SSE2: # %bb.0:
; SSE2-NEXT: movzbl 3(%rdi), %eax
+; SSE2-NEXT: pxor %xmm1, %xmm1
; SSE2-NEXT: pinsrw $6, %eax, %xmm1
; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[3,1,2,3]
; SSE2-NEXT: movd %xmm1, %eax
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -8002,10 +8002,11 @@
Elt = NextElt;
}
- // If our first insertion is not the first index then insert into zero
- // vector to break any register dependency else use SCALAR_TO_VECTOR.
+ // If our first insertion is not the first index or zeros are needed, then
+ // insert into zero vector. Otherwise, use SCALAR_TO_VECTOR (leaves high
+ // elements undefined).
if (!V) {
- if (i != 0)
+ if (i != 0 || NumZero)
V = getZeroVector(MVT::v8i16, Subtarget, DAG, dl);
else {
V = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v4i32, Elt);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83319.276114.patch
Type: text/x-patch
Size: 1521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200707/22252895/attachment.bin>
More information about the llvm-commits
mailing list