forked from OSchip/llvm-project
AVX-512: Concat 4 128-bit vectors in one 512-bit vector.
llvm-svn: 195229
This commit is contained in:
parent
2f234f4908
commit
e1f9bf054f
|
@ -6150,14 +6150,27 @@ static SDValue LowerAVXCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) {
|
|||
if(ResVT.is256BitVector())
|
||||
return Concat128BitVectors(V1, V2, ResVT, NumElems, DAG, dl);
|
||||
|
||||
if (Op.getNumOperands() == 4) {
|
||||
MVT HalfVT = MVT::getVectorVT(ResVT.getScalarType(),
|
||||
ResVT.getVectorNumElements()/2);
|
||||
SDValue V3 = Op.getOperand(2);
|
||||
SDValue V4 = Op.getOperand(3);
|
||||
return Concat256BitVectors(Concat128BitVectors(V1, V2, HalfVT, NumElems/2, DAG, dl),
|
||||
Concat128BitVectors(V3, V4, HalfVT, NumElems/2, DAG, dl), ResVT, NumElems, DAG, dl);
|
||||
}
|
||||
return Concat256BitVectors(V1, V2, ResVT, NumElems, DAG, dl);
|
||||
}
|
||||
|
||||
static SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) {
|
||||
assert(Op.getNumOperands() == 2);
|
||||
MVT VT = Op.getSimpleValueType();
|
||||
unsigned NumOps = Op.getNumOperands();
|
||||
assert((VT.is256BitVector() && NumOps == 2) ||
|
||||
(VT.is512BitVector() && (NumOps == 2 || NumOps == 4)));
|
||||
|
||||
// AVX/AVX-512 can use the vinsertf128 instruction to create 256-bit vectors
|
||||
// AVX can use the vinsertf128 instruction to create 256-bit vectors
|
||||
// from two other 128-bit ones.
|
||||
|
||||
// 512-bit vector may contain 2 256-bit vectors or 4 128-bit vectors
|
||||
return LowerAVXCONCAT_VECTORS(Op, DAG);
|
||||
}
|
||||
|
||||
|
|
|
@ -223,4 +223,11 @@ define <16 x i32> @test25(<16 x i32> %a, <16 x i32> %b) nounwind {
|
|||
define <16 x i32> @test26(<16 x i32> %a) nounwind {
|
||||
%c = shufflevector <16 x i32> %a, <16 x i32> undef, <16 x i32> <i32 1, i32 1, i32 3, i32 3, i32 5, i32 5, i32 7, i32 undef, i32 9, i32 9, i32 undef, i32 11, i32 13, i32 undef, i32 undef, i32 undef>
|
||||
ret <16 x i32> %c
|
||||
}
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @test27
|
||||
; CHECK: ret
|
||||
define <16 x i32> @test27(<4 x i32>%a) {
|
||||
%res = shufflevector <4 x i32> %a, <4 x i32> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
|
||||
ret <16 x i32> %res
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue