[clang] 41bcfe8 - [AIX] Define _ARCH_PPC64 macro for 32-bit
Jake Egan via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 6 07:43:20 PDT 2021
Author: Jake Egan
Date: 2021-08-06T10:42:44-04:00
New Revision: 41bcfe81742ed6462096ccb42aa5f2b9d67027fc
URL: https://github.com/llvm/llvm-project/commit/41bcfe81742ed6462096ccb42aa5f2b9d67027fc
DIFF: https://github.com/llvm/llvm-project/commit/41bcfe81742ed6462096ccb42aa5f2b9d67027fc.diff
LOG: [AIX] Define _ARCH_PPC64 macro for 32-bit
%%%
The macro _ARCH_PPC64 is already defined for 64-bit, but this patch defines it for 32-bit on AIX to follow xlc. See: https://www.ibm.com/docs/en/xl-c-and-cpp-aix/13.1.0?topic=features-macros-related-architecture-settings
Note: This change creates a discrepancy between GCC, which defines _ARCH_PPC64 only for 64-bit mode.
Tested with SPEC.
%%%
Reviewed By: cebowleratibm
Differential Revision: https://reviews.llvm.org/D107244
Added:
Modified:
clang/lib/Basic/Targets/PPC.cpp
clang/test/Preprocessor/init-ppc.c
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index 4ee7282c06ce..711ba2837a9b 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -257,6 +257,9 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__powerpc64__");
Builder.defineMacro("__ppc64__");
Builder.defineMacro("__PPC64__");
+ } else if (getTriple().isOSAIX()) {
+ // The XL compilers on AIX define _ARCH_PPC64 for both 32 and 64-bit modes.
+ Builder.defineMacro("_ARCH_PPC64");
}
if (getTriple().isOSAIX()) {
Builder.defineMacro("__THW_PPC__");
diff --git a/clang/test/Preprocessor/init-ppc.c b/clang/test/Preprocessor/init-ppc.c
index abf2e919cff6..fedc1b6c9140 100644
--- a/clang/test/Preprocessor/init-ppc.c
+++ b/clang/test/Preprocessor/init-ppc.c
@@ -391,6 +391,7 @@
// PPC-AIX-NOT:#define __64BIT__ 1
// PPC-AIX:#define _AIX 1
// PPC-AIX:#define _ARCH_PPC 1
+// PPC-AIX:#define _ARCH_PPC64 1
// PPC-AIX:#define _BIG_ENDIAN 1
// PPC-AIX:#define _IBMR2 1
// PPC-AIX:#define _LONG_LONG 1
More information about the cfe-commits
mailing list