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

Hal Finkel hfinkel at anl.gov
Fri Feb 1 10:44:19 PST 2013


Author: hfinkel
Date: Fri Feb  1 12:44:19 2013
New Revision: 174204

URL: http://llvm.org/viewvc/llvm-project?rev=174204&view=rev
Log:
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).

Added:
    cfe/trunk/test/Driver/ppc-features.cpp
      - copied, changed from r174185, cfe/trunk/test/Driver/altivec.cpp
Removed:
    cfe/trunk/test/Driver/altivec.cpp
Modified:
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=174204&r1=174203&r2=174204&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Feb  1 12:44:19 2013
@@ -811,6 +811,8 @@ def mabi_EQ : Joined<["-"], "mabi=">, Gr
 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>;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=174204&r1=174203&r2=174204&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Feb  1 12:44:19 2013
@@ -946,12 +946,14 @@ void PPCTargetInfo::getDefaultFeatures(l
     .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;
   }

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=174204&r1=174203&r2=174204&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Feb  1 12:44:19 2013
@@ -1091,6 +1091,11 @@ void Clang::AddPPCTargetArgs(const ArgLi
     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,

Removed: cfe/trunk/test/Driver/altivec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/altivec.cpp?rev=174203&view=auto
==============================================================================
--- cfe/trunk/test/Driver/altivec.cpp (original)
+++ cfe/trunk/test/Driver/altivec.cpp (removed)
@@ -1,64 +0,0 @@
-// Check that we error when -faltivec is specified on non-ppc platforms.
-
-// RUN: %clang -target powerpc-unk-unk -faltivec -fsyntax-only %s
-// RUN: %clang -target powerpc64-linux-gnu -faltivec -fsyntax-only %s
-// RUN: %clang -target powerpc64-linux-gnu -maltivec -fsyntax-only %s
-
-// RUN: %clang -target i386-pc-win32 -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: %clang -target x86_64-unknown-freebsd -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: %clang -target armv6-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: %clang -target armv7-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: %clang -target mips-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: %clang -target mips64-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: %clang -target sparc-unknown-solaris -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-
-// CHECK: invalid argument '-faltivec' only allowed with 'ppc/ppc64'
-
-// Check that -fno-altivec and -mno-altivec correctly disable the altivec
-// target feature on powerpc.
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-1 %s
-// CHECK-1: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-2 %s
-// CHECK-2: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -faltivec -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-3 %s
-// CHECK-3: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -maltivec -fno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-4 %s
-// CHECK-4: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -faltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-5 %s
-// CHECK-5-NOT: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -maltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-6 %s
-// CHECK-6-NOT: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=7400 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-7 %s
-// CHECK-7: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g4 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-8 %s
-// CHECK-8: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=7450 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-9 %s
-// CHECK-9: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g4+ -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-10 %s
-// CHECK-10: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=970 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-11 %s
-// CHECK-11: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g5 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-12 %s
-// CHECK-12: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr6 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-13 %s
-// CHECK-13: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr7 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-14 %s
-// CHECK-14: "-target-feature" "-altivec"
-
-// 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"
-

Copied: cfe/trunk/test/Driver/ppc-features.cpp (from r174185, cfe/trunk/test/Driver/altivec.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ppc-features.cpp?p2=cfe/trunk/test/Driver/ppc-features.cpp&p1=cfe/trunk/test/Driver/altivec.cpp&r1=174185&r2=174204&rev=174204&view=diff
==============================================================================
--- cfe/trunk/test/Driver/altivec.cpp (original)
+++ cfe/trunk/test/Driver/ppc-features.cpp Fri Feb  1 12:44:19 2013
@@ -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"
+





More information about the cfe-commits mailing list