1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_70 -mattr=+ptx60 | FileCheck %s
2 ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_70 -mattr=+ptx60 | %ptxas-verify -arch=sm_70 %}
4 declare i32 @llvm.nvvm.match.any.sync.i32(i32, i32)
5 declare i32 @llvm.nvvm.match.any.sync.i64(i32, i64)
7 ; CHECK-LABEL: .func{{.*}}match_any_sync_i32
8 define i32 @match_any_sync_i32(i32 %mask, i32 %value) {
9 ; CHECK: ld.param.u32 [[MASK:%r[0-9]+]], [match_any_sync_i32_param_0];
10 ; CHECK: ld.param.u32 [[VALUE:%r[0-9]+]], [match_any_sync_i32_param_1];
12 ; CHECK: match.any.sync.b32 [[V0:%r[0-9]+]], [[VALUE]], [[MASK]];
13 %v0 = call i32 @llvm.nvvm.match.any.sync.i32(i32 %mask, i32 %value)
14 ; CHECK: match.any.sync.b32 [[V1:%r[0-9]+]], [[VALUE]], 1;
15 %v1 = call i32 @llvm.nvvm.match.any.sync.i32(i32 1, i32 %value)
16 ; CHECK: match.any.sync.b32 [[V2:%r[0-9]+]], 2, [[MASK]];
17 %v2 = call i32 @llvm.nvvm.match.any.sync.i32(i32 %mask, i32 2)
18 ; CHECK: match.any.sync.b32 [[V3:%r[0-9]+]], 4, 3;
19 %v3 = call i32 @llvm.nvvm.match.any.sync.i32(i32 3, i32 4)
20 %sum1 = add i32 %v0, %v1
21 %sum2 = add i32 %v2, %v3
22 %sum3 = add i32 %sum1, %sum2
26 ; CHECK-LABEL: .func{{.*}}match_any_sync_i64
27 define i32 @match_any_sync_i64(i32 %mask, i64 %value) {
28 ; CHECK: ld.param.u32 [[MASK:%r[0-9]+]], [match_any_sync_i64_param_0];
29 ; CHECK: ld.param.u64 [[VALUE:%rd[0-9]+]], [match_any_sync_i64_param_1];
31 ; CHECK: match.any.sync.b64 [[V0:%r[0-9]+]], [[VALUE]], [[MASK]];
32 %v0 = call i32 @llvm.nvvm.match.any.sync.i64(i32 %mask, i64 %value)
33 ; CHECK: match.any.sync.b64 [[V1:%r[0-9]+]], [[VALUE]], 1;
34 %v1 = call i32 @llvm.nvvm.match.any.sync.i64(i32 1, i64 %value)
35 ; CHECK: match.any.sync.b64 [[V2:%r[0-9]+]], 2, [[MASK]];
36 %v2 = call i32 @llvm.nvvm.match.any.sync.i64(i32 %mask, i64 2)
37 ; CHECK: match.any.sync.b64 [[V3:%r[0-9]+]], 4, 3;
38 %v3 = call i32 @llvm.nvvm.match.any.sync.i64(i32 3, i64 4)
39 %sum1 = add i32 %v0, %v1
40 %sum2 = add i32 %v2, %v3
41 %sum3 = add i32 %sum1, %sum2
45 declare {i32, i1} @llvm.nvvm.match.all.sync.i32p(i32, i32)
46 declare {i32, i1} @llvm.nvvm.match.all.sync.i64p(i32, i64)
48 ; CHECK-LABEL: .func{{.*}}match_all_sync_i32p(
49 define {i32,i1} @match_all_sync_i32p(i32 %mask, i32 %value) {
50 ; CHECK: ld.param.u32 [[MASK:%r[0-9]+]], [match_all_sync_i32p_param_0];
51 ; CHECK: ld.param.u32 [[VALUE:%r[0-9]+]], [match_all_sync_i32p_param_1];
53 ; CHECK: match.all.sync.b32 {{%r[0-9]+\|%p[0-9]+}}, [[VALUE]], [[MASK]];
54 %r1 = call {i32, i1} @llvm.nvvm.match.all.sync.i32p(i32 %mask, i32 %value)
55 %v1 = extractvalue {i32, i1} %r1, 0
56 %p1 = extractvalue {i32, i1} %r1, 1
58 ; CHECK: match.all.sync.b32 {{%r[0-9]+\|%p[0-9]+}}, 1, [[MASK]];
59 %r2 = call {i32, i1} @llvm.nvvm.match.all.sync.i32p(i32 %mask, i32 1)
60 %v2 = extractvalue {i32, i1} %r2, 0
61 %p2 = extractvalue {i32, i1} %r2, 1
63 ; CHECK: match.all.sync.b32 {{%r[0-9]+\|%p[0-9]+}}, [[VALUE]], 2;
64 %r3 = call {i32, i1} @llvm.nvvm.match.all.sync.i32p(i32 2, i32 %value)
65 %v3 = extractvalue {i32, i1} %r3, 0
66 %p3 = extractvalue {i32, i1} %r3, 1
68 ; CHECK: match.all.sync.b32 {{%r[0-9]+\|%p[0-9]+}}, 4, 3;
69 %r4 = call {i32, i1} @llvm.nvvm.match.all.sync.i32p(i32 3, i32 4)
70 %v4 = extractvalue {i32, i1} %r4, 0
71 %p4 = extractvalue {i32, i1} %r4, 1
73 %vsum1 = add i32 %v1, %v2
74 %vsum2 = add i32 %v3, %v4
75 %vsum3 = add i32 %vsum1, %vsum2
76 %psum1 = add i1 %p1, %p2
77 %psum2 = add i1 %p3, %p4
78 %psum3 = add i1 %psum1, %psum2
79 %ret0 = insertvalue {i32, i1} undef, i32 %vsum3, 0
80 %ret1 = insertvalue {i32, i1} %ret0, i1 %psum3, 1
84 ; CHECK-LABEL: .func{{.*}}match_all_sync_i64p(
85 define {i32,i1} @match_all_sync_i64p(i32 %mask, i64 %value) {
86 ; CHECK: ld.param.u32 [[MASK:%r[0-9]+]], [match_all_sync_i64p_param_0];
87 ; CHECK: ld.param.u64 [[VALUE:%rd[0-9]+]], [match_all_sync_i64p_param_1];
89 ; CHECK: match.all.sync.b64 {{%r[0-9]+\|%p[0-9]+}}, [[VALUE]], [[MASK]];
90 %r1 = call {i32, i1} @llvm.nvvm.match.all.sync.i64p(i32 %mask, i64 %value)
91 %v1 = extractvalue {i32, i1} %r1, 0
92 %p1 = extractvalue {i32, i1} %r1, 1
94 ; CHECK: match.all.sync.b64 {{%r[0-9]+\|%p[0-9]+}}, 1, [[MASK]];
95 %r2 = call {i32, i1} @llvm.nvvm.match.all.sync.i64p(i32 %mask, i64 1)
96 %v2 = extractvalue {i32, i1} %r2, 0
97 %p2 = extractvalue {i32, i1} %r2, 1
99 ; CHECK: match.all.sync.b64 {{%r[0-9]+\|%p[0-9]+}}, [[VALUE]], 2;
100 %r3 = call {i32, i1} @llvm.nvvm.match.all.sync.i64p(i32 2, i64 %value)
101 %v3 = extractvalue {i32, i1} %r3, 0
102 %p3 = extractvalue {i32, i1} %r3, 1
104 ; CHECK: match.all.sync.b64 {{%r[0-9]+\|%p[0-9]+}}, 4, 3;
105 %r4 = call {i32, i1} @llvm.nvvm.match.all.sync.i64p(i32 3, i64 4)
106 %v4 = extractvalue {i32, i1} %r4, 0
107 %p4 = extractvalue {i32, i1} %r4, 1
109 %vsum1 = add i32 %v1, %v2
110 %vsum2 = add i32 %v3, %v4
111 %vsum3 = add i32 %vsum1, %vsum2
112 %psum1 = add i1 %p1, %p2
113 %psum2 = add i1 %p3, %p4
114 %psum3 = add i1 %psum1, %psum2
115 %ret0 = insertvalue {i32, i1} undef, i32 %vsum3, 0
116 %ret1 = insertvalue {i32, i1} %ret0, i1 %psum3, 1