@@ -301,11 +301,11 @@ InstructionCost
301301VPPartialReductionRecipe::computeCost (ElementCount VF,
302302 VPCostContext &Ctx) const {
303303 std::optional<unsigned > Opcode;
304- VPValue *Op = getOperand (0 );
304+ VPValue *Op = getOperand (1 );
305305 VPRecipeBase *OpR = Op->getDefiningRecipe ();
306306
307- // If the partial reduction is predicated, a select will be operand 0
308- if (match (getOperand ( 1 ) , m_Select (m_VPValue (), m_VPValue (Op), m_VPValue ()))) {
307+ // If the partial reduction is predicated, a select will be operand 1
308+ if (match (Op , m_Select (m_VPValue (), m_VPValue (Op), m_VPValue ()))) {
309309 OpR = Op->getDefiningRecipe ();
310310 }
311311
@@ -2914,10 +2914,8 @@ void VPExpressionRecipe::print(raw_ostream &O, const Twine &Indent,
29142914 switch (ExpressionType) {
29152915 case ExpressionTypes::ExtendedReduction: {
29162916 getOperand (1 )->printAsOperand (O, SlotTracker);
2917- O << " + " ;
2918- if (IsPartialReduction)
2919- O << " partial." ;
2920- O << " reduce." << Instruction::getOpcodeName (Opcode) << " (" ;
2917+ O << " + " << (IsPartialReduction ? " partial." : " " ) << " reduce." ;
2918+ O << Instruction::getOpcodeName (Opcode) << " (" ;
29212919 getOperand (0 )->printAsOperand (O, SlotTracker);
29222920 Red->printFlags (O);
29232921
@@ -2933,11 +2931,8 @@ void VPExpressionRecipe::print(raw_ostream &O, const Twine &Indent,
29332931 }
29342932 case ExpressionTypes::ExtNegatedMulAccReduction: {
29352933 getOperand (getNumOperands () - 1 )->printAsOperand (O, SlotTracker);
2936- O << " + " ;
2937- if (IsPartialReduction)
2938- O << " partial." ;
2939- O << " reduce."
2940- << Instruction::getOpcodeName (
2934+ O << " + " << (IsPartialReduction ? " partial." : " " ) << " reduce." ;
2935+ O << Instruction::getOpcodeName (
29412936 RecurrenceDescriptor::getOpcode (Red->getRecurrenceKind ()))
29422937 << " (sub (0, mul" ;
29432938 auto *Mul = cast<VPWidenRecipe>(ExpressionRecipes[2 ]);
@@ -2961,11 +2956,8 @@ void VPExpressionRecipe::print(raw_ostream &O, const Twine &Indent,
29612956 case ExpressionTypes::MulAccReduction:
29622957 case ExpressionTypes::ExtMulAccReduction: {
29632958 getOperand (getNumOperands () - 1 )->printAsOperand (O, SlotTracker);
2964- O << " + " ;
2965- if (IsPartialReduction)
2966- O << " partial." ;
2967- O << " reduce."
2968- << Instruction::getOpcodeName (
2959+ O << " + " << (IsPartialReduction ? " partial." : " " ) << " reduce." ;
2960+ O << Instruction::getOpcodeName (
29692961 RecurrenceDescriptor::getOpcode (Red->getRecurrenceKind ()))
29702962 << " (" ;
29712963 O << " mul" ;
0 commit comments