[PATCH] D146715: [NVPTX] Enforce half type support is present for builtins

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 24 10:28:46 PDT 2023


tra accepted this revision.
tra added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:18313
     // of its member: n*alignof(t)."
-    return MakeLdgLdu(Intrinsic::nvvm_ldg_global_i);
-  case NVPTX::BI__nvvm_ldg_h:
-  case NVPTX::BI__nvvm_ldg_h2:
-    if (!HasHalfSupport(BuiltinID)) {
-      CGM.Error(E->getExprLoc(),
-                getContext().BuiltinInfo.getName(BuiltinID).str() +
-                    " requires native half type support.");
-      return nullptr;
-    }
-    [[fallthrough]];
+    return MakeLdgLdu(Intrinsic::nvvm_ldg_global_i, *this, E);
   case NVPTX::BI__nvvm_ldg_f:
----------------
This is where lambda would have some advantage as we could capture what it needs without having to pass 'this' or 'E' explicitly.
In this case it's not too bad, so I'm fine either way, with a very slight bias towards lambdas. The static functions just don't seem to buy us anything here, IMO.


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

https://reviews.llvm.org/D146715



More information about the cfe-commits mailing list