[llvm] [SelectionDAG] Add `STRICT_BF16_TO_FP` and `STRICT_FP_TO_BF16` (PR #80056)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 19:11:46 PST 2024


shiltian wrote:

I'm not sure how to design a valid lowering that can test the lib call path. Designed a similar X86 test case as the one from `llvm/test/CodeGen/X86/half-constrained.ll`, as shown below:
```
define void @float_to_bfloat(float %0) strictfp {
  %2 = tail call bfloat @llvm.experimental.constrained.fptrunc.bfloat.f32(float %0, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
  store bfloat %2, ptr @a, align 2
  ret void
}
```
If the type is `half`, it will go through the lib call path. However, if it is `bfloat`, it will not (I believe it goes through soft promotion).

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


More information about the llvm-commits mailing list