[llvm] [RISCV] Support Inline ASM for the bf16 type. (PR #80118)

Chuan-Yue Yuan via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 02:17:07 PDT 2024


================
@@ -479,6 +479,12 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
     // FIXME: Need to promote bf16 FCOPYSIGN to f32, but the
     // DAGCombiner::visitFP_ROUND probably needs improvements first.
     setOperationAction(ISD::FCOPYSIGN, MVT::bf16, Expand);
+
+    // To fold (bf16 bitcast (copyfromreg f16)) -> (copyfromreg bf16), we have
+    // to legalize the f16 CopyFromReg for avoiding SoftPromoteHalf.
+    setOperationAction(ISD::CopyFromReg, MVT::f16, Legal);
+    // Fold the (bf16 bitcast (copyfromreg f16)) -> (copyfromreg bf16).
+    setTargetDAGCombine(ISD::BITCAST);
----------------
circYuan wrote:

OK, sorry for that I doesn't realize about this policy originally. I will seek the correct way to handle it, thanks for the comment!

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


More information about the llvm-commits mailing list