summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2014-04-15 16:57:53 +0000
committerEli Bendersky <eliben@google.com>2014-04-15 16:57:53 +0000
commitc8b5d37350a09fc57307697e6428872f61c0f220 (patch)
treeed9b98e05e1f1d7fd0f505a493913fe6364d49d1
parent57e9d5ea97f046f67c097cf4d19883d9078c4805 (diff)
downloadclang-c8b5d37350a09fc57307697e6428872f61c0f220.tar.gz
clang-c8b5d37350a09fc57307697e6428872f61c0f220.tar.bz2
clang-c8b5d37350a09fc57307697e6428872f61c0f220.tar.xz
Add test case for r206302
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206303 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CodeGenCUDA/launch-bounds.cu30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/CodeGenCUDA/launch-bounds.cu b/test/CodeGenCUDA/launch-bounds.cu
new file mode 100644
index 0000000000..3f88aeb7e7
--- /dev/null
+++ b/test/CodeGenCUDA/launch-bounds.cu
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 %s -triple nvptx-unknown-unknown -fcuda-is-device -emit-llvm -o - | FileCheck %s
+
+#include "../SemaCUDA/cuda.h"
+
+#define MAX_THREADS_PER_BLOCK 256
+#define MIN_BLOCKS_PER_MP 2
+
+// Test both max threads per block and Min cta per sm.
+extern "C" {
+__global__ void
+__launch_bounds__( MAX_THREADS_PER_BLOCK, MIN_BLOCKS_PER_MP )
+Kernel1()
+{
+}
+}
+
+// CHECK: !{{[0-9]+}} = metadata !{void ()* @Kernel1, metadata !"maxntidx", i32 256}
+// CHECK: !{{[0-9]+}} = metadata !{void ()* @Kernel1, metadata !"minctasm", i32 2}
+
+// Test only max threads per block. Min cta per sm defaults to 0, and
+// CodeGen doesn't output a zero value for minctasm.
+extern "C" {
+__global__ void
+__launch_bounds__( MAX_THREADS_PER_BLOCK )
+Kernel2()
+{
+}
+}
+
+// CHECK: !{{[0-9]+}} = metadata !{void ()* @Kernel2, metadata !"maxntidx", i32 256}