[llvm] r322511 - [X86] Generalize some code in LowerBUILD_VECTOR. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 15 12:33:52 PST 2018
Author: ctopper
Date: Mon Jan 15 12:33:52 2018
New Revision: 322511
URL: http://llvm.org/viewvc/llvm-project?rev=322511&view=rev
Log:
[X86] Generalize some code in LowerBUILD_VECTOR. NFC
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=322511&r1=322510&r2=322511&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jan 15 12:33:52 2018
@@ -5184,6 +5184,13 @@ static SDValue concat256BitVectors(SDVal
return insert256BitVector(V, V2, NumElems / 2, DAG, dl);
}
+static SDValue concatSubVectors(SDValue V1, SDValue V2, EVT VT,
+ unsigned NumElems, SelectionDAG &DAG,
+ const SDLoc &dl, unsigned VectorWidth) {
+ SDValue V = insertSubVector(DAG.getUNDEF(VT), V1, 0, DAG, dl, VectorWidth);
+ return insertSubVector(V, V2, NumElems / 2, DAG, dl, VectorWidth);
+}
+
/// Returns a vector of specified type with all bits set.
/// Always build ones vectors as <4 x i32>, <8 x i32> or <16 x i32>.
/// Then bitcast to their original type, ensuring they get CSE'd.
@@ -8106,7 +8113,7 @@ X86TargetLowering::LowerBUILD_VECTOR(SDV
// For AVX-length vectors, build the individual 128-bit pieces and use
// shuffles to put them in place.
- if (VT.is256BitVector() || VT.is512BitVector()) {
+ if (VT.getSizeInBits() > 128) {
EVT HVT = EVT::getVectorVT(Context, ExtVT, NumElems/2);
// Build both the lower and upper subvector.
@@ -8116,9 +8123,8 @@ X86TargetLowering::LowerBUILD_VECTOR(SDV
HVT, dl, Op->ops().slice(NumElems / 2, NumElems /2));
// Recreate the wider vector with the lower and upper part.
- if (VT.is256BitVector())
- return concat128BitVectors(Lower, Upper, VT, NumElems, DAG, dl);
- return concat256BitVectors(Lower, Upper, VT, NumElems, DAG, dl);
+ return concatSubVectors(Lower, Upper, VT, NumElems, DAG, dl,
+ VT.getSizeInBits() / 2);
}
// Let legalizer expand 2-wide build_vectors.
More information about the llvm-commits
mailing list