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).

llvm-svn: 174204

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

index a3dd71d..2aeffad 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 4647970..c225206 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 18b49e6..c539216 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 clang/test/Driver/altivec.cpp
rename to clang/test/Driver/ppc-features.cpp
index cf70e8d..1918ed7 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"
+