[llvm] [RISCV][CostModel] Correct the cost of some reductions (PR #118072)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 09:12:58 PST 2024


================
@@ -1470,27 +1470,27 @@ RISCVTTIImpl::getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty,
     llvm_unreachable("Unsupported intrinsic");
   case Intrinsic::smax:
     SplitOp = RISCV::VMAX_VV;
-    Opcodes = {RISCV::VMV_S_X, RISCV::VREDMAX_VS, RISCV::VMV_X_S};
+    Opcodes = {RISCV::VREDMAX_VS, RISCV::VMV_X_S};
----------------
preames wrote:

Er, what is the reasoning here?  This seems wrong.  Our reductions require a start value, and the IR ones do not.  As such, if we're costing a IR reduction, we do need to model the cost of preparing the start value in a register?  

https://github.com/llvm/llvm-project/pull/118072


More information about the llvm-commits mailing list