]> granicus.if.org Git - clang/commitdiff
Remove old NVPTX cpus and add new NVPTX cpus
authorJustin Holewinski <jholewinski@nvidia.com>
Sat, 30 Mar 2013 14:38:26 +0000 (14:38 +0000)
committerJustin Holewinski <jholewinski@nvidia.com>
Sat, 30 Mar 2013 14:38:26 +0000 (14:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178419 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/CodeGen/nvptx-cpus.c [new file with mode: 0644]

index a17b2a8256fcbc8d7097658b203e72ba676e2d30..54edcbaf681eae5ab9a1e6d338eb0b7634b7d457 100644 (file)
@@ -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,
diff --git a/test/CodeGen/nvptx-cpus.c b/test/CodeGen/nvptx-cpus.c
new file mode 100644 (file)
index 0000000..c9c7680
--- /dev/null
@@ -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];
+}