[llvm] [RISCV][CostModel] Correct the cost of some reductions (PR #118072)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 09:20:29 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};
----------------
lukel97 wrote:
For the max/min reductions our lowering just reuses the source vector for the start value, e.g.
```llvm
define signext i8 @vreduce_umax_nxv1i8(<vscale x 1 x i8> %v) {
; CHECK-LABEL: vreduce_umax_nxv1i8:
; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
; CHECK-NEXT: vredmaxu.vs v8, v8, v8
; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: ret
%red = call i8 @llvm.vector.reduce.umax.nxv1i8(<vscale x 1 x i8> %v)
ret i8 %red
}
```
https://github.com/llvm/llvm-project/pull/118072
More information about the llvm-commits
mailing list