@@ -1548,7 +1548,7 @@ RISCVTTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
15481548 getRISCVInstructionCost (RISCV::VCPOP_M, LT.second , CostKind) +
15491549 getCmpSelInstrCost (Instruction::ICmp, ElementTy, ElementTy,
15501550 CmpInst::ICMP_EQ, CostKind);
1551- } else if (ISD == ISD::XOR) {
1551+ } else if (ISD == ISD::XOR || ISD == ISD::ADD ) {
15521552 // Example sequences:
15531553 // vsetvli a0, zero, e8, mf8, ta, ma
15541554 // vmxor.mm v8, v0, v8 ; needed every time type is split
@@ -1558,13 +1558,14 @@ RISCVTTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
15581558 getRISCVInstructionCost (RISCV::VMXOR_MM, LT.second , CostKind) +
15591559 getRISCVInstructionCost (RISCV::VCPOP_M, LT.second , CostKind) + 1 ;
15601560 } else {
1561+ assert (ISD == ISD::OR);
15611562 // Example sequences:
15621563 // 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
15641565 // vcpop.m a0, v0
15651566 // snez a0, a0
15661567 return (LT.first - 1 ) *
1567- getRISCVInstructionCost (RISCV::VMXOR_MM , LT.second , CostKind) +
1568+ getRISCVInstructionCost (RISCV::VMOR_MM , LT.second , CostKind) +
15681569 getRISCVInstructionCost (RISCV::VCPOP_M, LT.second , CostKind) +
15691570 getCmpSelInstrCost (Instruction::ICmp, ElementTy, ElementTy,
15701571 CmpInst::ICMP_NE, CostKind);
0 commit comments