[clang] [CIR] Upstream missing support for floating point unary operator (PR #193215)

Sirui Mu via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 06:40:08 PDT 2026


================
@@ -710,21 +710,23 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
 
       if (type->isHalfType() &&
           !cgf.getContext().getLangOpts().NativeHalfType) {
-        cgf.cgm.errorNYI(e->getSourceRange(), "Unary inc/dec half");
-        return {};
+        // Another special case: half FP increment should be done via float. If
+        // the input isn't already half, it may be i16.
+        mlir::Value fp16Input =
+            builder.createBitcast(input, builder.getFp16Ty());
----------------
Lancern wrote:

When could `input` be `i16`? Could you add a test to cover such cases?

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


More information about the cfe-commits mailing list