hubert.reinterpretcast created this revision. hubert.reinterpretcast added reviewers: echristo, hfinkel, kbarton, nemanjai, wschmidt. Herald added a subscriber: jsji. Herald added a project: clang.
The predefined macro `_ARCH_PWR6X` is associated with GCC's `-mcpu=power6x` option, which enables generation of P6 <https://reviews.llvm.org/P6> "raw mode" instructions such as `mftgpr`. Later POWER processors build upon the "architected mode", not the raw one. `_ARCH_PWR6X` should not be defined for these later processors. Fixes PR#40236. Repository: rC Clang https://reviews.llvm.org/D58128 Files: lib/Basic/Targets/PPC.h test/Preprocessor/init.c Index: test/Preprocessor/init.c =================================================================== --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -5991,7 +5991,7 @@ // PPC64LE:#define _ARCH_PWR5 1 // PPC64LE:#define _ARCH_PWR5X 1 // PPC64LE:#define _ARCH_PWR6 1 -// PPC64LE:#define _ARCH_PWR6X 1 +// PPC64LE-NOT:#define _ARCH_PWR6X 1 // PPC64LE:#define _ARCH_PWR7 1 // PPC64LE:#define _CALL_ELF 2 // PPC64LE:#define _LITTLE_ENDIAN 1 @@ -6331,7 +6331,7 @@ // PPCPWR7:#define _ARCH_PWR5 1 // PPCPWR7:#define _ARCH_PWR5X 1 // PPCPWR7:#define _ARCH_PWR6 1 -// PPCPWR7:#define _ARCH_PWR6X 1 +// PPCPWR7-NOT:#define _ARCH_PWR6X 1 // PPCPWR7:#define _ARCH_PWR7 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu power7 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPOWER7 %s @@ -6344,7 +6344,7 @@ // PPCPOWER7:#define _ARCH_PWR5 1 // PPCPOWER7:#define _ARCH_PWR5X 1 // PPCPOWER7:#define _ARCH_PWR6 1 -// PPCPOWER7:#define _ARCH_PWR6X 1 +// PPCPOWER7-NOT:#define _ARCH_PWR6X 1 // PPCPOWER7:#define _ARCH_PWR7 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu pwr8 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPWR8 %s @@ -6357,7 +6357,7 @@ // PPCPWR8:#define _ARCH_PWR5 1 // PPCPWR8:#define _ARCH_PWR5X 1 // PPCPWR8:#define _ARCH_PWR6 1 -// PPCPWR8:#define _ARCH_PWR6X 1 +// PPCPWR8-NOT:#define _ARCH_PWR6X 1 // PPCPWR8:#define _ARCH_PWR7 1 // PPCPWR8:#define _ARCH_PWR8 1 // @@ -6374,7 +6374,7 @@ // PPCPOWER8:#define _ARCH_PWR5 1 // PPCPOWER8:#define _ARCH_PWR5X 1 // PPCPOWER8:#define _ARCH_PWR6 1 -// PPCPOWER8:#define _ARCH_PWR6X 1 +// PPCPOWER8-NOT:#define _ARCH_PWR6X 1 // PPCPOWER8:#define _ARCH_PWR7 1 // PPCPOWER8:#define _ARCH_PWR8 1 // @@ -6388,7 +6388,7 @@ // PPCPWR9:#define _ARCH_PWR5 1 // PPCPWR9:#define _ARCH_PWR5X 1 // PPCPWR9:#define _ARCH_PWR6 1 -// PPCPWR9:#define _ARCH_PWR6X 1 +// PPCPWR9-NOT:#define _ARCH_PWR6X 1 // PPCPWR9:#define _ARCH_PWR7 1 // PPCPWR9:#define _ARCH_PWR9 1 // @@ -6402,7 +6402,7 @@ // PPCPOWER9:#define _ARCH_PWR5 1 // PPCPOWER9:#define _ARCH_PWR5X 1 // PPCPOWER9:#define _ARCH_PWR6 1 -// PPCPOWER9:#define _ARCH_PWR6X 1 +// PPCPOWER9-NOT:#define _ARCH_PWR6X 1 // PPCPOWER9:#define _ARCH_PWR7 1 // PPCPOWER9:#define _ARCH_PWR9 1 // Index: lib/Basic/Targets/PPC.h =================================================================== --- lib/Basic/Targets/PPC.h +++ lib/Basic/Targets/PPC.h @@ -131,19 +131,18 @@ ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) .Cases("power7", "pwr7", - ArchDefinePwr7 | ArchDefinePwr6x | ArchDefinePwr6 | - ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 | - ArchDefinePpcgr | ArchDefinePpcsq) + ArchDefinePwr7 | ArchDefinePwr6 | ArchDefinePwr5x | + ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr | + ArchDefinePpcsq) // powerpc64le automatically defaults to at least power8. .Cases("power8", "pwr8", "ppc64le", - ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6x | - ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 | - ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) + ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6 | + ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 | + ArchDefinePpcgr | ArchDefinePpcsq) .Cases("power9", "pwr9", - ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 | - ArchDefinePwr6x | ArchDefinePwr6 | ArchDefinePwr5x | - ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr | - ArchDefinePpcsq) + ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 | + ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 | + ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) .Default(ArchDefineNone); } return CPUKnown;
Index: test/Preprocessor/init.c =================================================================== --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -5991,7 +5991,7 @@ // PPC64LE:#define _ARCH_PWR5 1 // PPC64LE:#define _ARCH_PWR5X 1 // PPC64LE:#define _ARCH_PWR6 1 -// PPC64LE:#define _ARCH_PWR6X 1 +// PPC64LE-NOT:#define _ARCH_PWR6X 1 // PPC64LE:#define _ARCH_PWR7 1 // PPC64LE:#define _CALL_ELF 2 // PPC64LE:#define _LITTLE_ENDIAN 1 @@ -6331,7 +6331,7 @@ // PPCPWR7:#define _ARCH_PWR5 1 // PPCPWR7:#define _ARCH_PWR5X 1 // PPCPWR7:#define _ARCH_PWR6 1 -// PPCPWR7:#define _ARCH_PWR6X 1 +// PPCPWR7-NOT:#define _ARCH_PWR6X 1 // PPCPWR7:#define _ARCH_PWR7 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu power7 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPOWER7 %s @@ -6344,7 +6344,7 @@ // PPCPOWER7:#define _ARCH_PWR5 1 // PPCPOWER7:#define _ARCH_PWR5X 1 // PPCPOWER7:#define _ARCH_PWR6 1 -// PPCPOWER7:#define _ARCH_PWR6X 1 +// PPCPOWER7-NOT:#define _ARCH_PWR6X 1 // PPCPOWER7:#define _ARCH_PWR7 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu pwr8 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPWR8 %s @@ -6357,7 +6357,7 @@ // PPCPWR8:#define _ARCH_PWR5 1 // PPCPWR8:#define _ARCH_PWR5X 1 // PPCPWR8:#define _ARCH_PWR6 1 -// PPCPWR8:#define _ARCH_PWR6X 1 +// PPCPWR8-NOT:#define _ARCH_PWR6X 1 // PPCPWR8:#define _ARCH_PWR7 1 // PPCPWR8:#define _ARCH_PWR8 1 // @@ -6374,7 +6374,7 @@ // PPCPOWER8:#define _ARCH_PWR5 1 // PPCPOWER8:#define _ARCH_PWR5X 1 // PPCPOWER8:#define _ARCH_PWR6 1 -// PPCPOWER8:#define _ARCH_PWR6X 1 +// PPCPOWER8-NOT:#define _ARCH_PWR6X 1 // PPCPOWER8:#define _ARCH_PWR7 1 // PPCPOWER8:#define _ARCH_PWR8 1 // @@ -6388,7 +6388,7 @@ // PPCPWR9:#define _ARCH_PWR5 1 // PPCPWR9:#define _ARCH_PWR5X 1 // PPCPWR9:#define _ARCH_PWR6 1 -// PPCPWR9:#define _ARCH_PWR6X 1 +// PPCPWR9-NOT:#define _ARCH_PWR6X 1 // PPCPWR9:#define _ARCH_PWR7 1 // PPCPWR9:#define _ARCH_PWR9 1 // @@ -6402,7 +6402,7 @@ // PPCPOWER9:#define _ARCH_PWR5 1 // PPCPOWER9:#define _ARCH_PWR5X 1 // PPCPOWER9:#define _ARCH_PWR6 1 -// PPCPOWER9:#define _ARCH_PWR6X 1 +// PPCPOWER9-NOT:#define _ARCH_PWR6X 1 // PPCPOWER9:#define _ARCH_PWR7 1 // PPCPOWER9:#define _ARCH_PWR9 1 // Index: lib/Basic/Targets/PPC.h =================================================================== --- lib/Basic/Targets/PPC.h +++ lib/Basic/Targets/PPC.h @@ -131,19 +131,18 @@ ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) .Cases("power7", "pwr7", - ArchDefinePwr7 | ArchDefinePwr6x | ArchDefinePwr6 | - ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 | - ArchDefinePpcgr | ArchDefinePpcsq) + ArchDefinePwr7 | ArchDefinePwr6 | ArchDefinePwr5x | + ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr | + ArchDefinePpcsq) // powerpc64le automatically defaults to at least power8. .Cases("power8", "pwr8", "ppc64le", - ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6x | - ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 | - ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) + ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6 | + ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 | + ArchDefinePpcgr | ArchDefinePpcsq) .Cases("power9", "pwr9", - ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 | - ArchDefinePwr6x | ArchDefinePwr6 | ArchDefinePwr5x | - ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr | - ArchDefinePpcsq) + ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 | + ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 | + ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) .Default(ArchDefineNone); } return CPUKnown;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits