[PATCH] D74387: [SYCL] Do not diagnose use of __float128

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 11 00:12:26 PST 2020


Fznamznon created this revision.
Herald added subscribers: cfe-commits, Anastasia, ebevhan.
Herald added a project: clang.

While SYCL does not support __float128 for some device targets, emitting the
diagnostic here prevents the compilation of host header files with
__float128 type usage.
For now just do not diagnose __float128 for SYCL. In the future we should
have more precise check.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74387

Files:
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaSYCL/float128.cpp


Index: clang/test/SemaSYCL/float128.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaSYCL/float128.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple spir64 -fsycl-is-device -verify -fsyntax-only %s
+// expected-no-diagnostics
+
+void F(__float128);
+
+template <typename Name, typename Func>
+__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
+  kernelFunc();
+}
+
+int main() {
+  __float128 A;
+  kernel_single_task<class fake_kernel>([=]() {});
+  return 0;
+}
Index: clang/lib/Sema/SemaType.cpp
===================================================================
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -1516,6 +1516,7 @@
     break;
   case DeclSpec::TST_float128:
     if (!S.Context.getTargetInfo().hasFloat128Type() &&
+        !S.getLangOpts().SYCLIsDevice &&
         !(S.getLangOpts().OpenMP && S.getLangOpts().OpenMPIsDevice))
       S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_unsupported)
         << "__float128";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74387.243751.patch
Type: text/x-patch
Size: 1036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200211/b7d51d2e/attachment.bin>


More information about the cfe-commits mailing list