@@ -2493,13 +2493,6 @@ class VPExtendedReductionRecipe : public VPReductionRecipe {
2493
2493
// / recipe is abstract and needs to be lowered to concrete recipes before
2494
2494
// / codegen. The Operands are {ChainOp, VecOp1, VecOp2, [Condition]}.
2495
2495
class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2496
- // / Opcodes of the extend recipes.
2497
- Instruction::CastOps ExtOp0;
2498
- Instruction::CastOps ExtOp1;
2499
-
2500
- // / Non-neg flags of the extend recipe.
2501
- bool IsNonNeg0 = false ;
2502
- bool IsNonNeg1 = false ;
2503
2496
2504
2497
Type *ResultTy;
2505
2498
@@ -2514,10 +2507,11 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2514
2507
MulAcc->getCondOp (), MulAcc->isOrdered(),
2515
2508
WrapFlagsTy(MulAcc->hasNoUnsignedWrap (), MulAcc->hasNoSignedWrap()),
2516
2509
MulAcc->getDebugLoc()),
2517
- ExtOp0(MulAcc->getExt0Opcode ()), ExtOp1(MulAcc->getExt1Opcode ()),
2518
- IsNonNeg0(MulAcc->isNonNeg0 ()), IsNonNeg1(MulAcc->isNonNeg1 ()),
2519
2510
ResultTy(MulAcc->getResultType ()),
2520
- IsPartialReduction(MulAcc->isPartialReduction ()) {}
2511
+ IsPartialReduction(MulAcc->isPartialReduction ()) {
2512
+ VecOpInfo[0 ] = MulAcc->getVecOp0Info ();
2513
+ VecOpInfo[1 ] = MulAcc->getVecOp1Info ();
2514
+ }
2521
2515
2522
2516
public:
2523
2517
VPMulAccumulateReductionRecipe (VPReductionRecipe *R, VPWidenRecipe *Mul,
@@ -2529,14 +2523,14 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2529
2523
R->getCondOp (), R->isOrdered(),
2530
2524
WrapFlagsTy(Mul->hasNoUnsignedWrap (), Mul->hasNoSignedWrap()),
2531
2525
R->getDebugLoc()),
2532
- ExtOp0(Ext0->getOpcode ()), ExtOp1(Ext1->getOpcode ()),
2533
- IsNonNeg0(Ext0->isNonNeg ()), IsNonNeg1(Ext1->isNonNeg ()),
2534
2526
ResultTy(ResultTy),
2535
2527
IsPartialReduction(isa<VPPartialReductionRecipe>(R)) {
2536
2528
assert (RecurrenceDescriptor::getOpcode (getRecurrenceKind ()) ==
2537
2529
Instruction::Add &&
2538
2530
" The reduction instruction in MulAccumulateteReductionRecipe must "
2539
2531
" be Add" );
2532
+ VecOpInfo[0 ] = {Ext0->getOpcode (), Ext0->isNonNeg ()};
2533
+ VecOpInfo[1 ] = {Ext1->getOpcode (), Ext1->isNonNeg ()};
2540
2534
}
2541
2535
2542
2536
VPMulAccumulateReductionRecipe (VPReductionRecipe *R, VPWidenRecipe *Mul)
@@ -2545,15 +2539,20 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2545
2539
{R->getChainOp (), Mul->getOperand (0 ), Mul->getOperand (1 )},
2546
2540
R->getCondOp (), R->isOrdered(),
2547
2541
WrapFlagsTy(Mul->hasNoUnsignedWrap (), Mul->hasNoSignedWrap()),
2548
- R->getDebugLoc()),
2549
- ExtOp0(Instruction::CastOps::CastOpsEnd),
2550
- ExtOp1(Instruction::CastOps::CastOpsEnd) {
2542
+ R->getDebugLoc()) {
2551
2543
assert (RecurrenceDescriptor::getOpcode (getRecurrenceKind ()) ==
2552
2544
Instruction::Add &&
2553
2545
" The reduction instruction in MulAccumulateReductionRecipe must be "
2554
2546
" Add" );
2555
2547
}
2556
2548
2549
+ struct VecOperandInfo {
2550
+ // / The operand's extend opcode.
2551
+ Instruction::CastOps ExtOp{Instruction::CastOps::CastOpsEnd};
2552
+ // / Non-neg portion of the operand's flags.
2553
+ bool IsNonNeg = false ;
2554
+ };
2555
+
2557
2556
~VPMulAccumulateReductionRecipe () override = default ;
2558
2557
2559
2558
VPMulAccumulateReductionRecipe *clone () override {
@@ -2591,29 +2590,21 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2591
2590
VPValue *getVecOp1 () const { return getOperand (2 ); }
2592
2591
2593
2592
// / Return if this MulAcc recipe contains extend instructions.
2594
- bool isExtended () const { return ExtOp0 != Instruction::CastOps::CastOpsEnd; }
2593
+ bool isExtended () const {
2594
+ return getVecOp0Info ().ExtOp != Instruction::CastOps::CastOpsEnd;
2595
+ }
2595
2596
2596
2597
// / Return if the operands of mul instruction come from same extend.
2597
2598
bool isSameExtendVal () const { return getVecOp0 () == getVecOp1 (); }
2598
2599
2599
- // / Return the opcode of the underlying extends.
2600
- Instruction::CastOps getExt0Opcode () const { return ExtOp0; }
2601
- Instruction::CastOps getExt1Opcode () const { return ExtOp1; }
2602
-
2603
- // / Return if the first extend's opcode is ZExt.
2604
- bool isZExt0 () const { return ExtOp0 == Instruction::CastOps::ZExt; }
2605
-
2606
- // / Return if the second extend's opcode is ZExt.
2607
- bool isZExt1 () const { return ExtOp1 == Instruction::CastOps::ZExt; }
2608
-
2609
- // / Return the non negative flag of the first ext recipe.
2610
- bool isNonNeg0 () const { return IsNonNeg0; }
2611
-
2612
- // / Return the non negative flag of the second ext recipe.
2613
- bool isNonNeg1 () const { return IsNonNeg1; }
2600
+ VecOperandInfo getVecOp0Info () const { return VecOpInfo[0 ]; }
2601
+ VecOperandInfo getVecOp1Info () const { return VecOpInfo[1 ]; }
2614
2602
2615
2603
// / Return if the underlying reduction recipe is a partial reduction.
2616
2604
bool isPartialReduction () const { return IsPartialReduction; }
2605
+
2606
+ protected:
2607
+ VecOperandInfo VecOpInfo[2 ];
2617
2608
};
2618
2609
2619
2610
// / VPReplicateRecipe replicates a given instruction producing multiple scalar
0 commit comments