Author: Sean Perry
Date: 2025-06-26T15:21:04-04:00
New Revision: a0c5f1992d2188dd58987445aa00a55edad2357f

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

LOG: [SystemZ][zOS] disable _Float16 support on z/OS (#145532)

The new half float type (aka _Float16 ) isn't supported on z/OS.

Added: 
    

Modified: 
    clang/lib/Basic/Targets/SystemZ.h
    clang/test/Sema/Float16.c
    clang/test/SemaCXX/Float16.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/SystemZ.h 
b/clang/lib/Basic/Targets/SystemZ.h
index 1af6122c7048b..7f7dcf815bd8f 100644
--- a/clang/lib/Basic/Targets/SystemZ.h
+++ b/clang/lib/Basic/Targets/SystemZ.h
@@ -90,6 +90,8 @@ class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public 
TargetInfo {
       resetDataLayout("E-m:l-p1:32:32-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-"
                       "a:8:16-n32:64");
     } else {
+      // Support _Float16.
+      HasFloat16 = true;
       TLSSupported = true;
       resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64"
                       "-v128:64-a:8:16-n32:64");
@@ -103,8 +105,6 @@ class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public 
TargetInfo {
     // and instead the backend will promote each half operation to float
     // individually.
     HasLegalHalfType = false;
-    // Support _Float16.
-    HasFloat16 = true;
 
     HasStrictFP = true;
   }

diff  --git a/clang/test/Sema/Float16.c b/clang/test/Sema/Float16.c
index 9269a0ded4eb9..2830213b6099f 100644
--- a/clang/test/Sema/Float16.c
+++ b/clang/test/Sema/Float16.c
@@ -6,6 +6,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -triple aarch64-linux-gnu %s -DHAVE
 // RUN: %clang_cc1 -fsyntax-only -verify -triple riscv32 %s -DHAVE
 // RUN: %clang_cc1 -fsyntax-only -verify -triple riscv64 %s -DHAVE
+// RUN: %clang_cc1 -fsyntax-only -verify -triple s390x-ibm-zos %s
 
 #ifndef HAVE
 // expected-error@+2{{_Float16 is not supported on this target}}

diff  --git a/clang/test/SemaCXX/Float16.cpp b/clang/test/SemaCXX/Float16.cpp
index 61b02a50687b9..9646a8d0c317f 100644
--- a/clang/test/SemaCXX/Float16.cpp
+++ b/clang/test/SemaCXX/Float16.cpp
@@ -4,7 +4,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -triple spir-unknown-unknown %s -DHAVE
 // RUN: %clang_cc1 -fsyntax-only -verify -triple armv7a-linux-gnu %s -DHAVE
 // RUN: %clang_cc1 -fsyntax-only -verify -triple aarch64-linux-gnu %s -DHAVE
-
+// RUN: %clang_cc1 -fsyntax-only -verify -triple s390x-ibm-zos %s
 #ifdef HAVE
 // expected-no-diagnostics
 #endif // HAVE


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to