[llvm] [RISCV][CostModel] Estimate cost of llvm.vector.reduce.fmaximum/fminimum (PR #80697)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 17:53:36 PDT 2024


topperc wrote:

> Not by any means an FP expert, but isn't there a massively better lowering available here?
> 
> Written as a vector pseudo language:
> 
> ```
> masknan = foreach lane in input, isnan(lane)
> masknegzero  = foreach lane in input, isnegzero(lane)
> scalar = reduce.fmin(input)
> if anyof(masknan)
>   scalar = v[clz(masknan);
> if scalar == 0.0 and anyof(masknegzero)
>   scalar = 0.0
> ```
> 
> If so, I'd be tempted to fix that before worrying about the costing in TTI.

I put together a patch for this. And fixed an issue related to FMF preservation in the existing expansion. I'll post soon.

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


More information about the llvm-commits mailing list