Skip to content

Commit 41bcfe8

Browse files
committed
[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
1 parent 869d07e commit 41bcfe8

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

clang/lib/Basic/Targets/PPC.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
257257
Builder.defineMacro("__powerpc64__");
258258
Builder.defineMacro("__ppc64__");
259259
Builder.defineMacro("__PPC64__");
260+
} else if (getTriple().isOSAIX()) {
261+
// The XL compilers on AIX define _ARCH_PPC64 for both 32 and 64-bit modes.
262+
Builder.defineMacro("_ARCH_PPC64");
260263
}
261264
if (getTriple().isOSAIX()) {
262265
Builder.defineMacro("__THW_PPC__");

clang/test/Preprocessor/init-ppc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@
391391
// PPC-AIX-NOT:#define __64BIT__ 1
392392
// PPC-AIX:#define _AIX 1
393393
// PPC-AIX:#define _ARCH_PPC 1
394+
// PPC-AIX:#define _ARCH_PPC64 1
394395
// PPC-AIX:#define _BIG_ENDIAN 1
395396
// PPC-AIX:#define _IBMR2 1
396397
// PPC-AIX:#define _LONG_LONG 1

0 commit comments

Comments
 (0)