forked from OSchip/llvm-project
Add support for gcc-compatible -mmfcrf -mno-mfcrf PPC options
gcc provides -mmfcrf and -mno-mfcrf for controlling what we call the mfocrf target feature. Also, PPC is now making use of the static function AddTargetFeature used by the Mips Driver code. llvm-svn: 178227
This commit is contained in:
parent
c3c725aae3
commit
279ca4d608
|
@ -832,6 +832,8 @@ def mabi_EQ : Joined<["-"], "mabi=">, Group<m_Group>;
|
|||
def march_EQ : Joined<["-"], "march=">, Group<m_Group>;
|
||||
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 mqpx : Flag<["-"], "mqpx">, Group<m_Group>;
|
||||
def mno_qpx : Flag<["-"], "mno-qpx">, Group<m_Group>;
|
||||
def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>;
|
||||
|
|
|
@ -1029,7 +1029,7 @@ void PPCTargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {
|
|||
bool PPCTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
|
||||
StringRef Name,
|
||||
bool Enabled) const {
|
||||
if (Name == "altivec" || Name == "qpx") {
|
||||
if (Name == "altivec" || Name == "mfocrf" || Name == "qpx") {
|
||||
Features[Name] = Enabled;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1097,11 +1097,17 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
|
|||
}
|
||||
|
||||
// Allow override of the Altivec feature.
|
||||
if (Args.hasFlag(options::OPT_fno_altivec, options::OPT_faltivec, false)) {
|
||||
CmdArgs.push_back("-target-feature");
|
||||
CmdArgs.push_back("-altivec");
|
||||
}
|
||||
AddTargetFeature(Args, CmdArgs,
|
||||
options::OPT_faltivec, options::OPT_fno_altivec,
|
||||
"altivec");
|
||||
|
||||
// Note that gcc calls this mfcrf and LLVM calls this mfocrf.
|
||||
AddTargetFeature(Args, CmdArgs,
|
||||
options::OPT_mmfcrf, options::OPT_mno_mfcrf,
|
||||
"mfocrf");
|
||||
|
||||
// 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)) {
|
||||
CmdArgs.push_back("-target-feature");
|
||||
CmdArgs.push_back("-qpx");
|
||||
|
|
|
@ -68,3 +68,9 @@
|
|||
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-qpx -mqpx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-QPX %s
|
||||
// CHECK-QPX-NOT: "-target-feature" "-qpx"
|
||||
|
||||
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-mfcrf -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOMFCRF %s
|
||||
// CHECK-NOMFCRF: "-target-feature" "-mfocrf"
|
||||
|
||||
// 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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue