diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -257,6 +257,9 @@ 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 --- 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