[llvm] r319724 - [X86] Rearrange some of the code around AVX512 sign/zero extends. NFCI
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 4 17:28:00 PST 2017
Author: ctopper
Date: Mon Dec 4 17:28:00 2017
New Revision: 319724
URL: http://llvm.org/viewvc/llvm-project?rev=319724&view=rev
Log:
[X86] Rearrange some of the code around AVX512 sign/zero extends. NFCI
Move the AVX512 code out of LowerAVXExtend. LowerAVXExtend has two callers but one of them pre-checks for AVX-512 so the code is only live from the other caller. So move the AVX-512 checks up to that caller for symmetry.
Move all of the i1 input type code in Lower_AVX512ZeroExend together.
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=319724&r1=319723&r2=319724&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Dec 4 17:28:00 2017
@@ -16086,9 +16086,6 @@ static SDValue LowerAVXExtend(SDValue Op
MVT InVT = In.getSimpleValueType();
SDLoc dl(Op);
- if (VT.is512BitVector() || InVT.getVectorElementType() == MVT::i1)
- return DAG.getNode(ISD::ZERO_EXTEND, dl, VT, In);
-
// Optimize vectors in AVX mode:
//
// v8i16 -> v8i32
@@ -16158,6 +16155,13 @@ static SDValue LowerZERO_EXTEND_AVX512(
static SDValue LowerANY_EXTEND(SDValue Op, const X86Subtarget &Subtarget,
SelectionDAG &DAG) {
+ MVT VT = Op->getSimpleValueType(0);
+ SDValue In = Op->getOperand(0);
+ MVT InVT = In.getSimpleValueType();
+
+ if (VT.is512BitVector() || InVT.getVectorElementType() == MVT::i1)
+ return DAG.getNode(ISD::ZERO_EXTEND, SDLoc(Op), VT, In);
+
if (Subtarget.hasFp256())
if (SDValue Res = LowerAVXExtend(Op, DAG, Subtarget))
return Res;
@@ -16167,7 +16171,6 @@ static SDValue LowerANY_EXTEND(SDValue O
static SDValue LowerZERO_EXTEND(SDValue Op, const X86Subtarget &Subtarget,
SelectionDAG &DAG) {
- SDLoc DL(Op);
MVT VT = Op.getSimpleValueType();
SDValue In = Op.getOperand(0);
MVT SVT = In.getSimpleValueType();
@@ -18268,14 +18271,6 @@ static SDValue LowerSIGN_EXTEND_AVX512(S
MVT InVTElt = InVT.getVectorElementType();
SDLoc dl(Op);
- // SKX processor
- if ((InVTElt == MVT::i1) &&
- (((Subtarget.hasBWI() && VTElt.getSizeInBits() <= 16)) ||
-
- ((Subtarget.hasDQI() && VTElt.getSizeInBits() >= 32))))
-
- return DAG.getNode(X86ISD::VSEXT, dl, VT, In);
-
unsigned NumElts = VT.getVectorNumElements();
if (VT.is512BitVector() && InVTElt != MVT::i1 &&
@@ -18288,6 +18283,11 @@ static SDValue LowerSIGN_EXTEND_AVX512(S
if (InVTElt != MVT::i1)
return SDValue();
+ // SKX processor
+ if (((Subtarget.hasBWI() && VTElt.getSizeInBits() <= 16)) ||
+ ((Subtarget.hasDQI() && VTElt.getSizeInBits() >= 32)))
+ return DAG.getNode(X86ISD::VSEXT, dl, VT, In);
+
MVT ExtVT = VT;
if (!VT.is512BitVector() && !Subtarget.hasVLX()) {
ExtVT = MVT::getVectorVT(MVT::getIntegerVT(512/NumElts), NumElts);
More information about the llvm-commits
mailing list