Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 093b172

Browse files
committed
Merging r323190:
------------------------------------------------------------------------ r323190 | rksimon | 2018-01-23 12:39:06 +0100 (Tue, 23 Jan 2018) | 5 lines [X86][SSE] LowerBUILD_VECTORAsVariablePermute - fix PSHUFB source/index operand ordering As detailed in rL317463, PSHUFB (like most variable shuffle instructions) uses Op[0] for the source vector and Op[1] for the shuffle index vector, VPERMV works in reverse which is probably where the confusion comes from. Differential Revision: https://reviews.llvm.org/D42380 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323335 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent d8c108c commit 093b172

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/Target/X86/X86ISelLowering.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7898,8 +7898,9 @@ LowerBUILD_VECTORAsVariablePermute(SDValue V, SelectionDAG &DAG,
78987898
DAG.getNode(ISD::INSERT_SUBVECTOR, SDLoc(SrcVec), VT, DAG.getUNDEF(VT),
78997899
SrcVec, DAG.getIntPtrConstant(0, SDLoc(SrcVec)));
79007900
}
7901-
return DAG.getNode(VT == MVT::v16i8 ? X86ISD::PSHUFB : X86ISD::VPERMV,
7902-
SDLoc(V), VT, IndicesVec, SrcVec);
7901+
if (VT == MVT::v16i8)
7902+
return DAG.getNode(X86ISD::PSHUFB, SDLoc(V), VT, SrcVec, IndicesVec);
7903+
return DAG.getNode(X86ISD::VPERMV, SDLoc(V), VT, IndicesVec, SrcVec);
79037904
}
79047905

79057906
SDValue

test/CodeGen/X86/var-permute-128.ll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,12 @@ define <8 x i16> @var_shuffle_v8i16(<8 x i16> %v, <8 x i16> %indices) nounwind {
207207
define <16 x i8> @var_shuffle_v16i8(<16 x i8> %v, <16 x i8> %indices) nounwind {
208208
; SSSE3-LABEL: var_shuffle_v16i8:
209209
; SSSE3: # %bb.0:
210-
; SSSE3-NEXT: pshufb %xmm0, %xmm1
211-
; SSSE3-NEXT: movdqa %xmm1, %xmm0
210+
; SSSE3-NEXT: pshufb %xmm1, %xmm0
212211
; SSSE3-NEXT: retq
213212
;
214213
; AVX-LABEL: var_shuffle_v16i8:
215214
; AVX: # %bb.0:
216-
; AVX-NEXT: vpshufb %xmm0, %xmm1, %xmm0
215+
; AVX-NEXT: vpshufb %xmm1, %xmm0, %xmm0
217216
; AVX-NEXT: retq
218217
%index0 = extractelement <16 x i8> %indices, i32 0
219218
%index1 = extractelement <16 x i8> %indices, i32 1

0 commit comments

Comments
 (0)