This is an archive of the discontinued LLVM Phabricator instance.

[AIX] Define _ARCH_PPC64 macro for 32-bit
ClosedPublic

Authored by Jake-Egan on Aug 1 2021, 2:39 PM.

Details

Summary


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.

Diff Detail

Event Timeline

Jake-Egan created this revision.Aug 1 2021, 2:39 PM
Jake-Egan requested review of this revision.Aug 1 2021, 2:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2021, 2:39 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Jake-Egan retitled this revision from Define _ARCH_PPC64 macro for 32-bit to [AIX] Define _ARCH_PPC64 macro for 32-bit.Aug 1 2021, 3:33 PM
Jake-Egan edited the summary of this revision. (Show Details)
Jake-Egan added a reviewer: cebowleratibm.
cebowleratibm requested changes to this revision.Aug 4 2021, 7:42 AM

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.

This revision now requires changes to proceed.Aug 4 2021, 7:42 AM
hubert.reinterpretcast added inline comments.
clang/lib/Basic/Targets/PPC.cpp
261

s/only/also/; ?

Jake-Egan updated this revision to Diff 364330.EditedAug 4 2021, 7:55 PM

Added the comment. clang-format suggests a second indent, but I think this is correct because the comment is addressing the else clause.

Jake-Egan marked 2 inline comments as done.Aug 4 2021, 7:58 PM
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).

Jake-Egan updated this revision to Diff 364342.Aug 4 2021, 9:29 PM

Merge else and if.

Jake-Egan marked an inline comment as done.Aug 4 2021, 9:30 PM
cebowleratibm requested changes to this revision.Aug 5 2021, 10:17 PM
cebowleratibm added inline comments.
clang/lib/Basic/Targets/PPC.cpp
261

Suggest:

// The XL compilers on AIX define _ARCH_PPC64 for both 32 and 64-bit modes.

This revision now requires changes to proceed.Aug 5 2021, 10:17 PM
Jake-Egan updated this revision to Diff 364766.Aug 6 2021, 6:05 AM

Updated the comment.

Jake-Egan marked an inline comment as done.Aug 6 2021, 6:06 AM
This revision is now accepted and ready to land.Aug 6 2021, 6:52 AM
This revision was automatically updated to reflect the committed changes.