]> granicus.if.org Git - clang/commitdiff
Add -mqpx and -mno-qpx feature flags to toggle use of the PPC QPX vector instruction set
authorHal Finkel <hfinkel@anl.gov>
Fri, 1 Feb 2013 18:44:19 +0000 (18:44 +0000)
committerHal Finkel <hfinkel@anl.gov>
Fri, 1 Feb 2013 18:44:19 +0000 (18:44 +0000)
I've renamed the altivec test to ppc-features (because now there is more than one feature to test).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174204 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Options.td
lib/Basic/Targets.cpp
lib/Driver/Tools.cpp
test/Driver/ppc-features.cpp [moved from test/Driver/altivec.cpp with 91% similarity]

index a3dd71d0655e2aca1492b5475123b87c137fdd71..2aeffad382e2f4b0adb90286a515b9370c8e0ce1 100644 (file)
@@ -811,6 +811,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 mqpx : Flag<["-"], "mqpx">, Group<m_Group>;
+def mno_qpx : Flag<["-"], "mno-qpx">, Group<m_Group>;
 def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>;
 def mconstant_cfstrings : Flag<["-"], "mconstant-cfstrings">, Group<clang_ignored_m_Group>;
 def mcpu_EQ : Joined<["-"], "mcpu=">, Group<m_Group>;
index 46479702952c05db781963af2cf822bd531bee84..c22520620845fcfaf12bd132aa13a8599bb0dba0 100644 (file)
@@ -946,12 +946,14 @@ void PPCTargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {
     .Case("pwr7", true)
     .Case("ppc64", true)
     .Default(false);
+
+  Features["qpx"] = (CPU == "a2q");
 }
 
 bool PPCTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
                                          StringRef Name,
                                          bool Enabled) const {
-  if (Name == "altivec") {
+  if (Name == "altivec" || Name == "qpx") {
     Features[Name] = Enabled;
     return true;
   }
index 18b49e65e803042dcbbb432a2c6c5d8b7414fc94..c5392164e9383b36fe21fc3b1e09e66fa2373359 100644 (file)
@@ -1091,6 +1091,11 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
     CmdArgs.push_back("-target-feature");
     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,
similarity index 91%
rename from test/Driver/altivec.cpp
rename to test/Driver/ppc-features.cpp
index cf70e8daa985c303da875ceed95a6acc7d581be8..1918ed7d76f2b9f7b1c4fbcae0cb3d94c243e52d 100644 (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
 // 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"
+