[clang] [clang][Driver] Define soft float macros for PPC. (PR #106012)
Alex Rønne Petersen via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 25 14:12:24 PDT 2024
https://github.com/alexrp created https://github.com/llvm/llvm-project/pull/106012
Fixes #105972.
>From 5d52fe0d6d9bad77193a114eaef324d1799f2444 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= <alex at alexrp.com>
Date: Sun, 25 Aug 2024 22:47:37 +0200
Subject: [PATCH] [clang][Driver] Define soft float macros for PPC.
Fixes #105972.
---
clang/lib/Basic/Targets/PPC.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index 04dc436eb1b9cd..91145b256804c7 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -402,9 +402,13 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__VEC__", "10206");
Builder.defineMacro("__ALTIVEC__");
}
- if (HasSPE) {
+ if (HasSPE)
Builder.defineMacro("__SPE__");
+ if (HasSPE || FloatABI == SoftFloat)
Builder.defineMacro("__NO_FPRS__");
+ if (FloatABI == SoftFloat) {
+ Builder.defineMacro("_SOFT_FLOAT");
+ Builder.defineMacro("_SOFT_DOUBLE");
}
if (HasVSX)
Builder.defineMacro("__VSX__");
@@ -439,14 +443,12 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
// FIXME: The following are not yet generated here by Clang, but are
// generated by GCC:
//
- // _SOFT_FLOAT_
// __RECIP_PRECISION__
// __APPLE_ALTIVEC__
// __RECIP__
// __RECIPF__
// __RSQRTE__
// __RSQRTEF__
- // _SOFT_DOUBLE_
// __NO_LWSYNC__
// __CMODEL_MEDIUM__
// __CMODEL_LARGE__
More information about the cfe-commits
mailing list