[llvm] [SelectionDAG][ARM] Add lowering for strict fp16 nodes on systems without fullfp16 (PR #173666)

Erik Enikeev via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 12 03:18:23 PST 2026


Varnike wrote:

> Does the promotion codepath produce correct results in non-default rounding modes? 

> It's hard to reason about all of these unrelated opcodes at a time. This should be broken up

Yes, you are right. Although such promotion should be correct for some ops: 

- [add/sub/div/mul/sqrt](https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/addendum.html), probably fma (with #171904)
- rounding to integer (rint/nearbyint/ceil/floor/round/roundeven/trunc) 
- minimum/maximum
- ldexp/scalbn

in general, this statement does not hold. For the remaining operations we should lower directly to libcalls. Where would it be more appropriate to place it? Since there will be no promotion, keeping it in `SoftPromoteHalfResult` sounds misleading.

> Does the promotion codepath trigger the correct floating-point exceptions?

The final fp exceptions triggered as a result of a combination of type conversions and the calculations in wider type should match a single operation in a given type (f16). However, exceptions may be raised by different steps in the sequence (e.g. during the conversion), so the per-step behavior and exception signaling order may differ. Is this acceptable?

If you spot any issues with this reasoning, please let me know.

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


More information about the llvm-commits mailing list