[PATCH] D124790: [HLSL] Enable half type for hlsl.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 08:05:35 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from some minor changes.



================
Comment at: clang/lib/AST/ASTContext.cpp:1712
+  case BuiltinType::Half:
+    // For HLSL, when not enable native half type, half will be treat as float.
+    if (getLangOpts().HLSL)
----------------



================
Comment at: clang/lib/AST/ASTContext.cpp:1713-1719
+    if (getLangOpts().HLSL)
+      if (getLangOpts().NativeHalfType)
+        return Target->getHalfFormat();
+      else
+        return Target->getFloatFormat();
+    else
+      return Target->getHalfFormat();
----------------



================
Comment at: clang/lib/Basic/Targets/DirectX.h:60
                     "32-f64:64-n8:16:32:64");
+    // using the Microsoft ABI.
+    TheCXXABI.set(TargetCXXABI::Microsoft);
----------------
Though I'd also be fine removing the comment as it doesn't really do much except restate the next line.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124790/new/

https://reviews.llvm.org/D124790



More information about the cfe-commits mailing list