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.
Details
- Reviewers
cebowleratibm - Commits
- rG41bcfe81742e: [AIX] Define _ARCH_PPC64 macro for 32-bit
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The divergence with GCC is regrettable. Unfortunately defining _ARCH_PPC64 in 32-bit has been a long-standing discrepancy between xlc and gcc and one I don't expect gcc to change. This patch is preferable in order to retain preprocessing behaviour on AIX for customers porting 32-bit AIX xlc applications to clang.
My request for change is simply to add a brief explanation in the code, otherwise, it looks like a coding error.
clang/lib/Basic/Targets/PPC.cpp | ||
---|---|---|
261 | A comment is warranted here to explain that __ARCH_PPC64 is only defined in 32-bit on AIX. |
clang/lib/Basic/Targets/PPC.cpp | ||
---|---|---|
261 | s/only/also/; ? |
Added the comment. clang-format suggests a second indent, but I think this is correct because the comment is addressing the else clause.
clang/lib/Basic/Targets/PPC.cpp | ||
---|---|---|
260 | Merge else with single if-statement as the sole contents of the block into else if. Comment can be placed at the top of the block controlled by the else if (and, in that position, should be indented). |
clang/lib/Basic/Targets/PPC.cpp | ||
---|---|---|
261 | Suggest: // The XL compilers on AIX define _ARCH_PPC64 for both 32 and 64-bit modes. |
Merge else with single if-statement as the sole contents of the block into else if. Comment can be placed at the top of the block controlled by the else if (and, in that position, should be indented).