Add support for gcc-compatible -mpopcntd -mno-popcntd PPC options

gcc provides -mpopcntd and -mno-popcntd for controlling the popcntd target
feature; support these options as well.

llvm-svn: 178235
This commit is contained in:
Hal Finkel 2013-03-28 13:51:36 +00:00
parent 584da4043e
commit 1fe8b3dd4b
4 changed files with 14 additions and 1 deletions

View File

@ -836,6 +836,8 @@ def maltivec : Flag<["-"], "maltivec">, Alias<faltivec>;
def mno_altivec : Flag<["-"], "mno-altivec">, Alias<fno_altivec>;
def mmfcrf : Flag<["-"], "mmfcrf">, Group<m_Group>;
def mno_mfcrf : Flag<["-"], "mno-mfcrf">, Group<m_Group>;
def mpopcntd : Flag<["-"], "mpopcntd">, Group<m_Group>;
def mno_popcntd : Flag<["-"], "mno-popcntd">, Group<m_Group>;
def mqpx : Flag<["-"], "mqpx">, Group<m_Group>;
def mno_qpx : Flag<["-"], "mno-qpx">, Group<m_Group>;
def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>;

View File

@ -1029,7 +1029,8 @@ void PPCTargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {
bool PPCTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
StringRef Name,
bool Enabled) const {
if (Name == "altivec" || Name == "mfocrf" || Name == "qpx") {
if (Name == "altivec" || Name == "mfocrf" || Name == "popcntd" ||
Name == "qpx") {
Features[Name] = Enabled;
return true;
}

View File

@ -1106,6 +1106,10 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
options::OPT_mmfcrf, options::OPT_mno_mfcrf,
"mfocrf");
AddTargetFeature(Args, CmdArgs,
options::OPT_mpopcntd, options::OPT_mno_popcntd,
"popcntd");
// It is really only possible to turn qpx off because turning qpx on is tied
// to using the a2q CPU.
if (Args.hasFlag(options::OPT_mno_qpx, options::OPT_mqpx, false)) {

View File

@ -74,3 +74,9 @@
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-mfcrf -mmfcrf -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-MFCRF %s
// CHECK-MFCRF: "-target-feature" "+mfocrf"
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-popcntd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOPOPCNTD %s
// CHECK-NOPOPCNTD: "-target-feature" "-popcntd"
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-popcntd -mpopcntd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-POPCNTD %s
// CHECK-POPCNTD: "-target-feature" "+popcntd"