[clang] [SystemZ][zOS] disable _Float16 support on z/OS (PR #145532)
Sean Perry via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 25 08:14:06 PDT 2025
https://github.com/perry-ca updated https://github.com/llvm/llvm-project/pull/145532
>From 42c7e584ab1faa7dd07921a7de79d96d052a6949 Mon Sep 17 00:00:00 2001
From: Sean Perry <perry at ca.ibm.com>
Date: Tue, 24 Jun 2025 11:26:57 -0400
Subject: [PATCH 1/2] disable _Float16 support on z/OS
---
clang/lib/Basic/Targets/SystemZ.h | 5 +++--
clang/test/Sema/Float16.c | 1 +
clang/test/SemaCXX/Float16.cpp | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Basic/Targets/SystemZ.h b/clang/lib/Basic/Targets/SystemZ.h
index 1f69530c4757f..bb7b6640570a5 100644
--- a/clang/lib/Basic/Targets/SystemZ.h
+++ b/clang/lib/Basic/Targets/SystemZ.h
@@ -76,6 +76,7 @@ class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public TargetInfo {
MinGlobalAlign = 16;
HasUnalignedAccess = true;
if (Triple.isOSzOS()) {
+ HasFloat16 = false;
if (Triple.isArch64Bit()) {
AddrSpaceMap = &ZOSAddressMap;
}
@@ -89,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");
@@ -102,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 at +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
>From e62bb277963c1355843b2ef5e90dd2adb4d53ef8 Mon Sep 17 00:00:00 2001
From: Sean Perry <perry at ca.ibm.com>
Date: Wed, 25 Jun 2025 11:13:39 -0400
Subject: [PATCH 2/2] the default is flase so no need to set again
---
clang/lib/Basic/Targets/SystemZ.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/clang/lib/Basic/Targets/SystemZ.h b/clang/lib/Basic/Targets/SystemZ.h
index bb7b6640570a5..cdc1da862666d 100644
--- a/clang/lib/Basic/Targets/SystemZ.h
+++ b/clang/lib/Basic/Targets/SystemZ.h
@@ -76,7 +76,6 @@ class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public TargetInfo {
MinGlobalAlign = 16;
HasUnalignedAccess = true;
if (Triple.isOSzOS()) {
- HasFloat16 = false;
if (Triple.isArch64Bit()) {
AddrSpaceMap = &ZOSAddressMap;
}
More information about the cfe-commits
mailing list