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 @tex0 = internal addrspace(1) global i64 0, align 8
9 @surf0 = internal addrspace(1) global i64 0, align 8
11 declare i32 @llvm.nvvm.txq.width(i64)
12 declare i32 @llvm.nvvm.txq.height(i64)
13 declare i32 @llvm.nvvm.suq.width(i64)
14 declare i32 @llvm.nvvm.suq.height(i64)
15 declare i64 @llvm.nvvm.texsurf.handle.internal.p1(ptr addrspace(1))
20 define i32 @t0(i64 %texHandle) {
23 %width = tail call i32 @llvm.nvvm.txq.width(i64 %texHandle)
30 ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], tex0
31 %texHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1(ptr addrspace(1) @tex0)
32 ; SM20: txq.width.b32 %r{{[0-9]+}}, [tex0]
33 ; SM30: txq.width.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
34 %width = tail call i32 @llvm.nvvm.txq.width(i64 %texHandle)
41 define i32 @t2(i64 %texHandle) {
42 ; SM20: txq.height.b32
43 ; SM30: txq.height.b32
44 %height = tail call i32 @llvm.nvvm.txq.height(i64 %texHandle)
51 ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], tex0
52 %texHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1(ptr addrspace(1) @tex0)
53 ; SM20: txq.height.b32 %r{{[0-9]+}}, [tex0]
54 ; SM30: txq.height.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
55 %height = tail call i32 @llvm.nvvm.txq.height(i64 %texHandle)
62 define i32 @s0(i64 %surfHandle) {
65 %width = tail call i32 @llvm.nvvm.suq.width(i64 %surfHandle)
72 ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], surf0
73 %surfHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1(ptr addrspace(1) @surf0)
74 ; SM20: suq.width.b32 %r{{[0-9]+}}, [surf0]
75 ; SM30: suq.width.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
76 %width = tail call i32 @llvm.nvvm.suq.width(i64 %surfHandle)
83 define i32 @s2(i64 %surfHandle) {
84 ; SM20: suq.height.b32
85 ; SM30: suq.height.b32
86 %height = tail call i32 @llvm.nvvm.suq.height(i64 %surfHandle)
93 ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], surf0
94 %surfHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1(ptr addrspace(1) @surf0)
95 ; SM20: suq.height.b32 %r{{[0-9]+}}, [surf0]
96 ; SM30: suq.height.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
97 %height = tail call i32 @llvm.nvvm.suq.height(i64 %surfHandle)
103 !nvvm.annotations = !{!1, !2}
104 !1 = !{ptr addrspace(1) @tex0, !"texture", i32 1}
105 !2 = !{ptr addrspace(1) @surf0, !"surface", i32 1}