r178419 - Remove old NVPTX cpus and add new NVPTX cpus

Justin Holewinski jholewinski at nvidia.com
Sat Mar 30 07:38:27 PDT 2013


Author: jholewinski
Date: Sat Mar 30 09:38:26 2013
New Revision: 178419

URL: http://llvm.org/viewvc/llvm-project?rev=178419&view=rev
Log:
Remove old NVPTX cpus and add new NVPTX cpus

Added:
    cfe/trunk/test/CodeGen/nvptx-cpus.c
Modified:
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=178419&r1=178418&r2=178419&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Mar 30 09:38:26 2013
@@ -1302,7 +1302,14 @@ namespace {
       return TargetInfo::CharPtrBuiltinVaList;
     }
     virtual bool setCPU(const std::string &Name) {
-      return Name == "sm_10" || Name == "sm_13" || Name == "sm_20";
+      bool Valid = llvm::StringSwitch<bool>(Name)
+        .Case("sm_20", true)
+        .Case("sm_21", true)
+        .Case("sm_30", true)
+        .Case("sm_35", true)
+        .Default(false);
+
+      return Valid;
     }
     virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
                                    StringRef Name,

Added: cfe/trunk/test/CodeGen/nvptx-cpus.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/nvptx-cpus.c?rev=178419&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/nvptx-cpus.c (added)
+++ cfe/trunk/test/CodeGen/nvptx-cpus.c Sat Mar 30 09:38:26 2013
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_20 -O3 -S -o %t %s -emit-llvm
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_21 -O3 -S -o %t %s -emit-llvm
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_30 -O3 -S -o %t %s -emit-llvm
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_35 -O3 -S -o %t %s -emit-llvm
+
+// Make sure clang accepts all supported architectures.
+
+void foo(float* a,
+         float* b) {
+  a[0] = b[0];
+}





More information about the cfe-commits mailing list