diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index c53639e98cf2..469a21cd2fc8 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -16100,13 +16100,14 @@ static SDValue lowerV8F32Shuffle(const SDLoc &DL, ArrayRef Mask, // If we have a single input shuffle with different shuffle patterns in the // two 128-bit lanes use the variable mask to VPERMILPS. if (V2.isUndef()) { - SDValue VPermMask = getConstVector(Mask, MVT::v8i32, DAG, DL, true); - if (!is128BitLaneCrossingShuffleMask(MVT::v8f32, Mask)) + if (!is128BitLaneCrossingShuffleMask(MVT::v8f32, Mask)) { + SDValue VPermMask = getConstVector(Mask, MVT::v8i32, DAG, DL, true); return DAG.getNode(X86ISD::VPERMILPV, DL, MVT::v8f32, V1, VPermMask); - - if (Subtarget.hasAVX2()) + } + if (Subtarget.hasAVX2()) { + SDValue VPermMask = getConstVector(Mask, MVT::v8i32, DAG, DL, true); return DAG.getNode(X86ISD::VPERMV, DL, MVT::v8f32, VPermMask, V1); - + } // Otherwise, fall back. return lowerShuffleAsLanePermuteAndShuffle(DL, MVT::v8f32, V1, V2, Mask, DAG, Subtarget);