Add -mqpx and -mno-qpx feature flags to toggle use of the PPC QPX vector instruction set

I've renamed the altivec test to ppc-features (because now there is more than one feature to test).

llvm-svn: 174204
This commit is contained in:
Hal Finkel 2013-02-01 18:44:19 +00:00
parent dbf46a16c7
commit b58ce85ecc
4 changed files with 16 additions and 1 deletions

View File

@ -811,6 +811,8 @@ def mabi_EQ : Joined<["-"], "mabi=">, Group<m_Group>;
def march_EQ : Joined<["-"], "march=">, Group<m_Group>; def march_EQ : Joined<["-"], "march=">, Group<m_Group>;
def maltivec : Flag<["-"], "maltivec">, Alias<faltivec>; def maltivec : Flag<["-"], "maltivec">, Alias<faltivec>;
def mno_altivec : Flag<["-"], "mno-altivec">, Alias<fno_altivec>; def mno_altivec : Flag<["-"], "mno-altivec">, Alias<fno_altivec>;
def mqpx : Flag<["-"], "mqpx">, Group<m_Group>;
def mno_qpx : Flag<["-"], "mno-qpx">, Group<m_Group>;
def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>; def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>;
def mconstant_cfstrings : Flag<["-"], "mconstant-cfstrings">, Group<clang_ignored_m_Group>; def mconstant_cfstrings : Flag<["-"], "mconstant-cfstrings">, Group<clang_ignored_m_Group>;
def mcpu_EQ : Joined<["-"], "mcpu=">, Group<m_Group>; def mcpu_EQ : Joined<["-"], "mcpu=">, Group<m_Group>;

View File

@ -946,12 +946,14 @@ void PPCTargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {
.Case("pwr7", true) .Case("pwr7", true)
.Case("ppc64", true) .Case("ppc64", true)
.Default(false); .Default(false);
Features["qpx"] = (CPU == "a2q");
} }
bool PPCTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, bool PPCTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
StringRef Name, StringRef Name,
bool Enabled) const { bool Enabled) const {
if (Name == "altivec") { if (Name == "altivec" || Name == "qpx") {
Features[Name] = Enabled; Features[Name] = Enabled;
return true; return true;
} }

View File

@ -1091,6 +1091,11 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
CmdArgs.push_back("-target-feature"); CmdArgs.push_back("-target-feature");
CmdArgs.push_back("-altivec"); CmdArgs.push_back("-altivec");
} }
if (Args.hasFlag(options::OPT_mno_qpx, options::OPT_mqpx, false)) {
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("-qpx");
}
} }
void Clang::AddSparcTargetArgs(const ArgList &Args, void Clang::AddSparcTargetArgs(const ArgList &Args,

View File

@ -62,3 +62,9 @@
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=ppc64 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-15 %s // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=ppc64 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-15 %s
// CHECK-15: "-target-feature" "-altivec" // CHECK-15: "-target-feature" "-altivec"
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-qpx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOQPX %s
// CHECK-NOQPX: "-target-feature" "-qpx"
// 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"