OSDN Git Service

[x86] fix miscompile in buildvector v16i8 lowering
authorSanjay Patel <spatel@rotateright.com>
Tue, 7 Jul 2020 16:55:07 +0000 (12:55 -0400)
committerSanjay Patel <spatel@rotateright.com>
Tue, 7 Jul 2020 17:02:31 +0000 (13:02 -0400)
commit642eed37134db4aca953704d1e4ae856af675f51
tree918ec3dd6e2d8e4e19ca5c70053671aa40c2a9d8
parent9ee90a490563a735ddaa739a34c2204c7494826f
[x86] fix miscompile in buildvector v16i8 lowering

In the test based on PR46586:
https://bugs.llvm.org/show_bug.cgi?id=46586
...we are inserting 16-bits into the high element of the vector, shuffling it
to element 0, and extracting 32-bits. But xmm1 was never initialized, so the
top 16-bits of the extract are undef without this patch.

(It seems like we could do better than this by recognizing that we only demand
a subsection of the build vector, but I want to make sure we fix the
miscompile 1st.)

This path is only used for pre-SSE4.1, and simpler patterns get squashed
somewhere along the way, so the test still includes a 'urem' as it did in the
original test from the bug report.

Differential Revision: https://reviews.llvm.org/D83319
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/buildvec-insertvec.ll