[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 14:52:41 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.

negzero shouldn't be an issue. I think our instructions respect the order of -0.0 and 0.0.

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


More information about the llvm-commits mailing list