1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_30 -mattr=+ptx60 | FileCheck %s
3 declare i32 @llvm.nvvm.fns(i32, i32, i32)
5 ; CHECK-LABEL: .func{{.*}}fns
6 define i32 @fns(i32 %mask, i32 %base, i32 %offset) {
7 ; CHECK: ld.param.u32 [[MASK:%r[0-9]+]], [fns_param_0];
8 ; CHECK: ld.param.u32 [[BASE:%r[0-9]+]], [fns_param_1];
9 ; CHECK: ld.param.u32 [[OFFSET:%r[0-9]+]], [fns_param_2];
11 ; CHECK: fns.b32 {{%r[0-9]+}}, [[MASK]], [[BASE]], [[OFFSET]];
12 %r0 = call i32 @llvm.nvvm.fns(i32 %mask, i32 %base, i32 %offset);
13 ; CHECK: fns.b32 {{%r[0-9]+}}, [[MASK]], [[BASE]], 0;
14 %r1 = call i32 @llvm.nvvm.fns(i32 %mask, i32 %base, i32 0);
15 %r01 = add i32 %r0, %r1;
16 ; CHECK: fns.b32 {{%r[0-9]+}}, [[MASK]], 1, [[OFFSET]];
17 %r2 = call i32 @llvm.nvvm.fns(i32 %mask, i32 1, i32 %offset);
18 ; CHECK: fns.b32 {{%r[0-9]+}}, [[MASK]], 1, 0;
19 %r3 = call i32 @llvm.nvvm.fns(i32 %mask, i32 1, i32 0);
20 %r23 = add i32 %r2, %r3;
21 %r0123 = add i32 %r01, %r23;
22 ; CHECK: fns.b32 {{%r[0-9]+}}, 2, [[BASE]], [[OFFSET]];
23 %r4 = call i32 @llvm.nvvm.fns(i32 2, i32 %base, i32 %offset);
24 ; CHECK: fns.b32 {{%r[0-9]+}}, 2, [[BASE]], 0;
25 %r5 = call i32 @llvm.nvvm.fns(i32 2, i32 %base, i32 0);
26 %r45 = add i32 %r4, %r5;
27 ; CHECK: fns.b32 {{%r[0-9]+}}, 2, 1, [[OFFSET]];
28 %r6 = call i32 @llvm.nvvm.fns(i32 2, i32 1, i32 %offset);
29 ; CHECK: fns.b32 {{%r[0-9]+}}, 2, 1, 0;
30 %r7 = call i32 @llvm.nvvm.fns(i32 2, i32 1, i32 0);
31 %r67 = add i32 %r6, %r7;
32 %r4567 = add i32 %r45, %r67;
33 %r = add i32 %r0123, %r4567;