1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s --check-prefix=SM20 2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=nvptx -mcpu=sm_30 | FileCheck %s --check-prefix=SM30 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Workertarget triple = "nvptx-unknown-cuda" 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.nvvm.suld.1d.i32.trap(i64, i32) 7*9880d681SAndroid Build Coastguard Workerdeclare i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)*) 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Worker; SM20-LABEL: .entry foo 11*9880d681SAndroid Build Coastguard Worker; SM30-LABEL: .entry foo 12*9880d681SAndroid Build Coastguard Workerdefine void @foo(i64 %img, float* %red, i32 %idx) { 13*9880d681SAndroid Build Coastguard Worker; SM20: ld.param.u64 %rd[[SURFREG:[0-9]+]], [foo_param_0]; 14*9880d681SAndroid Build Coastguard Worker; SM20: suld.b.1d.b32.trap {%r[[RED:[0-9]+]]}, [%rd[[SURFREG]], {%r{{[0-9]+}}}] 15*9880d681SAndroid Build Coastguard Worker; SM30: ld.param.u64 %rd[[SURFREG:[0-9]+]], [foo_param_0]; 16*9880d681SAndroid Build Coastguard Worker; SM30: suld.b.1d.b32.trap {%r[[RED:[0-9]+]]}, [%rd[[SURFREG]], {%r{{[0-9]+}}}] 17*9880d681SAndroid Build Coastguard Worker %val = tail call i32 @llvm.nvvm.suld.1d.i32.trap(i64 %img, i32 %idx) 18*9880d681SAndroid Build Coastguard Worker; SM20: cvt.rn.f32.s32 %f[[REDF:[0-9]+]], %r[[RED]] 19*9880d681SAndroid Build Coastguard Worker; SM30: cvt.rn.f32.s32 %f[[REDF:[0-9]+]], %r[[RED]] 20*9880d681SAndroid Build Coastguard Worker %ret = sitofp i32 %val to float 21*9880d681SAndroid Build Coastguard Worker; SM20: st.global.f32 [%r{{[0-9]+}}], %f[[REDF]] 22*9880d681SAndroid Build Coastguard Worker; SM30: st.global.f32 [%r{{[0-9]+}}], %f[[REDF]] 23*9880d681SAndroid Build Coastguard Worker store float %ret, float* %red 24*9880d681SAndroid Build Coastguard Worker ret void 25*9880d681SAndroid Build Coastguard Worker} 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker@surf0 = internal addrspace(1) global i64 0, align 8 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker; SM20-LABEL: .entry bar 30*9880d681SAndroid Build Coastguard Worker; SM30-LABEL: .entry bar 31*9880d681SAndroid Build Coastguard Workerdefine void @bar(float* %red, i32 %idx) { 32*9880d681SAndroid Build Coastguard Worker; SM30: mov.u64 %rd[[SURFHANDLE:[0-9]+]], surf0 33*9880d681SAndroid Build Coastguard Worker %surfHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @surf0) 34*9880d681SAndroid Build Coastguard Worker; SM20: suld.b.1d.b32.trap {%r[[RED:[0-9]+]]}, [surf0, {%r{{[0-9]+}}}] 35*9880d681SAndroid Build Coastguard Worker; SM30: suld.b.1d.b32.trap {%r[[RED:[0-9]+]]}, [%rd[[SURFHANDLE]], {%r{{[0-9]+}}}] 36*9880d681SAndroid Build Coastguard Worker %val = tail call i32 @llvm.nvvm.suld.1d.i32.trap(i64 %surfHandle, i32 %idx) 37*9880d681SAndroid Build Coastguard Worker; SM20: cvt.rn.f32.s32 %f[[REDF:[0-9]+]], %r[[RED]] 38*9880d681SAndroid Build Coastguard Worker; SM30: cvt.rn.f32.s32 %f[[REDF:[0-9]+]], %r[[RED]] 39*9880d681SAndroid Build Coastguard Worker %ret = sitofp i32 %val to float 40*9880d681SAndroid Build Coastguard Worker; SM20: st.global.f32 [%r{{[0-9]+}}], %f[[REDF]] 41*9880d681SAndroid Build Coastguard Worker; SM30: st.global.f32 [%r{{[0-9]+}}], %f[[REDF]] 42*9880d681SAndroid Build Coastguard Worker store float %ret, float* %red 43*9880d681SAndroid Build Coastguard Worker ret void 44*9880d681SAndroid Build Coastguard Worker} 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Worker 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard Worker!nvvm.annotations = !{!1, !2, !3} 50*9880d681SAndroid Build Coastguard Worker!1 = !{void (i64, float*, i32)* @foo, !"kernel", i32 1} 51*9880d681SAndroid Build Coastguard Worker!2 = !{void (float*, i32)* @bar, !"kernel", i32 1} 52*9880d681SAndroid Build Coastguard Worker!3 = !{i64 addrspace(1)* @surf0, !"surface", i32 1} 53*9880d681SAndroid Build Coastguard Worker 54