[clang] 7f415e4 - [clang][SYCL] Disable float128 device mode diagnostic (#128513)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 11:13:30 PDT 2025


Author: Nicolas Miller
Date: 2025-03-12T18:13:26Z
New Revision: 7f415e444197025180d786c5e212f13b738179cb

URL: https://github.com/llvm/llvm-project/commit/7f415e444197025180d786c5e212f13b738179cb
DIFF: https://github.com/llvm/llvm-project/commit/7f415e444197025180d786c5e212f13b738179cb.diff

LOG: [clang][SYCL] Disable float128 device mode diagnostic (#128513)

This diagnostic is disabled for device compilation as float128 is not
supported on the device side.

Other diagnostics are already covering the cases where float128 is
actually used in the kernel code, and it's already tested for in the
existing test.

This is expanding on the patch 318bff6 that handled this for cuda
compilation.

Added: 
    

Modified: 
    clang/lib/Sema/SemaDeclAttr.cpp
    clang/test/SemaSYCL/float128.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index de2696ea62e3b..bc858c63f69b6 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -4847,7 +4847,8 @@ void Sema::AddModeAttr(Decl *D, const AttributeCommonInfo &CI,
 
   if (NewElemTy.isNull()) {
     // Only emit diagnostic on host for 128-bit mode attribute
-    if (!(DestWidth == 128 && getLangOpts().CUDAIsDevice))
+    if (!(DestWidth == 128 &&
+          (getLangOpts().CUDAIsDevice || getLangOpts().SYCLIsDevice)))
       Diag(AttrLoc, diag::err_machine_mode) << 1 /*Unsupported*/ << Name;
     return;
   }

diff  --git a/clang/test/SemaSYCL/float128.cpp b/clang/test/SemaSYCL/float128.cpp
index b1a022216aaff..e41dea38dbe75 100644
--- a/clang/test/SemaSYCL/float128.cpp
+++ b/clang/test/SemaSYCL/float128.cpp
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple spir64 -fsycl-is-device -verify -fsyntax-only %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsycl-is-device -fsyntax-only %s
 
+typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
 typedef __float128 BIGTY;
 
 template <class T>


        


More information about the cfe-commits mailing list