[llvm] [SelectionDAG] Add `STRICT_BF16_TO_FP` and `STRICT_FP_TO_BF16` (PR #80056)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 00:56:09 PST 2024
phoebewang 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).
The example can pass if you add expand to X86ISelLowering.cpp
```
setOperationAction(ISD::STRICT_FP_TO_BF16, MVT::f32, Expand);
```
https://github.com/llvm/llvm-project/pull/80056
More information about the llvm-commits
mailing list