r178235 - Add support for gcc-compatible -mpopcntd -mno-popcntd PPC options
Hal Finkel
hfinkel at anl.gov
Thu Mar 28 06:51:36 PDT 2013
Author: hfinkel
Date: Thu Mar 28 08:51:36 2013
New Revision: 178235
URL: http://llvm.org/viewvc/llvm-project?rev=178235&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/ppc-features.cpp
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=178235&r1=178234&r2=178235&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Mar 28 08:51:36 2013
@@ -836,6 +836,8 @@ def maltivec : Flag<["-"], "maltivec">,
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>;
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=178235&r1=178234&r2=178235&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Mar 28 08:51:36 2013
@@ -1029,7 +1029,8 @@ void PPCTargetInfo::getDefaultFeatures(l
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;
}
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=178235&r1=178234&r2=178235&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Mar 28 08:51:36 2013
@@ -1106,6 +1106,10 @@ void Clang::AddPPCTargetArgs(const ArgLi
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)) {
Modified: cfe/trunk/test/Driver/ppc-features.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ppc-features.cpp?rev=178235&r1=178234&r2=178235&view=diff
==============================================================================
--- cfe/trunk/test/Driver/ppc-features.cpp (original)
+++ cfe/trunk/test/Driver/ppc-features.cpp Thu Mar 28 08:51:36 2013
@@ -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"
+
More information about the cfe-commits
mailing list