1 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s --check-prefix=SM20
2 ; RUN: llc < %s -march=nvptx -mcpu=sm_30 | FileCheck %s --check-prefix=SM30
4 target triple = "nvptx-unknown-cuda"
6 @tex0 = internal addrspace(1) global i64 0, align 8
7 @surf0 = internal addrspace(1) global i64 0, align 8
9 declare i32 @llvm.nvvm.txq.width(i64)
10 declare i32 @llvm.nvvm.txq.height(i64)
11 declare i32 @llvm.nvvm.suq.width(i64)
12 declare i32 @llvm.nvvm.suq.height(i64)
13 declare i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)*)
18 define i32 @t0(i64 %texHandle) {
21 %width = tail call i32 @llvm.nvvm.txq.width(i64 %texHandle)
28 ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], tex0
29 %texHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @tex0)
30 ; SM20: txq.width.b32 %r{{[0-9]+}}, [tex0]
31 ; SM30: txq.width.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
32 %width = tail call i32 @llvm.nvvm.txq.width(i64 %texHandle)
39 define i32 @t2(i64 %texHandle) {
40 ; SM20: txq.height.b32
41 ; SM30: txq.height.b32
42 %height = tail call i32 @llvm.nvvm.txq.height(i64 %texHandle)
49 ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], tex0
50 %texHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @tex0)
51 ; SM20: txq.height.b32 %r{{[0-9]+}}, [tex0]
52 ; SM30: txq.height.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
53 %height = tail call i32 @llvm.nvvm.txq.height(i64 %texHandle)
60 define i32 @s0(i64 %surfHandle) {
63 %width = tail call i32 @llvm.nvvm.suq.width(i64 %surfHandle)
70 ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], surf0
71 %surfHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @surf0)
72 ; SM20: suq.width.b32 %r{{[0-9]+}}, [surf0]
73 ; SM30: suq.width.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
74 %width = tail call i32 @llvm.nvvm.suq.width(i64 %surfHandle)
81 define i32 @s2(i64 %surfHandle) {
82 ; SM20: suq.height.b32
83 ; SM30: suq.height.b32
84 %height = tail call i32 @llvm.nvvm.suq.height(i64 %surfHandle)
91 ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], surf0
92 %surfHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @surf0)
93 ; SM20: suq.height.b32 %r{{[0-9]+}}, [surf0]
94 ; SM30: suq.height.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
95 %height = tail call i32 @llvm.nvvm.suq.height(i64 %surfHandle)
101 !nvvm.annotations = !{!1, !2}
102 !1 = !{i64 addrspace(1)* @tex0, !"texture", i32 1}
103 !2 = !{i64 addrspace(1)* @surf0, !"surface", i32 1}