[PATCH] D145238: [NVPTX] Expose LDU builtins

Jakub Chlanda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 9 00:03:37 PST 2023


jchlanda marked 5 inline comments as done.
jchlanda added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:18267-18271
+    auto HalfSupport = HasHalfSupport(BuiltinID);
+    if (!HalfSupport.first) {
+      CGM.Error(E->getExprLoc(),
+                HalfSupport.second.append(" requires native half type support.")
+                    .c_str());
----------------
tra wrote:
> jchlanda wrote:
> > tra wrote:
> > > I think we can simplify it all further.
> > > 
> > > ```
> > > auto HasHalfSupport = [&](unsigned BuiltinID) {
> > >     auto &Context = getContext();
> > >     return Context.getLangOpts().NativeHalfType || !Context.getTargetInfo().useFP16ConversionIntrinsics();
> > > }
> > > ...
> > > 
> > > if (!HasHalfSupport(BuiltinID)) {
> > >       CGM.Error(E->getExprLoc(),   getContext().BuiltinInfo.getName(BuiltinID) + " requires native half type support.");
> > > 
> > > ```
> > Done, although we need a string append there, StringRef and Twine would not work.
> We don't really need `append()`.
> `CGM.Error(E->getExprLoc(),   getContext().BuiltinInfo.getName(BuiltinID).str() + " requires native half type support.");` works.
> 
Done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145238



More information about the cfe-commits mailing list