[PATCH] D157288: [TargetLowering][NFC] Document overloaded meaning of TypeSoftPromoteHalf

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 08:02:11 PDT 2023

asb created this revision.
asb added reviewers: craig.topper, bkramer.
Herald added subscribers: wingo, pmatos, sameer.abuasal.
Herald added a project: All.
asb requested review of this revision.
Herald added a project: LLVM.

As of D126953 <https://reviews.llvm.org/D126953>, TypeSoftPromoteHalf is set for bf16 if it isn't natively supported by a target. This overloads its meaning (and led to at least one bug - D157287 <https://reviews.llvm.org/D157287> - due to code assuming TypeSoftPromoteHalf is only used for f16).  This trivial patch documents how its meaning is overloaded.

Posting as a patch for review rather than directly committing because this seems like a good opportunity to check we're happy with overloading TypeSoftPromoteHalf's meaning.

I did grep for other TypeSoftPromoteHalf and didn't see any obvious issues. The SoftPromoteHalfResult and SoftPromoteHalfOperand code paths that gets used in this case ends up calling e.g. GetPromotionOpcode to properly handle the bf16 vs f16 case.

  rG LLVM Github Monorepo



Index: llvm/include/llvm/CodeGen/TargetLowering.h
--- llvm/include/llvm/CodeGen/TargetLowering.h
+++ llvm/include/llvm/CodeGen/TargetLowering.h
@@ -213,7 +213,7 @@
     TypeSplitVector,     // Split this vector into two of half the size.
     TypeWidenVector,     // This vector should be widened into a larger vector.
     TypePromoteFloat,    // Replace this float with a larger one.
-    TypeSoftPromoteHalf, // Soften half to i16 and use float to do arithmetic.
+    TypeSoftPromoteHalf, // Soften half/bf16 to i16 and use float to do arithmetic.
     TypeScalarizeScalableVector, // This action is explicitly left unimplemented.
                                  // While it is theoretically possible to
                                  // legalize operations on scalable types with a

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157288.547799.patch
Type: text/x-patch
Size: 859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230807/e6bf8d03/attachment.bin>

More information about the llvm-commits mailing list