[Mlir-commits] [mlir] [mlir] Support emit fp16 and bf16 type to cpp (PR #105803)

Matthias Gehre llvmlistbot at llvm.org
Fri Aug 23 02:07:14 PDT 2024


================
@@ -1640,6 +1640,11 @@ LogicalResult CppEmitter::emitType(Location loc, Type type) {
   }
   if (auto fType = dyn_cast<FloatType>(type)) {
     switch (fType.getWidth()) {
+    case 16:
+      if (llvm::isa<Float16Type>(type))
+        return (os << "_Float16"), success();
+      else
----------------
mgehre-amd wrote:

Please explicitly check for bfloat16; at the pace of current floating point development, I wouldn't be surprised if we get another 16 bit float type in the future.

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


More information about the Mlir-commits mailing list