diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -1341,43 +1341,67 @@ if (!IsIntVec && !FMF.allowReassoc()) return; - auto IsSupportedArg = [](Value *Op, unsigned N) { + auto CanBeFlattened = [](Value *Op) { + return match(Op, m_OneUse(m_CombineOr( + m_Load(m_Value()), + m_Intrinsic( + m_Value(), m_SpecificInt(1))))); + }; + // Returns the cost benefit of using \p Op with the dot product lowering. If + // the returned cost is < 0, the argument is cheaper to use in the + // dot-product lowering. + auto GetCostForArg = [this, &CanBeFlattened](Value *Op, unsigned N) { if (!isa(Op)) - return true; - return match( - Op, m_OneUse(m_CombineOr( - m_Load(m_Value()), - m_Intrinsic( - m_Value(), m_SpecificInt(N))))); + return InstructionCost(0); + + FixedVectorType *VecTy = cast(Op->getType()); + Type *EltTy = VecTy->getElementType(); + + if (CanBeFlattened(Op)) { + if (N == 1) + return InstructionCost(0); + + return TTI.getMemoryOpCost(Instruction::Load, VecTy, Align(1), 0) - + N * TTI.getMemoryOpCost(Instruction::Load, EltTy, Align(1), 0); + } + + InstructionCost EmbedCost(0); + // Roughly estimate the cost for embedding the columns into a vector. + for (unsigned I = 1; I < N; ++I) + EmbedCost += + TTI.getShuffleCost(TTI::SK_Splice, FixedVectorType::get(EltTy, 1), + std::nullopt, TTI::TCK_RecipThroughput); + return EmbedCost; }; - if (!IsSupportedArg(LHS, RShape.NumColumns)) - return; + auto LHSCost = GetCostForArg(LHS, LShape.NumColumns); // We compare the costs of a vector.reduce.add to sequential add. int AddOpCode = IsIntVec ? Instruction::Add : Instruction::FAdd; - FastMathFlags FMFReassoc; - FMFReassoc.setAllowReassoc(); - InstructionCost ReductionCost = TTI.getArithmeticReductionCost( - AddOpCode, cast(LHS->getType()), FMFReassoc); + int MulOpCode = IsIntVec ? Instruction::Mul : Instruction::FMul; + InstructionCost ReductionCost = + TTI.getArithmeticReductionCost( + AddOpCode, cast(LHS->getType()), + IsIntVec ? std::nullopt : std::optional(FMF)) + + TTI.getArithmeticInstrCost(MulOpCode, LHS->getType()); InstructionCost SequentialAddCost = TTI.getArithmeticInstrCost(AddOpCode, ElementType) * - (LShape.NumColumns - 1); - if (ReductionCost >= SequentialAddCost) + (LShape.NumColumns - 1) + + TTI.getArithmeticInstrCost(MulOpCode, ElementType) * + (LShape.NumColumns); + if ((LHSCost + ReductionCost - SequentialAddCost) > InstructionCost(0)) return; FusedInsts.insert(MatMul); IRBuilder<> Builder(MatMul); - auto FlattenArg = [&Builder, &FusedInsts](Value *Op) -> Value * { + auto FlattenArg = [&Builder, &FusedInsts, + &CanBeFlattened](Value *Op) -> Value * { // Matmul must be the only user of loads because we don't use LowerLoad // for row vectors (LowerLoad results in scalar loads and shufflevectors // instead of single vector load). - if (!match(Op, m_CombineOr( - m_Load(m_Value()), - m_Intrinsic()))) { + if (!CanBeFlattened(Op)) return Op; - } - FusedInsts.insert(cast(Op)); + FusedInsts.insert(cast(Op)); // If vector uses the builtin load, lower to a LoadInst Value *Ptr; if (match(Op, m_Intrinsic( diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-float.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-float.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-float.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-float.ll @@ -56,16 +56,10 @@ define <1 x float> @dotproduct_float_v1(<1 x float> %a, <1 x float> %b) { ; CHECK-LABEL: @dotproduct_float_v1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <1 x float> [[A:%.*]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <1 x float> [[B:%.*]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x float> [[SPLIT]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP0:%.*]] = extractelement <1 x float> [[SPLIT1]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x float> poison, float [[TMP0]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP1:%.*]] = fmul fast <1 x float> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <1 x float> [[TMP1]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <1 x float> undef, <1 x float> [[TMP2]], <1 x i32> -; CHECK-NEXT: ret <1 x float> [[TMP3]] +; CHECK-NEXT: [[TMP0:%.*]] = fmul <1 x float> [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.vector.reduce.fadd.v1f32(float 0.000000e+00, <1 x float> [[TMP0]]) +; CHECK-NEXT: [[TMP2:%.*]] = insertelement <1 x float> poison, float [[TMP1]], i64 0 +; CHECK-NEXT: ret <1 x float> [[TMP2]] ; entry: %c = tail call fast <1 x float> @llvm.matrix.multiply.v1f32.v1f32.v1f32(<1 x float> %a, <1 x float> %b, i32 1, i32 1, i32 1) @@ -77,28 +71,10 @@ define <1 x float> @dotproduct_float_v3(<3 x float> %a, <3 x float> %b) { ; CHECK-LABEL: @dotproduct_float_v3( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <3 x float> [[A:%.*]], <3 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <3 x float> [[A]], <3 x float> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <3 x float> [[A]], <3 x float> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT3:%.*]] = shufflevector <3 x float> [[B:%.*]], <3 x float> poison, <3 x i32> -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x float> [[SPLIT]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP0:%.*]] = extractelement <3 x float> [[SPLIT3]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x float> poison, float [[TMP0]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP1:%.*]] = fmul fast <1 x float> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK4:%.*]] = shufflevector <1 x float> [[SPLIT1]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP2:%.*]] = extractelement <3 x float> [[SPLIT3]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT5:%.*]] = insertelement <1 x float> poison, float [[TMP2]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT6:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT5]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP3:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK4]], <1 x float> [[SPLAT_SPLAT6]], <1 x float> [[TMP1]]) -; CHECK-NEXT: [[BLOCK7:%.*]] = shufflevector <1 x float> [[SPLIT2]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP4:%.*]] = extractelement <3 x float> [[SPLIT3]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT8:%.*]] = insertelement <1 x float> poison, float [[TMP4]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT9:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT8]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP5:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK7]], <1 x float> [[SPLAT_SPLAT9]], <1 x float> [[TMP3]]) -; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <1 x float> [[TMP5]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <1 x float> undef, <1 x float> [[TMP6]], <1 x i32> -; CHECK-NEXT: ret <1 x float> [[TMP7]] +; CHECK-NEXT: [[TMP0:%.*]] = fmul <3 x float> [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.vector.reduce.fadd.v3f32(float 0.000000e+00, <3 x float> [[TMP0]]) +; CHECK-NEXT: [[TMP2:%.*]] = insertelement <1 x float> poison, float [[TMP1]], i64 0 +; CHECK-NEXT: ret <1 x float> [[TMP2]] ; entry: %c = tail call fast <1 x float> @llvm.matrix.multiply.v1f32.v3f32.v3f32(<3 x float> %a, <3 x float> %b, i32 1, i32 3, i32 1) @@ -110,51 +86,12 @@ define <1 x float> @intrinsic_column_major_load_dot_product_float_v6(ptr %lhs_address, ptr %rhs_address) { ; CHECK-LABEL: @intrinsic_column_major_load_dot_product_float_v6( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[COL_LOAD:%.*]] = load <1 x float>, ptr [[LHS_ADDRESS:%.*]], align 4 -; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 1 -; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <1 x float>, ptr [[VEC_GEP]], align 4 -; CHECK-NEXT: [[VEC_GEP2:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 2 -; CHECK-NEXT: [[COL_LOAD3:%.*]] = load <1 x float>, ptr [[VEC_GEP2]], align 4 -; CHECK-NEXT: [[VEC_GEP4:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 3 -; CHECK-NEXT: [[COL_LOAD5:%.*]] = load <1 x float>, ptr [[VEC_GEP4]], align 4 -; CHECK-NEXT: [[VEC_GEP6:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 4 -; CHECK-NEXT: [[COL_LOAD7:%.*]] = load <1 x float>, ptr [[VEC_GEP6]], align 4 -; CHECK-NEXT: [[VEC_GEP8:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 5 -; CHECK-NEXT: [[COL_LOAD9:%.*]] = load <1 x float>, ptr [[VEC_GEP8]], align 4 -; CHECK-NEXT: [[COL_LOAD10:%.*]] = load <6 x float>, ptr [[RHS_ADDRESS:%.*]], align 4 -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x float> [[COL_LOAD]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP0:%.*]] = extractelement <6 x float> [[COL_LOAD10]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x float> poison, float [[TMP0]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP1:%.*]] = fmul fast <1 x float> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK11:%.*]] = shufflevector <1 x float> [[COL_LOAD1]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP2:%.*]] = extractelement <6 x float> [[COL_LOAD10]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT12:%.*]] = insertelement <1 x float> poison, float [[TMP2]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT13:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT12]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP3:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK11]], <1 x float> [[SPLAT_SPLAT13]], <1 x float> [[TMP1]]) -; CHECK-NEXT: [[BLOCK14:%.*]] = shufflevector <1 x float> [[COL_LOAD3]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP4:%.*]] = extractelement <6 x float> [[COL_LOAD10]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT15:%.*]] = insertelement <1 x float> poison, float [[TMP4]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT16:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT15]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP5:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK14]], <1 x float> [[SPLAT_SPLAT16]], <1 x float> [[TMP3]]) -; CHECK-NEXT: [[BLOCK17:%.*]] = shufflevector <1 x float> [[COL_LOAD5]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP6:%.*]] = extractelement <6 x float> [[COL_LOAD10]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT18:%.*]] = insertelement <1 x float> poison, float [[TMP6]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT19:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT18]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP7:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK17]], <1 x float> [[SPLAT_SPLAT19]], <1 x float> [[TMP5]]) -; CHECK-NEXT: [[BLOCK20:%.*]] = shufflevector <1 x float> [[COL_LOAD7]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP8:%.*]] = extractelement <6 x float> [[COL_LOAD10]], i64 4 -; CHECK-NEXT: [[SPLAT_SPLATINSERT21:%.*]] = insertelement <1 x float> poison, float [[TMP8]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT22:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT21]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK20]], <1 x float> [[SPLAT_SPLAT22]], <1 x float> [[TMP7]]) -; CHECK-NEXT: [[BLOCK23:%.*]] = shufflevector <1 x float> [[COL_LOAD9]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP10:%.*]] = extractelement <6 x float> [[COL_LOAD10]], i64 5 -; CHECK-NEXT: [[SPLAT_SPLATINSERT24:%.*]] = insertelement <1 x float> poison, float [[TMP10]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT25:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT24]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP11:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK23]], <1 x float> [[SPLAT_SPLAT25]], <1 x float> [[TMP9]]) -; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <1 x float> [[TMP11]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP13:%.*]] = shufflevector <1 x float> undef, <1 x float> [[TMP12]], <1 x i32> -; CHECK-NEXT: ret <1 x float> [[TMP13]] +; CHECK-NEXT: [[COL_LOAD:%.*]] = load <6 x float>, ptr [[RHS_ADDRESS:%.*]], align 4 +; CHECK-NEXT: [[TMP0:%.*]] = load <6 x float>, ptr [[LHS_ADDRESS:%.*]], align 32 +; CHECK-NEXT: [[TMP1:%.*]] = fmul <6 x float> [[TMP0]], [[COL_LOAD]] +; CHECK-NEXT: [[TMP2:%.*]] = call fast float @llvm.vector.reduce.fadd.v6f32(float 0.000000e+00, <6 x float> [[TMP1]]) +; CHECK-NEXT: [[TMP3:%.*]] = insertelement <1 x float> poison, float [[TMP2]], i64 0 +; CHECK-NEXT: ret <1 x float> [[TMP3]] ; entry: %lhs = tail call fast <6 x float> @llvm.matrix.column.major.load.v6f32.i64(ptr nonnull align 4 %lhs_address, i64 1, i1 false, i32 1, i32 6) @@ -168,58 +105,12 @@ define <1 x float> @LoadInst_dot_product_float_v7(ptr %lhs_address, ptr %rhs_address) { ; CHECK-LABEL: @LoadInst_dot_product_float_v7( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[COL_LOAD:%.*]] = load <1 x float>, ptr [[LHS_ADDRESS:%.*]], align 32 -; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 1 -; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <1 x float>, ptr [[VEC_GEP]], align 4 -; CHECK-NEXT: [[VEC_GEP2:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 2 -; CHECK-NEXT: [[COL_LOAD3:%.*]] = load <1 x float>, ptr [[VEC_GEP2]], align 8 -; CHECK-NEXT: [[VEC_GEP4:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 3 -; CHECK-NEXT: [[COL_LOAD5:%.*]] = load <1 x float>, ptr [[VEC_GEP4]], align 4 -; CHECK-NEXT: [[VEC_GEP6:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 4 -; CHECK-NEXT: [[COL_LOAD7:%.*]] = load <1 x float>, ptr [[VEC_GEP6]], align 16 -; CHECK-NEXT: [[VEC_GEP8:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 5 -; CHECK-NEXT: [[COL_LOAD9:%.*]] = load <1 x float>, ptr [[VEC_GEP8]], align 4 -; CHECK-NEXT: [[VEC_GEP10:%.*]] = getelementptr float, ptr [[LHS_ADDRESS]], i64 6 -; CHECK-NEXT: [[COL_LOAD11:%.*]] = load <1 x float>, ptr [[VEC_GEP10]], align 8 -; CHECK-NEXT: [[COL_LOAD12:%.*]] = load <7 x float>, ptr [[RHS_ADDRESS:%.*]], align 32 -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x float> [[COL_LOAD]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP0:%.*]] = extractelement <7 x float> [[COL_LOAD12]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x float> poison, float [[TMP0]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP1:%.*]] = fmul fast <1 x float> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK13:%.*]] = shufflevector <1 x float> [[COL_LOAD1]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP2:%.*]] = extractelement <7 x float> [[COL_LOAD12]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT14:%.*]] = insertelement <1 x float> poison, float [[TMP2]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT15:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT14]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP3:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK13]], <1 x float> [[SPLAT_SPLAT15]], <1 x float> [[TMP1]]) -; CHECK-NEXT: [[BLOCK16:%.*]] = shufflevector <1 x float> [[COL_LOAD3]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP4:%.*]] = extractelement <7 x float> [[COL_LOAD12]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT17:%.*]] = insertelement <1 x float> poison, float [[TMP4]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT18:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT17]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP5:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK16]], <1 x float> [[SPLAT_SPLAT18]], <1 x float> [[TMP3]]) -; CHECK-NEXT: [[BLOCK19:%.*]] = shufflevector <1 x float> [[COL_LOAD5]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP6:%.*]] = extractelement <7 x float> [[COL_LOAD12]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT20:%.*]] = insertelement <1 x float> poison, float [[TMP6]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT21:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT20]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP7:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK19]], <1 x float> [[SPLAT_SPLAT21]], <1 x float> [[TMP5]]) -; CHECK-NEXT: [[BLOCK22:%.*]] = shufflevector <1 x float> [[COL_LOAD7]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP8:%.*]] = extractelement <7 x float> [[COL_LOAD12]], i64 4 -; CHECK-NEXT: [[SPLAT_SPLATINSERT23:%.*]] = insertelement <1 x float> poison, float [[TMP8]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT24:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT23]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK22]], <1 x float> [[SPLAT_SPLAT24]], <1 x float> [[TMP7]]) -; CHECK-NEXT: [[BLOCK25:%.*]] = shufflevector <1 x float> [[COL_LOAD9]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP10:%.*]] = extractelement <7 x float> [[COL_LOAD12]], i64 5 -; CHECK-NEXT: [[SPLAT_SPLATINSERT26:%.*]] = insertelement <1 x float> poison, float [[TMP10]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT27:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT26]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP11:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK25]], <1 x float> [[SPLAT_SPLAT27]], <1 x float> [[TMP9]]) -; CHECK-NEXT: [[BLOCK28:%.*]] = shufflevector <1 x float> [[COL_LOAD11]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP12:%.*]] = extractelement <7 x float> [[COL_LOAD12]], i64 6 -; CHECK-NEXT: [[SPLAT_SPLATINSERT29:%.*]] = insertelement <1 x float> poison, float [[TMP12]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT30:%.*]] = shufflevector <1 x float> [[SPLAT_SPLATINSERT29]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP13:%.*]] = call fast <1 x float> @llvm.fmuladd.v1f32(<1 x float> [[BLOCK28]], <1 x float> [[SPLAT_SPLAT30]], <1 x float> [[TMP11]]) -; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <1 x float> [[TMP13]], <1 x float> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP15:%.*]] = shufflevector <1 x float> undef, <1 x float> [[TMP14]], <1 x i32> -; CHECK-NEXT: ret <1 x float> [[TMP15]] +; CHECK-NEXT: [[LHS:%.*]] = load <7 x float>, ptr [[LHS_ADDRESS:%.*]], align 32 +; CHECK-NEXT: [[COL_LOAD:%.*]] = load <7 x float>, ptr [[RHS_ADDRESS:%.*]], align 32 +; CHECK-NEXT: [[TMP0:%.*]] = fmul <7 x float> [[LHS]], [[COL_LOAD]] +; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.vector.reduce.fadd.v7f32(float 0.000000e+00, <7 x float> [[TMP0]]) +; CHECK-NEXT: [[TMP2:%.*]] = insertelement <1 x float> poison, float [[TMP1]], i64 0 +; CHECK-NEXT: ret <1 x float> [[TMP2]] ; entry: %lhs = load <7 x float>, ptr %lhs_address @@ -342,58 +233,12 @@ define <1 x double> @LoadInst_dot_product_double_v7(ptr %lhs_address, ptr %rhs_address) { ; CHECK-LABEL: @LoadInst_dot_product_double_v7( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[COL_LOAD:%.*]] = load <1 x double>, ptr [[LHS_ADDRESS:%.*]], align 64 -; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr double, ptr [[LHS_ADDRESS]], i64 1 -; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <1 x double>, ptr [[VEC_GEP]], align 8 -; CHECK-NEXT: [[VEC_GEP2:%.*]] = getelementptr double, ptr [[LHS_ADDRESS]], i64 2 -; CHECK-NEXT: [[COL_LOAD3:%.*]] = load <1 x double>, ptr [[VEC_GEP2]], align 16 -; CHECK-NEXT: [[VEC_GEP4:%.*]] = getelementptr double, ptr [[LHS_ADDRESS]], i64 3 -; CHECK-NEXT: [[COL_LOAD5:%.*]] = load <1 x double>, ptr [[VEC_GEP4]], align 8 -; CHECK-NEXT: [[VEC_GEP6:%.*]] = getelementptr double, ptr [[LHS_ADDRESS]], i64 4 -; CHECK-NEXT: [[COL_LOAD7:%.*]] = load <1 x double>, ptr [[VEC_GEP6]], align 32 -; CHECK-NEXT: [[VEC_GEP8:%.*]] = getelementptr double, ptr [[LHS_ADDRESS]], i64 5 -; CHECK-NEXT: [[COL_LOAD9:%.*]] = load <1 x double>, ptr [[VEC_GEP8]], align 8 -; CHECK-NEXT: [[VEC_GEP10:%.*]] = getelementptr double, ptr [[LHS_ADDRESS]], i64 6 -; CHECK-NEXT: [[COL_LOAD11:%.*]] = load <1 x double>, ptr [[VEC_GEP10]], align 16 -; CHECK-NEXT: [[COL_LOAD12:%.*]] = load <7 x double>, ptr [[RHS_ADDRESS:%.*]], align 64 -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x double> [[COL_LOAD]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP0:%.*]] = extractelement <7 x double> [[COL_LOAD12]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x double> poison, double [[TMP0]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP1:%.*]] = fmul fast <1 x double> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK13:%.*]] = shufflevector <1 x double> [[COL_LOAD1]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP2:%.*]] = extractelement <7 x double> [[COL_LOAD12]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT14:%.*]] = insertelement <1 x double> poison, double [[TMP2]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT15:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT14]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP3:%.*]] = call fast <1 x double> @llvm.fmuladd.v1f64(<1 x double> [[BLOCK13]], <1 x double> [[SPLAT_SPLAT15]], <1 x double> [[TMP1]]) -; CHECK-NEXT: [[BLOCK16:%.*]] = shufflevector <1 x double> [[COL_LOAD3]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP4:%.*]] = extractelement <7 x double> [[COL_LOAD12]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT17:%.*]] = insertelement <1 x double> poison, double [[TMP4]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT18:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT17]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP5:%.*]] = call fast <1 x double> @llvm.fmuladd.v1f64(<1 x double> [[BLOCK16]], <1 x double> [[SPLAT_SPLAT18]], <1 x double> [[TMP3]]) -; CHECK-NEXT: [[BLOCK19:%.*]] = shufflevector <1 x double> [[COL_LOAD5]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP6:%.*]] = extractelement <7 x double> [[COL_LOAD12]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT20:%.*]] = insertelement <1 x double> poison, double [[TMP6]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT21:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT20]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP7:%.*]] = call fast <1 x double> @llvm.fmuladd.v1f64(<1 x double> [[BLOCK19]], <1 x double> [[SPLAT_SPLAT21]], <1 x double> [[TMP5]]) -; CHECK-NEXT: [[BLOCK22:%.*]] = shufflevector <1 x double> [[COL_LOAD7]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP8:%.*]] = extractelement <7 x double> [[COL_LOAD12]], i64 4 -; CHECK-NEXT: [[SPLAT_SPLATINSERT23:%.*]] = insertelement <1 x double> poison, double [[TMP8]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT24:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT23]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = call fast <1 x double> @llvm.fmuladd.v1f64(<1 x double> [[BLOCK22]], <1 x double> [[SPLAT_SPLAT24]], <1 x double> [[TMP7]]) -; CHECK-NEXT: [[BLOCK25:%.*]] = shufflevector <1 x double> [[COL_LOAD9]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP10:%.*]] = extractelement <7 x double> [[COL_LOAD12]], i64 5 -; CHECK-NEXT: [[SPLAT_SPLATINSERT26:%.*]] = insertelement <1 x double> poison, double [[TMP10]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT27:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT26]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP11:%.*]] = call fast <1 x double> @llvm.fmuladd.v1f64(<1 x double> [[BLOCK25]], <1 x double> [[SPLAT_SPLAT27]], <1 x double> [[TMP9]]) -; CHECK-NEXT: [[BLOCK28:%.*]] = shufflevector <1 x double> [[COL_LOAD11]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP12:%.*]] = extractelement <7 x double> [[COL_LOAD12]], i64 6 -; CHECK-NEXT: [[SPLAT_SPLATINSERT29:%.*]] = insertelement <1 x double> poison, double [[TMP12]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT30:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT29]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP13:%.*]] = call fast <1 x double> @llvm.fmuladd.v1f64(<1 x double> [[BLOCK28]], <1 x double> [[SPLAT_SPLAT30]], <1 x double> [[TMP11]]) -; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <1 x double> [[TMP13]], <1 x double> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP15:%.*]] = shufflevector <1 x double> undef, <1 x double> [[TMP14]], <1 x i32> -; CHECK-NEXT: ret <1 x double> [[TMP15]] +; CHECK-NEXT: [[LHS:%.*]] = load <7 x double>, ptr [[LHS_ADDRESS:%.*]], align 64 +; CHECK-NEXT: [[COL_LOAD:%.*]] = load <7 x double>, ptr [[RHS_ADDRESS:%.*]], align 64 +; CHECK-NEXT: [[TMP0:%.*]] = fmul <7 x double> [[LHS]], [[COL_LOAD]] +; CHECK-NEXT: [[TMP1:%.*]] = call fast double @llvm.vector.reduce.fadd.v7f64(double 0.000000e+00, <7 x double> [[TMP0]]) +; CHECK-NEXT: [[TMP2:%.*]] = insertelement <1 x double> poison, double [[TMP1]], i64 0 +; CHECK-NEXT: ret <1 x double> [[TMP2]] ; entry: %lhs = load <7 x double>, ptr %lhs_address diff --git a/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-int.ll b/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-int.ll --- a/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-int.ll +++ b/llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-int.ll @@ -75,57 +75,17 @@ ; CHECK-NEXT: [[TMP5:%.*]] = add <1 x i32> [[SPLIT5]], [[SPLIT13]] ; CHECK-NEXT: [[TMP6:%.*]] = add <1 x i32> [[SPLIT6]], [[SPLIT14]] ; CHECK-NEXT: [[TMP7:%.*]] = add <1 x i32> [[SPLIT7]], [[SPLIT15]] -; CHECK-NEXT: [[SPLIT16:%.*]] = shufflevector <8 x i32> [[C:%.*]], <8 x i32> poison, <8 x i32> -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i32> [[TMP0]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP8:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i32> poison, i32 [[TMP8]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = mul <1 x i32> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK17:%.*]] = shufflevector <1 x i32> [[TMP1]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP10:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT18:%.*]] = insertelement <1 x i32> poison, i32 [[TMP10]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT19:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT18]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP11:%.*]] = mul <1 x i32> [[BLOCK17]], [[SPLAT_SPLAT19]] -; CHECK-NEXT: [[TMP12:%.*]] = add <1 x i32> [[TMP9]], [[TMP11]] -; CHECK-NEXT: [[BLOCK20:%.*]] = shufflevector <1 x i32> [[TMP2]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP13:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT21:%.*]] = insertelement <1 x i32> poison, i32 [[TMP13]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT22:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT21]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP14:%.*]] = mul <1 x i32> [[BLOCK20]], [[SPLAT_SPLAT22]] -; CHECK-NEXT: [[TMP15:%.*]] = add <1 x i32> [[TMP12]], [[TMP14]] -; CHECK-NEXT: [[BLOCK23:%.*]] = shufflevector <1 x i32> [[TMP3]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP16:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT24:%.*]] = insertelement <1 x i32> poison, i32 [[TMP16]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT25:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT24]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP17:%.*]] = mul <1 x i32> [[BLOCK23]], [[SPLAT_SPLAT25]] -; CHECK-NEXT: [[TMP18:%.*]] = add <1 x i32> [[TMP15]], [[TMP17]] -; CHECK-NEXT: [[BLOCK26:%.*]] = shufflevector <1 x i32> [[TMP4]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP19:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 4 -; CHECK-NEXT: [[SPLAT_SPLATINSERT27:%.*]] = insertelement <1 x i32> poison, i32 [[TMP19]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT28:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT27]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP20:%.*]] = mul <1 x i32> [[BLOCK26]], [[SPLAT_SPLAT28]] -; CHECK-NEXT: [[TMP21:%.*]] = add <1 x i32> [[TMP18]], [[TMP20]] -; CHECK-NEXT: [[BLOCK29:%.*]] = shufflevector <1 x i32> [[TMP5]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP22:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 5 -; CHECK-NEXT: [[SPLAT_SPLATINSERT30:%.*]] = insertelement <1 x i32> poison, i32 [[TMP22]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT31:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT30]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP23:%.*]] = mul <1 x i32> [[BLOCK29]], [[SPLAT_SPLAT31]] -; CHECK-NEXT: [[TMP24:%.*]] = add <1 x i32> [[TMP21]], [[TMP23]] -; CHECK-NEXT: [[BLOCK32:%.*]] = shufflevector <1 x i32> [[TMP6]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP25:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 6 -; CHECK-NEXT: [[SPLAT_SPLATINSERT33:%.*]] = insertelement <1 x i32> poison, i32 [[TMP25]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT34:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT33]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP26:%.*]] = mul <1 x i32> [[BLOCK32]], [[SPLAT_SPLAT34]] -; CHECK-NEXT: [[TMP27:%.*]] = add <1 x i32> [[TMP24]], [[TMP26]] -; CHECK-NEXT: [[BLOCK35:%.*]] = shufflevector <1 x i32> [[TMP7]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP28:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 7 -; CHECK-NEXT: [[SPLAT_SPLATINSERT36:%.*]] = insertelement <1 x i32> poison, i32 [[TMP28]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT37:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT36]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP29:%.*]] = mul <1 x i32> [[BLOCK35]], [[SPLAT_SPLAT37]] -; CHECK-NEXT: [[TMP30:%.*]] = add <1 x i32> [[TMP27]], [[TMP29]] -; CHECK-NEXT: [[TMP31:%.*]] = shufflevector <1 x i32> [[TMP30]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP32:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP31]], <1 x i32> -; CHECK-NEXT: ret <1 x i32> [[TMP32]] +; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <1 x i32> [[TMP0]], <1 x i32> [[TMP1]], <2 x i32> +; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <1 x i32> [[TMP2]], <1 x i32> [[TMP3]], <2 x i32> +; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <1 x i32> [[TMP4]], <1 x i32> [[TMP5]], <2 x i32> +; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <1 x i32> [[TMP6]], <1 x i32> [[TMP7]], <2 x i32> +; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <2 x i32> [[TMP8]], <2 x i32> [[TMP9]], <4 x i32> +; CHECK-NEXT: [[TMP13:%.*]] = shufflevector <2 x i32> [[TMP10]], <2 x i32> [[TMP11]], <4 x i32> +; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <4 x i32> [[TMP12]], <4 x i32> [[TMP13]], <8 x i32> +; CHECK-NEXT: [[TMP15:%.*]] = mul <8 x i32> [[TMP14]], [[C:%.*]] +; CHECK-NEXT: [[TMP16:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> [[TMP15]]) +; CHECK-NEXT: [[TMP17:%.*]] = insertelement <1 x i32> poison, i32 [[TMP16]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP17]] ; entry: %add = add <8 x i32> %a, %b @@ -177,57 +137,17 @@ ; CHECK-NEXT: [[TMP5:%.*]] = sub <1 x i32> [[SPLIT5]], [[SPLIT13]] ; CHECK-NEXT: [[TMP6:%.*]] = sub <1 x i32> [[SPLIT6]], [[SPLIT14]] ; CHECK-NEXT: [[TMP7:%.*]] = sub <1 x i32> [[SPLIT7]], [[SPLIT15]] -; CHECK-NEXT: [[SPLIT16:%.*]] = shufflevector <8 x i32> [[C:%.*]], <8 x i32> poison, <8 x i32> -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i32> [[TMP0]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP8:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i32> poison, i32 [[TMP8]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = mul <1 x i32> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK17:%.*]] = shufflevector <1 x i32> [[TMP1]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP10:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT18:%.*]] = insertelement <1 x i32> poison, i32 [[TMP10]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT19:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT18]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP11:%.*]] = mul <1 x i32> [[BLOCK17]], [[SPLAT_SPLAT19]] -; CHECK-NEXT: [[TMP12:%.*]] = add <1 x i32> [[TMP9]], [[TMP11]] -; CHECK-NEXT: [[BLOCK20:%.*]] = shufflevector <1 x i32> [[TMP2]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP13:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT21:%.*]] = insertelement <1 x i32> poison, i32 [[TMP13]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT22:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT21]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP14:%.*]] = mul <1 x i32> [[BLOCK20]], [[SPLAT_SPLAT22]] -; CHECK-NEXT: [[TMP15:%.*]] = add <1 x i32> [[TMP12]], [[TMP14]] -; CHECK-NEXT: [[BLOCK23:%.*]] = shufflevector <1 x i32> [[TMP3]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP16:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT24:%.*]] = insertelement <1 x i32> poison, i32 [[TMP16]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT25:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT24]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP17:%.*]] = mul <1 x i32> [[BLOCK23]], [[SPLAT_SPLAT25]] -; CHECK-NEXT: [[TMP18:%.*]] = add <1 x i32> [[TMP15]], [[TMP17]] -; CHECK-NEXT: [[BLOCK26:%.*]] = shufflevector <1 x i32> [[TMP4]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP19:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 4 -; CHECK-NEXT: [[SPLAT_SPLATINSERT27:%.*]] = insertelement <1 x i32> poison, i32 [[TMP19]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT28:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT27]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP20:%.*]] = mul <1 x i32> [[BLOCK26]], [[SPLAT_SPLAT28]] -; CHECK-NEXT: [[TMP21:%.*]] = add <1 x i32> [[TMP18]], [[TMP20]] -; CHECK-NEXT: [[BLOCK29:%.*]] = shufflevector <1 x i32> [[TMP5]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP22:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 5 -; CHECK-NEXT: [[SPLAT_SPLATINSERT30:%.*]] = insertelement <1 x i32> poison, i32 [[TMP22]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT31:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT30]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP23:%.*]] = mul <1 x i32> [[BLOCK29]], [[SPLAT_SPLAT31]] -; CHECK-NEXT: [[TMP24:%.*]] = add <1 x i32> [[TMP21]], [[TMP23]] -; CHECK-NEXT: [[BLOCK32:%.*]] = shufflevector <1 x i32> [[TMP6]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP25:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 6 -; CHECK-NEXT: [[SPLAT_SPLATINSERT33:%.*]] = insertelement <1 x i32> poison, i32 [[TMP25]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT34:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT33]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP26:%.*]] = mul <1 x i32> [[BLOCK32]], [[SPLAT_SPLAT34]] -; CHECK-NEXT: [[TMP27:%.*]] = add <1 x i32> [[TMP24]], [[TMP26]] -; CHECK-NEXT: [[BLOCK35:%.*]] = shufflevector <1 x i32> [[TMP7]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP28:%.*]] = extractelement <8 x i32> [[SPLIT16]], i64 7 -; CHECK-NEXT: [[SPLAT_SPLATINSERT36:%.*]] = insertelement <1 x i32> poison, i32 [[TMP28]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT37:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT36]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP29:%.*]] = mul <1 x i32> [[BLOCK35]], [[SPLAT_SPLAT37]] -; CHECK-NEXT: [[TMP30:%.*]] = add <1 x i32> [[TMP27]], [[TMP29]] -; CHECK-NEXT: [[TMP31:%.*]] = shufflevector <1 x i32> [[TMP30]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP32:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP31]], <1 x i32> -; CHECK-NEXT: ret <1 x i32> [[TMP32]] +; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <1 x i32> [[TMP0]], <1 x i32> [[TMP1]], <2 x i32> +; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <1 x i32> [[TMP2]], <1 x i32> [[TMP3]], <2 x i32> +; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <1 x i32> [[TMP4]], <1 x i32> [[TMP5]], <2 x i32> +; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <1 x i32> [[TMP6]], <1 x i32> [[TMP7]], <2 x i32> +; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <2 x i32> [[TMP8]], <2 x i32> [[TMP9]], <4 x i32> +; CHECK-NEXT: [[TMP13:%.*]] = shufflevector <2 x i32> [[TMP10]], <2 x i32> [[TMP11]], <4 x i32> +; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <4 x i32> [[TMP12]], <4 x i32> [[TMP13]], <8 x i32> +; CHECK-NEXT: [[TMP15:%.*]] = mul <8 x i32> [[TMP14]], [[C:%.*]] +; CHECK-NEXT: [[TMP16:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> [[TMP15]]) +; CHECK-NEXT: [[TMP17:%.*]] = insertelement <1 x i32> poison, i32 [[TMP16]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP17]] ; entry: %sub = sub <8 x i32> %a, %b @@ -295,57 +215,17 @@ ; CHECK-NEXT: [[TMP13:%.*]] = add <1 x i32> [[TMP5]], [[SPLIT21]] ; CHECK-NEXT: [[TMP14:%.*]] = add <1 x i32> [[TMP6]], [[SPLIT22]] ; CHECK-NEXT: [[TMP15:%.*]] = add <1 x i32> [[TMP7]], [[SPLIT23]] -; CHECK-NEXT: [[SPLIT24:%.*]] = shufflevector <8 x i32> [[D:%.*]], <8 x i32> poison, <8 x i32> -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i32> [[TMP8]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP16:%.*]] = extractelement <8 x i32> [[SPLIT24]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i32> poison, i32 [[TMP16]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP17:%.*]] = mul <1 x i32> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK25:%.*]] = shufflevector <1 x i32> [[TMP9]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP18:%.*]] = extractelement <8 x i32> [[SPLIT24]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT26:%.*]] = insertelement <1 x i32> poison, i32 [[TMP18]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT27:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT26]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP19:%.*]] = mul <1 x i32> [[BLOCK25]], [[SPLAT_SPLAT27]] -; CHECK-NEXT: [[TMP20:%.*]] = add <1 x i32> [[TMP17]], [[TMP19]] -; CHECK-NEXT: [[BLOCK28:%.*]] = shufflevector <1 x i32> [[TMP10]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP21:%.*]] = extractelement <8 x i32> [[SPLIT24]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT29:%.*]] = insertelement <1 x i32> poison, i32 [[TMP21]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT30:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT29]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP22:%.*]] = mul <1 x i32> [[BLOCK28]], [[SPLAT_SPLAT30]] -; CHECK-NEXT: [[TMP23:%.*]] = add <1 x i32> [[TMP20]], [[TMP22]] -; CHECK-NEXT: [[BLOCK31:%.*]] = shufflevector <1 x i32> [[TMP11]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP24:%.*]] = extractelement <8 x i32> [[SPLIT24]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT32:%.*]] = insertelement <1 x i32> poison, i32 [[TMP24]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT33:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT32]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP25:%.*]] = mul <1 x i32> [[BLOCK31]], [[SPLAT_SPLAT33]] -; CHECK-NEXT: [[TMP26:%.*]] = add <1 x i32> [[TMP23]], [[TMP25]] -; CHECK-NEXT: [[BLOCK34:%.*]] = shufflevector <1 x i32> [[TMP12]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP27:%.*]] = extractelement <8 x i32> [[SPLIT24]], i64 4 -; CHECK-NEXT: [[SPLAT_SPLATINSERT35:%.*]] = insertelement <1 x i32> poison, i32 [[TMP27]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT36:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT35]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP28:%.*]] = mul <1 x i32> [[BLOCK34]], [[SPLAT_SPLAT36]] -; CHECK-NEXT: [[TMP29:%.*]] = add <1 x i32> [[TMP26]], [[TMP28]] -; CHECK-NEXT: [[BLOCK37:%.*]] = shufflevector <1 x i32> [[TMP13]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP30:%.*]] = extractelement <8 x i32> [[SPLIT24]], i64 5 -; CHECK-NEXT: [[SPLAT_SPLATINSERT38:%.*]] = insertelement <1 x i32> poison, i32 [[TMP30]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT39:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT38]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP31:%.*]] = mul <1 x i32> [[BLOCK37]], [[SPLAT_SPLAT39]] -; CHECK-NEXT: [[TMP32:%.*]] = add <1 x i32> [[TMP29]], [[TMP31]] -; CHECK-NEXT: [[BLOCK40:%.*]] = shufflevector <1 x i32> [[TMP14]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP33:%.*]] = extractelement <8 x i32> [[SPLIT24]], i64 6 -; CHECK-NEXT: [[SPLAT_SPLATINSERT41:%.*]] = insertelement <1 x i32> poison, i32 [[TMP33]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT42:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT41]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP34:%.*]] = mul <1 x i32> [[BLOCK40]], [[SPLAT_SPLAT42]] -; CHECK-NEXT: [[TMP35:%.*]] = add <1 x i32> [[TMP32]], [[TMP34]] -; CHECK-NEXT: [[BLOCK43:%.*]] = shufflevector <1 x i32> [[TMP15]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP36:%.*]] = extractelement <8 x i32> [[SPLIT24]], i64 7 -; CHECK-NEXT: [[SPLAT_SPLATINSERT44:%.*]] = insertelement <1 x i32> poison, i32 [[TMP36]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT45:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT44]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP37:%.*]] = mul <1 x i32> [[BLOCK43]], [[SPLAT_SPLAT45]] -; CHECK-NEXT: [[TMP38:%.*]] = add <1 x i32> [[TMP35]], [[TMP37]] -; CHECK-NEXT: [[TMP39:%.*]] = shufflevector <1 x i32> [[TMP38]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP40:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP39]], <1 x i32> -; CHECK-NEXT: ret <1 x i32> [[TMP40]] +; CHECK-NEXT: [[TMP16:%.*]] = shufflevector <1 x i32> [[TMP8]], <1 x i32> [[TMP9]], <2 x i32> +; CHECK-NEXT: [[TMP17:%.*]] = shufflevector <1 x i32> [[TMP10]], <1 x i32> [[TMP11]], <2 x i32> +; CHECK-NEXT: [[TMP18:%.*]] = shufflevector <1 x i32> [[TMP12]], <1 x i32> [[TMP13]], <2 x i32> +; CHECK-NEXT: [[TMP19:%.*]] = shufflevector <1 x i32> [[TMP14]], <1 x i32> [[TMP15]], <2 x i32> +; CHECK-NEXT: [[TMP20:%.*]] = shufflevector <2 x i32> [[TMP16]], <2 x i32> [[TMP17]], <4 x i32> +; CHECK-NEXT: [[TMP21:%.*]] = shufflevector <2 x i32> [[TMP18]], <2 x i32> [[TMP19]], <4 x i32> +; CHECK-NEXT: [[TMP22:%.*]] = shufflevector <4 x i32> [[TMP20]], <4 x i32> [[TMP21]], <8 x i32> +; CHECK-NEXT: [[TMP23:%.*]] = mul <8 x i32> [[TMP22]], [[D:%.*]] +; CHECK-NEXT: [[TMP24:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> [[TMP23]]) +; CHECK-NEXT: [[TMP25:%.*]] = insertelement <1 x i32> poison, i32 [[TMP24]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP25]] ; entry: %add.1 = add <8 x i32> %a, %b @@ -377,10 +257,65 @@ define <1 x i64> @dotproduct_i64_v8(<8 x i64> %a, <8 x i64> %b) { ; CHECK-LABEL: @dotproduct_i64_v8( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = mul <8 x i64> [[A:%.*]], [[B:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> [[TMP0]]) -; CHECK-NEXT: [[TMP2:%.*]] = insertelement <1 x i64> poison, i64 [[TMP1]], i64 0 -; CHECK-NEXT: ret <1 x i64> [[TMP2]] +; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x i64> [[A:%.*]], <8 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <8 x i64> [[A]], <8 x i64> poison, <1 x i32> +; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <8 x i64> [[A]], <8 x i64> poison, <1 x i32> +; CHECK-NEXT: [[SPLIT3:%.*]] = shufflevector <8 x i64> [[A]], <8 x i64> poison, <1 x i32> +; CHECK-NEXT: [[SPLIT4:%.*]] = shufflevector <8 x i64> [[A]], <8 x i64> poison, <1 x i32> +; CHECK-NEXT: [[SPLIT5:%.*]] = shufflevector <8 x i64> [[A]], <8 x i64> poison, <1 x i32> +; CHECK-NEXT: [[SPLIT6:%.*]] = shufflevector <8 x i64> [[A]], <8 x i64> poison, <1 x i32> +; CHECK-NEXT: [[SPLIT7:%.*]] = shufflevector <8 x i64> [[A]], <8 x i64> poison, <1 x i32> +; CHECK-NEXT: [[SPLIT8:%.*]] = shufflevector <8 x i64> [[B:%.*]], <8 x i64> poison, <8 x i32> +; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i64> [[SPLIT]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP0:%.*]] = extractelement <8 x i64> [[SPLIT8]], i64 0 +; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i64> poison, i64 [[TMP0]], i64 0 +; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i64> [[SPLAT_SPLATINSERT]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP1:%.*]] = mul <1 x i64> [[BLOCK]], [[SPLAT_SPLAT]] +; CHECK-NEXT: [[BLOCK9:%.*]] = shufflevector <1 x i64> [[SPLIT1]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP2:%.*]] = extractelement <8 x i64> [[SPLIT8]], i64 1 +; CHECK-NEXT: [[SPLAT_SPLATINSERT10:%.*]] = insertelement <1 x i64> poison, i64 [[TMP2]], i64 0 +; CHECK-NEXT: [[SPLAT_SPLAT11:%.*]] = shufflevector <1 x i64> [[SPLAT_SPLATINSERT10]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP3:%.*]] = mul <1 x i64> [[BLOCK9]], [[SPLAT_SPLAT11]] +; CHECK-NEXT: [[TMP4:%.*]] = add <1 x i64> [[TMP1]], [[TMP3]] +; CHECK-NEXT: [[BLOCK12:%.*]] = shufflevector <1 x i64> [[SPLIT2]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP5:%.*]] = extractelement <8 x i64> [[SPLIT8]], i64 2 +; CHECK-NEXT: [[SPLAT_SPLATINSERT13:%.*]] = insertelement <1 x i64> poison, i64 [[TMP5]], i64 0 +; CHECK-NEXT: [[SPLAT_SPLAT14:%.*]] = shufflevector <1 x i64> [[SPLAT_SPLATINSERT13]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP6:%.*]] = mul <1 x i64> [[BLOCK12]], [[SPLAT_SPLAT14]] +; CHECK-NEXT: [[TMP7:%.*]] = add <1 x i64> [[TMP4]], [[TMP6]] +; CHECK-NEXT: [[BLOCK15:%.*]] = shufflevector <1 x i64> [[SPLIT3]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP8:%.*]] = extractelement <8 x i64> [[SPLIT8]], i64 3 +; CHECK-NEXT: [[SPLAT_SPLATINSERT16:%.*]] = insertelement <1 x i64> poison, i64 [[TMP8]], i64 0 +; CHECK-NEXT: [[SPLAT_SPLAT17:%.*]] = shufflevector <1 x i64> [[SPLAT_SPLATINSERT16]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP9:%.*]] = mul <1 x i64> [[BLOCK15]], [[SPLAT_SPLAT17]] +; CHECK-NEXT: [[TMP10:%.*]] = add <1 x i64> [[TMP7]], [[TMP9]] +; CHECK-NEXT: [[BLOCK18:%.*]] = shufflevector <1 x i64> [[SPLIT4]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP11:%.*]] = extractelement <8 x i64> [[SPLIT8]], i64 4 +; CHECK-NEXT: [[SPLAT_SPLATINSERT19:%.*]] = insertelement <1 x i64> poison, i64 [[TMP11]], i64 0 +; CHECK-NEXT: [[SPLAT_SPLAT20:%.*]] = shufflevector <1 x i64> [[SPLAT_SPLATINSERT19]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP12:%.*]] = mul <1 x i64> [[BLOCK18]], [[SPLAT_SPLAT20]] +; CHECK-NEXT: [[TMP13:%.*]] = add <1 x i64> [[TMP10]], [[TMP12]] +; CHECK-NEXT: [[BLOCK21:%.*]] = shufflevector <1 x i64> [[SPLIT5]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP14:%.*]] = extractelement <8 x i64> [[SPLIT8]], i64 5 +; CHECK-NEXT: [[SPLAT_SPLATINSERT22:%.*]] = insertelement <1 x i64> poison, i64 [[TMP14]], i64 0 +; CHECK-NEXT: [[SPLAT_SPLAT23:%.*]] = shufflevector <1 x i64> [[SPLAT_SPLATINSERT22]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP15:%.*]] = mul <1 x i64> [[BLOCK21]], [[SPLAT_SPLAT23]] +; CHECK-NEXT: [[TMP16:%.*]] = add <1 x i64> [[TMP13]], [[TMP15]] +; CHECK-NEXT: [[BLOCK24:%.*]] = shufflevector <1 x i64> [[SPLIT6]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP17:%.*]] = extractelement <8 x i64> [[SPLIT8]], i64 6 +; CHECK-NEXT: [[SPLAT_SPLATINSERT25:%.*]] = insertelement <1 x i64> poison, i64 [[TMP17]], i64 0 +; CHECK-NEXT: [[SPLAT_SPLAT26:%.*]] = shufflevector <1 x i64> [[SPLAT_SPLATINSERT25]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP18:%.*]] = mul <1 x i64> [[BLOCK24]], [[SPLAT_SPLAT26]] +; CHECK-NEXT: [[TMP19:%.*]] = add <1 x i64> [[TMP16]], [[TMP18]] +; CHECK-NEXT: [[BLOCK27:%.*]] = shufflevector <1 x i64> [[SPLIT7]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP20:%.*]] = extractelement <8 x i64> [[SPLIT8]], i64 7 +; CHECK-NEXT: [[SPLAT_SPLATINSERT28:%.*]] = insertelement <1 x i64> poison, i64 [[TMP20]], i64 0 +; CHECK-NEXT: [[SPLAT_SPLAT29:%.*]] = shufflevector <1 x i64> [[SPLAT_SPLATINSERT28]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP21:%.*]] = mul <1 x i64> [[BLOCK27]], [[SPLAT_SPLAT29]] +; CHECK-NEXT: [[TMP22:%.*]] = add <1 x i64> [[TMP19]], [[TMP21]] +; CHECK-NEXT: [[TMP23:%.*]] = shufflevector <1 x i64> [[TMP22]], <1 x i64> poison, <1 x i32> zeroinitializer +; CHECK-NEXT: [[TMP24:%.*]] = shufflevector <1 x i64> undef, <1 x i64> [[TMP23]], <1 x i32> +; CHECK-NEXT: ret <1 x i64> [[TMP24]] ; entry: %c = tail call <1 x i64> @llvm.matrix.multiply.v1i64.v8i64.v8i64(<8 x i64> %a, <8 x i64> %b, i32 1, i32 8, i32 1) @@ -420,33 +355,14 @@ ; CHECK-NEXT: [[COL_LOAD3:%.*]] = load <1 x i32>, ptr [[VEC_GEP2]], align 4 ; CHECK-NEXT: [[VEC_GEP4:%.*]] = getelementptr i32, ptr [[LHS_ADDRESS]], i64 12 ; CHECK-NEXT: [[COL_LOAD5:%.*]] = load <1 x i32>, ptr [[VEC_GEP4]], align 4 +; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> [[COL_LOAD1]], <2 x i32> +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> [[COL_LOAD5]], <2 x i32> +; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i32> [[TMP0]], <2 x i32> [[TMP1]], <4 x i32> ; CHECK-NEXT: [[COL_LOAD6:%.*]] = load <4 x i32>, ptr [[RHS_ADDRESS:%.*]], align 4 -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP0:%.*]] = extractelement <4 x i32> [[COL_LOAD6]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i32> poison, i32 [[TMP0]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP1:%.*]] = mul <1 x i32> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK7:%.*]] = shufflevector <1 x i32> [[COL_LOAD1]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP2:%.*]] = extractelement <4 x i32> [[COL_LOAD6]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT8:%.*]] = insertelement <1 x i32> poison, i32 [[TMP2]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT9:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT8]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP3:%.*]] = mul <1 x i32> [[BLOCK7]], [[SPLAT_SPLAT9]] -; CHECK-NEXT: [[TMP4:%.*]] = add <1 x i32> [[TMP1]], [[TMP3]] -; CHECK-NEXT: [[BLOCK10:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP5:%.*]] = extractelement <4 x i32> [[COL_LOAD6]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT11:%.*]] = insertelement <1 x i32> poison, i32 [[TMP5]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT12:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT11]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP6:%.*]] = mul <1 x i32> [[BLOCK10]], [[SPLAT_SPLAT12]] -; CHECK-NEXT: [[TMP7:%.*]] = add <1 x i32> [[TMP4]], [[TMP6]] -; CHECK-NEXT: [[BLOCK13:%.*]] = shufflevector <1 x i32> [[COL_LOAD5]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP8:%.*]] = extractelement <4 x i32> [[COL_LOAD6]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT14:%.*]] = insertelement <1 x i32> poison, i32 [[TMP8]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT15:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT14]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = mul <1 x i32> [[BLOCK13]], [[SPLAT_SPLAT15]] -; CHECK-NEXT: [[TMP10:%.*]] = add <1 x i32> [[TMP7]], [[TMP9]] -; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <1 x i32> [[TMP10]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP11]], <1 x i32> -; CHECK-NEXT: ret <1 x i32> [[TMP12]] +; CHECK-NEXT: [[TMP3:%.*]] = mul <4 x i32> [[TMP2]], [[COL_LOAD6]] +; CHECK-NEXT: [[TMP4:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP3]]) +; CHECK-NEXT: [[TMP5:%.*]] = insertelement <1 x i32> poison, i32 [[TMP4]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP5]] ; entry: %lhs = tail call <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(ptr nonnull align 4 %lhs_address, i64 4, i1 false, i32 1, i32 4) @@ -468,33 +384,14 @@ ; CHECK-NEXT: [[COL_LOAD3:%.*]] = load <1 x i32>, ptr [[VEC_GEP2]], align 4 ; CHECK-NEXT: [[VEC_GEP4:%.*]] = getelementptr i32, ptr [[LHS_ADDRESS]], i64 15 ; CHECK-NEXT: [[COL_LOAD5:%.*]] = load <1 x i32>, ptr [[VEC_GEP4]], align 4 +; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> [[COL_LOAD1]], <2 x i32> +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> [[COL_LOAD5]], <2 x i32> +; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i32> [[TMP0]], <2 x i32> [[TMP1]], <4 x i32> ; CHECK-NEXT: [[COL_LOAD6:%.*]] = load <4 x i32>, ptr [[RHS_ADDRESS:%.*]], align 4 -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP0:%.*]] = extractelement <4 x i32> [[COL_LOAD6]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i32> poison, i32 [[TMP0]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP1:%.*]] = mul <1 x i32> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK7:%.*]] = shufflevector <1 x i32> [[COL_LOAD1]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP2:%.*]] = extractelement <4 x i32> [[COL_LOAD6]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT8:%.*]] = insertelement <1 x i32> poison, i32 [[TMP2]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT9:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT8]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP3:%.*]] = mul <1 x i32> [[BLOCK7]], [[SPLAT_SPLAT9]] -; CHECK-NEXT: [[TMP4:%.*]] = add <1 x i32> [[TMP1]], [[TMP3]] -; CHECK-NEXT: [[BLOCK10:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP5:%.*]] = extractelement <4 x i32> [[COL_LOAD6]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT11:%.*]] = insertelement <1 x i32> poison, i32 [[TMP5]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT12:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT11]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP6:%.*]] = mul <1 x i32> [[BLOCK10]], [[SPLAT_SPLAT12]] -; CHECK-NEXT: [[TMP7:%.*]] = add <1 x i32> [[TMP4]], [[TMP6]] -; CHECK-NEXT: [[BLOCK13:%.*]] = shufflevector <1 x i32> [[COL_LOAD5]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP8:%.*]] = extractelement <4 x i32> [[COL_LOAD6]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT14:%.*]] = insertelement <1 x i32> poison, i32 [[TMP8]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT15:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT14]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = mul <1 x i32> [[BLOCK13]], [[SPLAT_SPLAT15]] -; CHECK-NEXT: [[TMP10:%.*]] = add <1 x i32> [[TMP7]], [[TMP9]] -; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <1 x i32> [[TMP10]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP11]], <1 x i32> -; CHECK-NEXT: ret <1 x i32> [[TMP12]] +; CHECK-NEXT: [[TMP3:%.*]] = mul <4 x i32> [[TMP2]], [[COL_LOAD6]] +; CHECK-NEXT: [[TMP4:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP3]]) +; CHECK-NEXT: [[TMP5:%.*]] = insertelement <1 x i32> poison, i32 [[TMP4]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP5]] ; entry: %lhs = tail call <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(ptr nonnull align 4 %lhs_address, i64 5, i1 false, i32 1, i32 4) @@ -544,23 +441,9 @@ ; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <2 x i32> [[TMP7]], <2 x i32> poison, <2 x i32> ; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <2 x i32> undef, <2 x i32> [[TMP8]], <2 x i32> ; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <2 x i32> [[TMP4]], <2 x i32> [[TMP9]], <4 x i32> -; CHECK-NEXT: [[SPLIT5:%.*]] = shufflevector <4 x i32> [[TMP10]], <4 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[SPLIT6:%.*]] = shufflevector <4 x i32> [[TMP10]], <4 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT7:%.*]] = shufflevector <4 x i32> [[TMP10]], <4 x i32> poison, <1 x i32> -; CHECK-NEXT: [[SPLIT8:%.*]] = shufflevector <4 x i32> [[TMP10]], <4 x i32> poison, <1 x i32> -; CHECK-NEXT: [[BLOCK9:%.*]] = shufflevector <1 x i32> [[SPLIT5]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP11:%.*]] = mul <1 x i32> [[BLOCK9]], zeroinitializer -; CHECK-NEXT: [[BLOCK10:%.*]] = shufflevector <1 x i32> [[SPLIT6]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP12:%.*]] = mul <1 x i32> [[BLOCK10]], zeroinitializer -; CHECK-NEXT: [[TMP13:%.*]] = add <1 x i32> [[TMP11]], [[TMP12]] -; CHECK-NEXT: [[BLOCK11:%.*]] = shufflevector <1 x i32> [[SPLIT7]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP14:%.*]] = mul <1 x i32> [[BLOCK11]], zeroinitializer -; CHECK-NEXT: [[TMP15:%.*]] = add <1 x i32> [[TMP13]], [[TMP14]] -; CHECK-NEXT: [[BLOCK12:%.*]] = shufflevector <1 x i32> [[SPLIT8]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP16:%.*]] = mul <1 x i32> [[BLOCK12]], zeroinitializer -; CHECK-NEXT: [[TMP17:%.*]] = add <1 x i32> [[TMP15]], [[TMP16]] -; CHECK-NEXT: [[TMP18:%.*]] = shufflevector <1 x i32> [[TMP17]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP19:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP18]], <1 x i32> +; CHECK-NEXT: [[TMP11:%.*]] = mul <4 x i32> [[TMP10]], zeroinitializer +; CHECK-NEXT: [[TMP12:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP11]]) +; CHECK-NEXT: [[TMP13:%.*]] = insertelement <1 x i32> poison, i32 [[TMP12]], i64 0 ; CHECK-NEXT: ret void ; entry: @@ -584,42 +467,22 @@ ; CHECK-NEXT: [[COL_LOAD3:%.*]] = load <1 x i32>, ptr [[VEC_GEP2]], align 8 ; CHECK-NEXT: [[VEC_GEP4:%.*]] = getelementptr i32, ptr [[SRC]], i64 3 ; CHECK-NEXT: [[COL_LOAD5:%.*]] = load <1 x i32>, ptr [[VEC_GEP4]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = extractelement <1 x i32> [[COL_LOAD]], i64 0 -; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i32> poison, i32 [[TMP1]], i64 0 -; CHECK-NEXT: [[TMP3:%.*]] = extractelement <1 x i32> [[COL_LOAD1]], i64 0 -; CHECK-NEXT: [[TMP4:%.*]] = insertelement <4 x i32> [[TMP2]], i32 [[TMP3]], i64 1 -; CHECK-NEXT: [[TMP5:%.*]] = extractelement <1 x i32> [[COL_LOAD3]], i64 0 -; CHECK-NEXT: [[TMP6:%.*]] = insertelement <4 x i32> [[TMP4]], i32 [[TMP5]], i64 2 -; CHECK-NEXT: [[TMP7:%.*]] = extractelement <1 x i32> [[COL_LOAD5]], i64 0 -; CHECK-NEXT: [[TMP8:%.*]] = insertelement <4 x i32> [[TMP6]], i32 [[TMP7]], i64 3 -; CHECK-NEXT: call void @use.v4i32(<4 x i32> [[TMP8]]) -; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x i32> [[B:%.*]], <4 x i32> poison, <4 x i32> -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i32> poison, i32 [[TMP9]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP10:%.*]] = mul <1 x i32> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK6:%.*]] = shufflevector <1 x i32> [[COL_LOAD1]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP11:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT7:%.*]] = insertelement <1 x i32> poison, i32 [[TMP11]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT8:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT7]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP12:%.*]] = mul <1 x i32> [[BLOCK6]], [[SPLAT_SPLAT8]] -; CHECK-NEXT: [[TMP13:%.*]] = add <1 x i32> [[TMP10]], [[TMP12]] -; CHECK-NEXT: [[BLOCK9:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP14:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT10:%.*]] = insertelement <1 x i32> poison, i32 [[TMP14]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT11:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT10]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP15:%.*]] = mul <1 x i32> [[BLOCK9]], [[SPLAT_SPLAT11]] -; CHECK-NEXT: [[TMP16:%.*]] = add <1 x i32> [[TMP13]], [[TMP15]] -; CHECK-NEXT: [[BLOCK12:%.*]] = shufflevector <1 x i32> [[COL_LOAD5]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP17:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT13:%.*]] = insertelement <1 x i32> poison, i32 [[TMP17]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT14:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT13]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP18:%.*]] = mul <1 x i32> [[BLOCK12]], [[SPLAT_SPLAT14]] -; CHECK-NEXT: [[TMP19:%.*]] = add <1 x i32> [[TMP16]], [[TMP18]] -; CHECK-NEXT: [[TMP20:%.*]] = shufflevector <1 x i32> [[TMP19]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP21:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP20]], <1 x i32> -; CHECK-NEXT: ret <1 x i32> [[TMP21]] +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> [[COL_LOAD1]], <2 x i32> +; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> [[COL_LOAD5]], <2 x i32> +; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> [[TMP2]], <4 x i32> +; CHECK-NEXT: [[TMP4:%.*]] = extractelement <1 x i32> [[COL_LOAD]], i64 0 +; CHECK-NEXT: [[TMP5:%.*]] = insertelement <4 x i32> poison, i32 [[TMP4]], i64 0 +; CHECK-NEXT: [[TMP6:%.*]] = extractelement <1 x i32> [[COL_LOAD1]], i64 0 +; CHECK-NEXT: [[TMP7:%.*]] = insertelement <4 x i32> [[TMP5]], i32 [[TMP6]], i64 1 +; CHECK-NEXT: [[TMP8:%.*]] = extractelement <1 x i32> [[COL_LOAD3]], i64 0 +; CHECK-NEXT: [[TMP9:%.*]] = insertelement <4 x i32> [[TMP7]], i32 [[TMP8]], i64 2 +; CHECK-NEXT: [[TMP10:%.*]] = extractelement <1 x i32> [[COL_LOAD5]], i64 0 +; CHECK-NEXT: [[TMP11:%.*]] = insertelement <4 x i32> [[TMP9]], i32 [[TMP10]], i64 3 +; CHECK-NEXT: call void @use.v4i32(<4 x i32> [[TMP11]]) +; CHECK-NEXT: [[TMP12:%.*]] = mul <4 x i32> [[TMP3]], [[B:%.*]] +; CHECK-NEXT: [[TMP13:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP12]]) +; CHECK-NEXT: [[TMP14:%.*]] = insertelement <1 x i32> poison, i32 [[TMP13]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP14]] ; %l = load <4 x i32>, ptr %src %t = call <4 x i32> @llvm.matrix.transpose.v4i32(<4 x i32> %l, i32 1, i32 4) @@ -636,42 +499,22 @@ ; CHECK-NEXT: [[COL_LOAD3:%.*]] = load <1 x i32>, ptr [[VEC_GEP2]], align 4 ; CHECK-NEXT: [[VEC_GEP4:%.*]] = getelementptr i32, ptr [[SRC]], i64 3 ; CHECK-NEXT: [[COL_LOAD5:%.*]] = load <1 x i32>, ptr [[VEC_GEP4]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = extractelement <1 x i32> [[COL_LOAD]], i64 0 -; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i32> poison, i32 [[TMP1]], i64 0 -; CHECK-NEXT: [[TMP3:%.*]] = extractelement <1 x i32> [[COL_LOAD1]], i64 0 -; CHECK-NEXT: [[TMP4:%.*]] = insertelement <4 x i32> [[TMP2]], i32 [[TMP3]], i64 1 -; CHECK-NEXT: [[TMP5:%.*]] = extractelement <1 x i32> [[COL_LOAD3]], i64 0 -; CHECK-NEXT: [[TMP6:%.*]] = insertelement <4 x i32> [[TMP4]], i32 [[TMP5]], i64 2 -; CHECK-NEXT: [[TMP7:%.*]] = extractelement <1 x i32> [[COL_LOAD5]], i64 0 -; CHECK-NEXT: [[TMP8:%.*]] = insertelement <4 x i32> [[TMP6]], i32 [[TMP7]], i64 3 -; CHECK-NEXT: call void @use.v4i32(<4 x i32> [[TMP8]]) -; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x i32> [[B:%.*]], <4 x i32> poison, <4 x i32> -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i32> poison, i32 [[TMP9]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP10:%.*]] = mul <1 x i32> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK6:%.*]] = shufflevector <1 x i32> [[COL_LOAD1]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP11:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT7:%.*]] = insertelement <1 x i32> poison, i32 [[TMP11]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT8:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT7]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP12:%.*]] = mul <1 x i32> [[BLOCK6]], [[SPLAT_SPLAT8]] -; CHECK-NEXT: [[TMP13:%.*]] = add <1 x i32> [[TMP10]], [[TMP12]] -; CHECK-NEXT: [[BLOCK9:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP14:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT10:%.*]] = insertelement <1 x i32> poison, i32 [[TMP14]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT11:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT10]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP15:%.*]] = mul <1 x i32> [[BLOCK9]], [[SPLAT_SPLAT11]] -; CHECK-NEXT: [[TMP16:%.*]] = add <1 x i32> [[TMP13]], [[TMP15]] -; CHECK-NEXT: [[BLOCK12:%.*]] = shufflevector <1 x i32> [[COL_LOAD5]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP17:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT13:%.*]] = insertelement <1 x i32> poison, i32 [[TMP17]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT14:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT13]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP18:%.*]] = mul <1 x i32> [[BLOCK12]], [[SPLAT_SPLAT14]] -; CHECK-NEXT: [[TMP19:%.*]] = add <1 x i32> [[TMP16]], [[TMP18]] -; CHECK-NEXT: [[TMP20:%.*]] = shufflevector <1 x i32> [[TMP19]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP21:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP20]], <1 x i32> -; CHECK-NEXT: ret <1 x i32> [[TMP21]] +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> [[COL_LOAD1]], <2 x i32> +; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> [[COL_LOAD5]], <2 x i32> +; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> [[TMP2]], <4 x i32> +; CHECK-NEXT: [[TMP4:%.*]] = extractelement <1 x i32> [[COL_LOAD]], i64 0 +; CHECK-NEXT: [[TMP5:%.*]] = insertelement <4 x i32> poison, i32 [[TMP4]], i64 0 +; CHECK-NEXT: [[TMP6:%.*]] = extractelement <1 x i32> [[COL_LOAD1]], i64 0 +; CHECK-NEXT: [[TMP7:%.*]] = insertelement <4 x i32> [[TMP5]], i32 [[TMP6]], i64 1 +; CHECK-NEXT: [[TMP8:%.*]] = extractelement <1 x i32> [[COL_LOAD3]], i64 0 +; CHECK-NEXT: [[TMP9:%.*]] = insertelement <4 x i32> [[TMP7]], i32 [[TMP8]], i64 2 +; CHECK-NEXT: [[TMP10:%.*]] = extractelement <1 x i32> [[COL_LOAD5]], i64 0 +; CHECK-NEXT: [[TMP11:%.*]] = insertelement <4 x i32> [[TMP9]], i32 [[TMP10]], i64 3 +; CHECK-NEXT: call void @use.v4i32(<4 x i32> [[TMP11]]) +; CHECK-NEXT: [[TMP12:%.*]] = mul <4 x i32> [[TMP3]], [[B:%.*]] +; CHECK-NEXT: [[TMP13:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP12]]) +; CHECK-NEXT: [[TMP14:%.*]] = insertelement <1 x i32> poison, i32 [[TMP13]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP14]] ; %l = call <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(ptr %src, i64 1, i1 false, i32 1, i32 4) %t = call <4 x i32> @llvm.matrix.transpose.v4i32(<4 x i32> %l, i32 1, i32 4) @@ -696,33 +539,13 @@ ; CHECK-NEXT: [[VEC_START7:%.*]] = mul i64 3, [[STRIDE]] ; CHECK-NEXT: [[VEC_GEP8:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[VEC_START7]] ; CHECK-NEXT: [[COL_LOAD9:%.*]] = load <1 x i32>, ptr [[VEC_GEP8]], align 4 -; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <4 x i32> [[A:%.*]], <4 x i32> poison, <4 x i32> -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP1:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i32> poison, i32 [[TMP1]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP2:%.*]] = mul <1 x i32> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK10:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP3:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT11:%.*]] = insertelement <1 x i32> poison, i32 [[TMP3]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT12:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT11]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP4:%.*]] = mul <1 x i32> [[BLOCK10]], [[SPLAT_SPLAT12]] -; CHECK-NEXT: [[TMP5:%.*]] = add <1 x i32> [[TMP2]], [[TMP4]] -; CHECK-NEXT: [[BLOCK13:%.*]] = shufflevector <1 x i32> [[COL_LOAD6]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP6:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT14:%.*]] = insertelement <1 x i32> poison, i32 [[TMP6]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT15:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT14]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP7:%.*]] = mul <1 x i32> [[BLOCK13]], [[SPLAT_SPLAT15]] -; CHECK-NEXT: [[TMP8:%.*]] = add <1 x i32> [[TMP5]], [[TMP7]] -; CHECK-NEXT: [[BLOCK16:%.*]] = shufflevector <1 x i32> [[COL_LOAD9]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP9:%.*]] = extractelement <4 x i32> [[SPLIT]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT17:%.*]] = insertelement <1 x i32> poison, i32 [[TMP9]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT18:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT17]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP10:%.*]] = mul <1 x i32> [[BLOCK16]], [[SPLAT_SPLAT18]] -; CHECK-NEXT: [[TMP11:%.*]] = add <1 x i32> [[TMP8]], [[TMP10]] -; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <1 x i32> [[TMP11]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP13:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP12]], <1 x i32> -; CHECK-NEXT: ret <1 x i32> [[TMP13]] +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> [[COL_LOAD3]], <2 x i32> +; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <1 x i32> [[COL_LOAD6]], <1 x i32> [[COL_LOAD9]], <2 x i32> +; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> [[TMP2]], <4 x i32> +; CHECK-NEXT: [[TMP4:%.*]] = mul <4 x i32> [[TMP3]], [[A:%.*]] +; CHECK-NEXT: [[TMP5:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP4]]) +; CHECK-NEXT: [[TMP6:%.*]] = insertelement <1 x i32> poison, i32 [[TMP5]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP6]] ; %l = call <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(ptr %src, i64 %stride, i1 false, i32 1, i32 4) %r = call <1 x i32> @llvm.matrix.multiply.v1i32.v4i32.v4i32(<4 x i32> %l, <4 x i32> %a, i32 1, i32 4, i32 1) @@ -746,50 +569,26 @@ ; CHECK-NEXT: [[VEC_START10:%.*]] = mul i64 4, [[STRIDE]] ; CHECK-NEXT: [[VEC_GEP11:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[VEC_START10]] ; CHECK-NEXT: [[COL_LOAD12:%.*]] = load <1 x i32>, ptr [[VEC_GEP11]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = extractelement <1 x i32> [[COL_LOAD]], i64 0 -; CHECK-NEXT: [[TMP2:%.*]] = insertelement <5 x i32> poison, i32 [[TMP1]], i64 0 -; CHECK-NEXT: [[TMP3:%.*]] = extractelement <1 x i32> [[COL_LOAD3]], i64 0 -; CHECK-NEXT: [[TMP4:%.*]] = insertelement <5 x i32> [[TMP2]], i32 [[TMP3]], i64 1 -; CHECK-NEXT: [[TMP5:%.*]] = extractelement <1 x i32> [[COL_LOAD6]], i64 0 -; CHECK-NEXT: [[TMP6:%.*]] = insertelement <5 x i32> [[TMP4]], i32 [[TMP5]], i64 2 -; CHECK-NEXT: [[TMP7:%.*]] = extractelement <1 x i32> [[COL_LOAD9]], i64 0 -; CHECK-NEXT: [[TMP8:%.*]] = insertelement <5 x i32> [[TMP6]], i32 [[TMP7]], i64 3 -; CHECK-NEXT: [[TMP9:%.*]] = extractelement <1 x i32> [[COL_LOAD12]], i64 0 -; CHECK-NEXT: [[TMP10:%.*]] = insertelement <5 x i32> [[TMP8]], i32 [[TMP9]], i64 4 -; CHECK-NEXT: call void @use.v5i32(<5 x i32> [[TMP10]]) -; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <5 x i32> [[A:%.*]], <5 x i32> poison, <5 x i32> -; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP11:%.*]] = extractelement <5 x i32> [[SPLIT]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <1 x i32> poison, i32 [[TMP11]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP12:%.*]] = mul <1 x i32> [[BLOCK]], [[SPLAT_SPLAT]] -; CHECK-NEXT: [[BLOCK13:%.*]] = shufflevector <1 x i32> [[COL_LOAD3]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP13:%.*]] = extractelement <5 x i32> [[SPLIT]], i64 1 -; CHECK-NEXT: [[SPLAT_SPLATINSERT14:%.*]] = insertelement <1 x i32> poison, i32 [[TMP13]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT15:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT14]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP14:%.*]] = mul <1 x i32> [[BLOCK13]], [[SPLAT_SPLAT15]] -; CHECK-NEXT: [[TMP15:%.*]] = add <1 x i32> [[TMP12]], [[TMP14]] -; CHECK-NEXT: [[BLOCK16:%.*]] = shufflevector <1 x i32> [[COL_LOAD6]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP16:%.*]] = extractelement <5 x i32> [[SPLIT]], i64 2 -; CHECK-NEXT: [[SPLAT_SPLATINSERT17:%.*]] = insertelement <1 x i32> poison, i32 [[TMP16]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT18:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT17]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP17:%.*]] = mul <1 x i32> [[BLOCK16]], [[SPLAT_SPLAT18]] -; CHECK-NEXT: [[TMP18:%.*]] = add <1 x i32> [[TMP15]], [[TMP17]] -; CHECK-NEXT: [[BLOCK19:%.*]] = shufflevector <1 x i32> [[COL_LOAD9]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP19:%.*]] = extractelement <5 x i32> [[SPLIT]], i64 3 -; CHECK-NEXT: [[SPLAT_SPLATINSERT20:%.*]] = insertelement <1 x i32> poison, i32 [[TMP19]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT21:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT20]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP20:%.*]] = mul <1 x i32> [[BLOCK19]], [[SPLAT_SPLAT21]] -; CHECK-NEXT: [[TMP21:%.*]] = add <1 x i32> [[TMP18]], [[TMP20]] -; CHECK-NEXT: [[BLOCK22:%.*]] = shufflevector <1 x i32> [[COL_LOAD12]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP22:%.*]] = extractelement <5 x i32> [[SPLIT]], i64 4 -; CHECK-NEXT: [[SPLAT_SPLATINSERT23:%.*]] = insertelement <1 x i32> poison, i32 [[TMP22]], i64 0 -; CHECK-NEXT: [[SPLAT_SPLAT24:%.*]] = shufflevector <1 x i32> [[SPLAT_SPLATINSERT23]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP23:%.*]] = mul <1 x i32> [[BLOCK22]], [[SPLAT_SPLAT24]] -; CHECK-NEXT: [[TMP24:%.*]] = add <1 x i32> [[TMP21]], [[TMP23]] -; CHECK-NEXT: [[TMP25:%.*]] = shufflevector <1 x i32> [[TMP24]], <1 x i32> poison, <1 x i32> zeroinitializer -; CHECK-NEXT: [[TMP26:%.*]] = shufflevector <1 x i32> undef, <1 x i32> [[TMP25]], <1 x i32> -; CHECK-NEXT: ret <1 x i32> [[TMP26]] +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <1 x i32> [[COL_LOAD]], <1 x i32> [[COL_LOAD3]], <2 x i32> +; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <1 x i32> [[COL_LOAD6]], <1 x i32> [[COL_LOAD9]], <2 x i32> +; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> [[TMP2]], <4 x i32> +; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <1 x i32> [[COL_LOAD12]], <1 x i32> poison, <4 x i32> +; CHECK-NEXT: [[TMP5:%.*]] = shufflevector <4 x i32> [[TMP3]], <4 x i32> [[TMP4]], <5 x i32> +; CHECK-NEXT: [[TMP6:%.*]] = extractelement <1 x i32> [[COL_LOAD]], i64 0 +; CHECK-NEXT: [[TMP7:%.*]] = insertelement <5 x i32> poison, i32 [[TMP6]], i64 0 +; CHECK-NEXT: [[TMP8:%.*]] = extractelement <1 x i32> [[COL_LOAD3]], i64 0 +; CHECK-NEXT: [[TMP9:%.*]] = insertelement <5 x i32> [[TMP7]], i32 [[TMP8]], i64 1 +; CHECK-NEXT: [[TMP10:%.*]] = extractelement <1 x i32> [[COL_LOAD6]], i64 0 +; CHECK-NEXT: [[TMP11:%.*]] = insertelement <5 x i32> [[TMP9]], i32 [[TMP10]], i64 2 +; CHECK-NEXT: [[TMP12:%.*]] = extractelement <1 x i32> [[COL_LOAD9]], i64 0 +; CHECK-NEXT: [[TMP13:%.*]] = insertelement <5 x i32> [[TMP11]], i32 [[TMP12]], i64 3 +; CHECK-NEXT: [[TMP14:%.*]] = extractelement <1 x i32> [[COL_LOAD12]], i64 0 +; CHECK-NEXT: [[TMP15:%.*]] = insertelement <5 x i32> [[TMP13]], i32 [[TMP14]], i64 4 +; CHECK-NEXT: call void @use.v5i32(<5 x i32> [[TMP15]]) +; CHECK-NEXT: [[TMP16:%.*]] = mul <5 x i32> [[TMP5]], [[A:%.*]] +; CHECK-NEXT: [[TMP17:%.*]] = call i32 @llvm.vector.reduce.add.v5i32(<5 x i32> [[TMP16]]) +; CHECK-NEXT: [[TMP18:%.*]] = insertelement <1 x i32> poison, i32 [[TMP17]], i64 0 +; CHECK-NEXT: ret <1 x i32> [[TMP18]] ; %l = call <5 x i32> @llvm.matrix.column.major.load.v5i32.i64(ptr %src, i64 %stride, i1 false, i32 1, i32 5) %t = call <5 x i32> @llvm.matrix.transpose.v5i32(<5 x i32> %l, i32 1, i32 5)