[PATCH] D156990: [LegalizeTypes][RISCV] Support libcalls for fpto{s,u}i of bfloat by extending to f32 first

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 07:49:58 PDT 2023

asb updated this revision to Diff 547791.
asb edited the summary of this revision.
asb added a comment.

@bjope: The F16_TO_FP and BF16_TO_FP nodes are slightly weird. As described in ISDOpcodes.h, they form a "semi-softened interface for dealing with bf16/f16 (as an i16)". I think it's correct to say they're only introduced when the LegalizeTypeAction for the type is TypeSoftPromoteHalf, which will never be set that way when bf16 is a legal type (i.e. when bf16 instructions are available). This patch is focused solely on that case, when those bf16 instructions are available. I don't think it would be correct to introduce BF16_TO_FP in this codepath (and if both were possible, I think the generic FP_EXT would be preferable given there are TODOs about trying to migrate F16_TO_FP and BF16_TO_FP to standard FP_EXT somehow).

@joshua-arch1: I've added CHECK lines for RV32/RV64 without zfbfmin. As you suggest, this does make an existing bug visible in the handling of bf16 on RV32 without zfbfmin caused by the assumption that TypeSoftPromoteHalf is only used for f16 types. That path won't be executed when bf16 is a legal type, as the type action for bf16 will never by TypeSoftPromoteHalf in that case. As this change merely includes a test case that exposes an existing bug rather than introducing it, I will post the fix in a separate patch.




-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156990.547791.patch
Type: text/x-patch
Size: 15202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230807/9e3399a2/attachment.bin>

More information about the llvm-commits mailing list