1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs | FileCheck %s --check-prefix=SM20
2 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_30 -verify-machineinstrs | FileCheck %s --check-prefix=SM30
3 ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs | %ptxas-verify %}
4 ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_30 -verify-machineinstrs | %ptxas-verify %}
6 target triple = "nvptx-unknown-cuda"
8 declare void @llvm.nvvm.sust.b.1d.i32.trap(i64, i32, i32)
9 declare i64 @llvm.nvvm.texsurf.handle.internal.p1(ptr addrspace(1))
12 ; SM20-LABEL: .entry foo
13 ; SM30-LABEL: .entry foo
14 define void @foo(i64 %img, i32 %val, i32 %idx) {
15 ; SM20: ld.param.u64 %rd[[SURFREG:[0-9]+]], [foo_param_0];
16 ; SM20: sust.b.1d.b32.trap [%rd[[SURFREG]], {%r{{[0-9]+}}}], {%r{{[0-9]+}}}
17 ; SM30: ld.param.u64 %rd[[SURFREG:[0-9]+]], [foo_param_0];
18 ; SM30: sust.b.1d.b32.trap [%rd[[SURFREG]], {%r{{[0-9]+}}}], {%r{{[0-9]+}}}
19 tail call void @llvm.nvvm.sust.b.1d.i32.trap(i64 %img, i32 %idx, i32 %val)
24 @surf0 = internal addrspace(1) global i64 0, align 8
28 ; SM20-LABEL: .entry bar
29 ; SM30-LABEL: .entry bar
30 define void @bar(i32 %val, i32 %idx) {
31 ; SM30: mov.u64 %rd[[SURFHANDLE:[0-9]+]], surf0
32 %surfHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1(ptr addrspace(1) @surf0)
33 ; SM20: sust.b.1d.b32.trap [surf0, {%r{{[0-9]+}}}], {%r{{[0-9]+}}}
34 ; SM30: sust.b.1d.b32.trap [%rd[[SURFREG]], {%r{{[0-9]+}}}], {%r{{[0-9]+}}}
35 tail call void @llvm.nvvm.sust.b.1d.i32.trap(i64 %surfHandle, i32 %idx, i32 %val)
40 !nvvm.annotations = !{!1, !2, !3}
41 !1 = !{ptr @foo, !"kernel", i32 1}
42 !2 = !{ptr @bar, !"kernel", i32 1}
43 !3 = !{ptr addrspace(1) @surf0, !"surface", i32 1}