@@ -1548,7 +1548,7 @@ RISCVTTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
1548
1548
getRISCVInstructionCost (RISCV::VCPOP_M, LT.second , CostKind) +
1549
1549
getCmpSelInstrCost (Instruction::ICmp, ElementTy, ElementTy,
1550
1550
CmpInst::ICMP_EQ, CostKind);
1551
- } else if (ISD == ISD::XOR) {
1551
+ } else if (ISD == ISD::XOR || ISD == ISD::ADD ) {
1552
1552
// Example sequences:
1553
1553
// vsetvli a0, zero, e8, mf8, ta, ma
1554
1554
// vmxor.mm v8, v0, v8 ; needed every time type is split
@@ -1558,13 +1558,14 @@ RISCVTTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
1558
1558
getRISCVInstructionCost (RISCV::VMXOR_MM, LT.second , CostKind) +
1559
1559
getRISCVInstructionCost (RISCV::VCPOP_M, LT.second , CostKind) + 1 ;
1560
1560
} else {
1561
+ assert (ISD == ISD::OR);
1561
1562
// Example sequences:
1562
1563
// vsetvli a0, zero, e8, mf8, ta, ma
1563
- // vmxor .mm v8, v9, v8 ; needed every time type is split
1564
+ // vmor .mm v8, v9, v8 ; needed every time type is split
1564
1565
// vcpop.m a0, v0
1565
1566
// snez a0, a0
1566
1567
return (LT.first - 1 ) *
1567
- getRISCVInstructionCost (RISCV::VMXOR_MM , LT.second , CostKind) +
1568
+ getRISCVInstructionCost (RISCV::VMOR_MM , LT.second , CostKind) +
1568
1569
getRISCVInstructionCost (RISCV::VCPOP_M, LT.second , CostKind) +
1569
1570
getCmpSelInstrCost (Instruction::ICmp, ElementTy, ElementTy,
1570
1571
CmpInst::ICMP_NE, CostKind);
0 commit comments