[PATCH] D111047: CUDA/HIP: Allow __int128 on the host side

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 25 10:40:04 PDT 2021


tra added a comment.

LGTM. This could be useful for other types. 
E.g. `long double` is technically not supported by NVPTX. We current demote it to double, so host-side does not cause errors, but ideally it should be treated similar to what you propose for i128 here.



================
Comment at: clang/lib/Sema/Sema.cpp:1858-1859
 void Sema::checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) {
-  if (!LangOpts.SYCLIsDevice && !(LangOpts.OpenMP && LangOpts.OpenMPIsDevice))
+  if (!LangOpts.SYCLIsDevice && !(LangOpts.OpenMP && LangOpts.OpenMPIsDevice) &&
+      !LangOpts.CUDAIsDevice)
     return;
----------------
Nit:I'd rephrase it a bit to make it a bit easier to understand (less negations).



================
Comment at: clang/lib/Sema/SemaType.cpp:1498-1500
     if (!S.Context.getTargetInfo().hasInt128Type() &&
-        !S.getLangOpts().SYCLIsDevice &&
+        !S.getLangOpts().SYCLIsDevice && !S.getLangOpts().CUDAIsDevice &&
         !(S.getLangOpts().OpenMP && S.getLangOpts().OpenMPIsDevice))
----------------
Similarly, here I'd separate the check for i128 support by the target and the compilation mode check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111047



More information about the cfe-commits mailing list