Skip to content

Commit 5af5e32

Browse files
committed
Fixup! Sink ordered reduction into ISD::FAdd.
1 parent 74d6d68 commit 5af5e32

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,13 +1564,6 @@ RISCVTTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
15641564
}
15651565

15661566
// IR Reduction is composed by two vmv and one rvv reduction instruction.
1567-
if (TTI::requiresOrderedReduction(FMF) && ElementTy->isFloatingPointTy()) {
1568-
Opcodes.push_back(RISCV::VFMV_S_F);
1569-
for (unsigned i = 0; i < LT.first.getValue(); i++)
1570-
Opcodes.push_back(RISCV::VFREDOSUM_VS);
1571-
Opcodes.push_back(RISCV::VFMV_F_S);
1572-
return getRISCVInstructionCost(Opcodes, LT.second, CostKind);
1573-
}
15741567
unsigned SplitOp;
15751568
switch (ISD) {
15761569
case ISD::ADD:
@@ -1590,6 +1583,13 @@ RISCVTTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
15901583
Opcodes = {RISCV::VMV_S_X, RISCV::VREDAND_VS, RISCV::VMV_X_S};
15911584
break;
15921585
case ISD::FADD:
1586+
if (TTI::requiresOrderedReduction(FMF)) {
1587+
Opcodes.push_back(RISCV::VFMV_S_F);
1588+
for (unsigned i = 0; i < LT.first.getValue(); i++)
1589+
Opcodes.push_back(RISCV::VFREDOSUM_VS);
1590+
Opcodes.push_back(RISCV::VFMV_F_S);
1591+
return getRISCVInstructionCost(Opcodes, LT.second, CostKind);
1592+
}
15931593
// We can't promote f16/bf16 fadd reductions.
15941594
if ((LT.second.getVectorElementType() == MVT::f16 &&
15951595
!ST->hasVInstructionsF16()) ||

0 commit comments

Comments
 (0)