summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorArtem Belevich <tra@google.com>2017-09-21 18:44:49 +0000
committerArtem Belevich <tra@google.com>2017-09-21 18:44:49 +0000
commit42960b41883a9cc0aed6d1e42c851914893f5600 (patch)
tree26f7d407689f505269483c2486e8b9545336ad2c /clang/test
parentddf524c031947ffd495ff4fda9f78be28b05959f (diff)
downloadbcm5719-llvm-42960b41883a9cc0aed6d1e42c851914893f5600.tar.gz
bcm5719-llvm-42960b41883a9cc0aed6d1e42c851914893f5600.zip
[NVPTX] Implemented bar.warp.sync, barrier.sync, and vote{.sync} instructions/intrinsics/builtins.
Differential Revision: https://reviews.llvm.org/D38148 llvm-svn: 313898
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/builtins-nvptx-ptx60.cu41
-rw-r--r--clang/test/CodeGen/builtins-nvptx.c12
2 files changed, 51 insertions, 2 deletions
diff --git a/clang/test/CodeGen/builtins-nvptx-ptx60.cu b/clang/test/CodeGen/builtins-nvptx-ptx60.cu
index e06c84c150c..5bd9ca30097 100644
--- a/clang/test/CodeGen/builtins-nvptx-ptx60.cu
+++ b/clang/test/CodeGen/builtins-nvptx-ptx60.cu
@@ -10,8 +10,27 @@
#define __shared__ __attribute__((shared))
#define __constant__ __attribute__((constant))
-// CHECK-LABEL: nvvm_shfl_sync
-__device__ void nvvm_shfl_sync(unsigned mask, int i, float f, int a, int b) {
+// We have to keep all builtins that depend on particular target feature in the
+// same function, because the codegen will stop after the very first function
+// that encounters an error, so -verify will not be able to find errors in
+// subsequent functions.
+
+// CHECK-LABEL: nvvm_sync
+__device__ void nvvm_sync(unsigned mask, int i, float f, int a, int b,
+ bool pred) {
+ // CHECK: call void @llvm.nvvm.bar.warp.sync(i32
+ // expected-error@+1 {{'__nvvm_bar_warp_sync' needs target feature ptx60}}
+ __nvvm_bar_warp_sync(mask);
+ // CHECK: call void @llvm.nvvm.barrier.sync(i32
+ // expected-error@+1 {{'__nvvm_barrier_sync' needs target feature ptx60}}
+ __nvvm_barrier_sync(mask);
+ // CHECK: call void @llvm.nvvm.barrier.sync.cnt(i32
+ // expected-error@+1 {{'__nvvm_barrier_sync_cnt' needs target feature ptx60}}
+ __nvvm_barrier_sync_cnt(mask, i);
+
+ //
+ // SHFL.SYNC
+ //
// CHECK: call i32 @llvm.nvvm.shfl.sync.down.i32(i32 {{%[0-9]+}}, i32
// expected-error@+1 {{'__nvvm_shfl_sync_down_i32' needs target feature ptx60}}
__nvvm_shfl_sync_down_i32(mask, i, a, b);
@@ -36,5 +55,23 @@ __device__ void nvvm_shfl_sync(unsigned mask, int i, float f, int a, int b) {
// CHECK: call float @llvm.nvvm.shfl.sync.idx.f32(i32 {{%[0-9]+}}, float
// expected-error@+1 {{'__nvvm_shfl_sync_idx_f32' needs target feature ptx60}}
__nvvm_shfl_sync_idx_f32(mask, f, a, b);
+
+ //
+ // VOTE.SYNC
+ //
+
+ // CHECK: call i1 @llvm.nvvm.vote.all.sync(i32
+ // expected-error@+1 {{'__nvvm_vote_all_sync' needs target feature ptx60}}
+ __nvvm_vote_all_sync(mask, pred);
+ // CHECK: call i1 @llvm.nvvm.vote.any.sync(i32
+ // expected-error@+1 {{'__nvvm_vote_any_sync' needs target feature ptx60}}
+ __nvvm_vote_any_sync(mask, pred);
+ // CHECK: call i1 @llvm.nvvm.vote.uni.sync(i32
+ // expected-error@+1 {{'__nvvm_vote_uni_sync' needs target feature ptx60}}
+ __nvvm_vote_uni_sync(mask, pred);
+ // CHECK: call i32 @llvm.nvvm.vote.ballot.sync(i32
+ // expected-error@+1 {{'__nvvm_vote_ballot_sync' needs target feature ptx60}}
+ __nvvm_vote_ballot_sync(mask, pred);
+
// CHECK: ret void
}
diff --git a/clang/test/CodeGen/builtins-nvptx.c b/clang/test/CodeGen/builtins-nvptx.c
index c97b549cbe0..89a982377ad 100644
--- a/clang/test/CodeGen/builtins-nvptx.c
+++ b/clang/test/CodeGen/builtins-nvptx.c
@@ -657,3 +657,15 @@ __device__ void nvvm_shfl(int i, float f, int a, int b) {
__nvvm_shfl_idx_f32(f, a, b);
// CHECK: ret void
}
+
+__device__ void nvvm_vote(int pred) {
+ // CHECK: call i1 @llvm.nvvm.vote.all(i1
+ __nvvm_vote_all(pred);
+ // CHECK: call i1 @llvm.nvvm.vote.any(i1
+ __nvvm_vote_any(pred);
+ // CHECK: call i1 @llvm.nvvm.vote.uni(i1
+ __nvvm_vote_uni(pred);
+ // CHECK: call i32 @llvm.nvvm.vote.ballot(i1
+ __nvvm_vote_ballot(pred);
+ // CHECK: ret void
+}
OpenPOWER on IntegriCloud