Even in cases where handles are supported, references are still preferable for performance. This is because, a ref uses one less register and can avoid the handle creating code associated with taking the address of a tex/surf/sampler.
55 lines
1.9 KiB
LLVM
55 lines
1.9 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
|
|
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_20 -verify-machineinstrs | FileCheck %s
|
|
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_30 -verify-machineinstrs | FileCheck %s
|
|
; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_20 -verify-machineinstrs | %ptxas-verify %}
|
|
; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_30 -verify-machineinstrs | %ptxas-verify %}
|
|
|
|
target triple = "nvptx-unknown-cuda"
|
|
|
|
declare void @llvm.nvvm.sust.b.1d.i32.trap(i64, i32, i32)
|
|
declare i64 @llvm.nvvm.texsurf.handle.internal.p1(ptr addrspace(1))
|
|
|
|
|
|
define void @foo(i64 %img, i32 %val, i32 %idx) {
|
|
; CHECK-LABEL: foo(
|
|
; CHECK: {
|
|
; CHECK-NEXT: .reg .b32 %r<3>;
|
|
; CHECK-NEXT: .reg .b64 %rd<2>;
|
|
; CHECK-EMPTY:
|
|
; CHECK-NEXT: // %bb.0:
|
|
; CHECK-NEXT: ld.param.u64 %rd1, [foo_param_0];
|
|
; CHECK-NEXT: ld.param.u32 %r1, [foo_param_1];
|
|
; CHECK-NEXT: ld.param.u32 %r2, [foo_param_2];
|
|
; CHECK-NEXT: sust.b.1d.b32.trap [%rd1, {%r2}], {%r1};
|
|
; CHECK-NEXT: ret;
|
|
tail call void @llvm.nvvm.sust.b.1d.i32.trap(i64 %img, i32 %idx, i32 %val)
|
|
ret void
|
|
}
|
|
|
|
|
|
@surf0 = internal addrspace(1) global i64 0, align 8
|
|
|
|
|
|
define void @bar(i32 %val, i32 %idx) {
|
|
; CHECK-LABEL: bar(
|
|
; CHECK: {
|
|
; CHECK-NEXT: .reg .b32 %r<3>;
|
|
; CHECK-NEXT: .reg .b64 %rd<2>;
|
|
; CHECK-EMPTY:
|
|
; CHECK-NEXT: // %bb.0:
|
|
; CHECK-NEXT: ld.param.u32 %r1, [bar_param_0];
|
|
; CHECK-NEXT: ld.param.u32 %r2, [bar_param_1];
|
|
; CHECK-NEXT: sust.b.1d.b32.trap [surf0, {%r2}], {%r1};
|
|
; CHECK-NEXT: ret;
|
|
%surfHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1(ptr addrspace(1) @surf0)
|
|
tail call void @llvm.nvvm.sust.b.1d.i32.trap(i64 %surfHandle, i32 %idx, i32 %val)
|
|
ret void
|
|
}
|
|
|
|
|
|
!nvvm.annotations = !{!1, !2, !3}
|
|
!1 = !{ptr @foo, !"kernel", i32 1}
|
|
!2 = !{ptr @bar, !"kernel", i32 1}
|
|
!3 = !{ptr addrspace(1) @surf0, !"surface", i32 1}
|
|
|