[clang] [clang][Driver] Define soft float macros for PPC. (PR #106012)

Chen Zheng via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 05:12:15 PDT 2024


================
@@ -402,9 +402,16 @@ 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");
+  } else {
+    Builder.defineMacro("__RSQRTE__");
+    Builder.defineMacro("__RSQRTEF__");
----------------
chenzheng1030 wrote:

Sorry, I am not familiar with these macros. But I don't think GCC will always define `__RSQRTEF__` macro for all PowerPC versions. With -mcpu=power4, this macro is not defined, see https://godbolt.org/z/6W9f3adT1

https://github.com/llvm/llvm-project/pull/106012


More information about the cfe-commits mailing list