[X86][SSE] getFauxShuffle - don't combine shuffles with small truncated scalars ...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 19 Apr 2020 12:34:58 +0000 (13:34 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 19 Apr 2020 12:35:22 +0000 (13:35 +0100)
commite71dd7c011a35b6969b53c168a0e57afa1a57792
treee7e59410cc7404921b08eff24cb571881283428b
parent098e40eac524fd7bcad72d37378d25f4305de512
[X86][SSE] getFauxShuffle - don't combine shuffles with small truncated scalars (PR45604)

getFauxShuffle attempts to combine INSERT_VECTOR_ELT(TRUNCATE/EXTEND(EXTRACT_VECTOR_ELT(x))) patterns into a target shuffle chain.

PR45604 identified an issue where the scalar was truncated to a size smaller than the destination vector element and then zero extended back, which requires the upper bits to be zero'd which we don't currently do.

To avoid the bug I've added an early out in these truncation cases, a future commit should allow us to handle this by inserting the necessary SM_SentinelZero padding.
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/buildvec-extract.ll
llvm/test/CodeGen/X86/buildvec-insertvec.ll
llvm/test/CodeGen/X86/extract-concat.ll
llvm/test/CodeGen/X86/vector-shuffle-combining.ll