llvm.org GIT mirror llvm / 37b9a19
Fixed a v8i16 shuffle case that should generate a pshufb instead of a pshuflw/hw. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66645 91177308-0d34-0410-b5e6-96231b3b80d8 Mon P Wang 10 years ago
2 changed file(s) with 13 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
36293629 // Rewrite the MaskVals and assign NewV to V1 if NewV now contains all the
36303630 // source words for the shuffle, to aid later transformations.
36313631 bool AllWordsInNewV = true;
3632 bool InOrder[2] = { true, true };
36323633 for (unsigned i = 0; i != 8; ++i) {
36333634 int idx = MaskVals[i];
3635 if (idx != (int)i)
3636 InOrder[i/4] = false;
36343637 if (idx < 0 || (idx/4) == BestLoQuad || (idx/4) == BestHiQuad)
36353638 continue;
36363639 AllWordsInNewV = false;
36573660
36583661 // If we've eliminated the use of V2, and the new mask is a pshuflw or
36593662 // pshufhw, that's as cheap as it gets. Return the new shuffle.
3660 if (pshufhw || pshuflw) {
3663 if ((pshufhw && InOrder[0]) || (pshuflw && InOrder[1])) {
36613664 MaskV.clear();
36623665 for (unsigned i = 0; i != 8; ++i)
36633666 MaskV.push_back((MaskVals[i] < 0) ? DAG.getUNDEF(MVT::i16)
0 ; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t -f
1 ; RUN: grep pshufb %t | count 1
2
3
4 define <8 x i16> @shuf6(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone {
5 entry:
6 %tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 3, i32 2, i32 0, i32 2, i32 1, i32 5, i32 6 , i32 undef >
7 ret <8 x i16> %tmp9
8 }