2018-03-24 02:45:18 +08:00
|
|
|
; RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,HSA %s
|
2017-08-04 07:24:05 +08:00
|
|
|
; RUN: llc -mtriple=amdgcn-mesa-mesa3d -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,MESA %s
|
2017-07-28 23:52:08 +08:00
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}kernel_implicitarg_ptr_empty:
|
|
|
|
; GCN: enable_sgpr_kernarg_segment_ptr = 1
|
|
|
|
|
2018-03-24 02:45:18 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 0
|
2017-07-28 23:52:08 +08:00
|
|
|
; MESA: kernarg_segment_byte_size = 16
|
|
|
|
|
|
|
|
; HSA: s_load_dword s0, s[4:5], 0x0
|
|
|
|
define amdgpu_kernel void @kernel_implicitarg_ptr_empty() #0 {
|
2018-02-14 02:00:25 +08:00
|
|
|
%implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%cast = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%load = load volatile i32, i32 addrspace(4)* %cast
|
2017-07-28 23:52:08 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-03-24 02:45:18 +08:00
|
|
|
; GCN-LABEL: {{^}}opencl_kernel_implicitarg_ptr_empty:
|
|
|
|
; GCN: enable_sgpr_kernarg_segment_ptr = 1
|
|
|
|
|
2018-03-24 02:58:47 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 48
|
2018-03-24 02:45:18 +08:00
|
|
|
; MESA: kernarg_segment_byte_size = 16
|
|
|
|
|
|
|
|
; HSA: s_load_dword s0, s[4:5], 0x0
|
|
|
|
define amdgpu_kernel void @opencl_kernel_implicitarg_ptr_empty() #1 {
|
|
|
|
%implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%cast = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%load = load volatile i32, i32 addrspace(4)* %cast
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-07-28 23:52:08 +08:00
|
|
|
; GCN-LABEL: {{^}}kernel_implicitarg_ptr:
|
|
|
|
; GCN: enable_sgpr_kernarg_segment_ptr = 1
|
|
|
|
|
2018-03-24 02:45:18 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 112
|
2018-07-20 17:05:08 +08:00
|
|
|
; MESA: kernarg_segment_byte_size = 128
|
2017-07-28 23:52:08 +08:00
|
|
|
|
|
|
|
; HSA: s_load_dword s0, s[4:5], 0x1c
|
|
|
|
define amdgpu_kernel void @kernel_implicitarg_ptr([112 x i8]) #0 {
|
2018-02-14 02:00:25 +08:00
|
|
|
%implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%cast = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%load = load volatile i32, i32 addrspace(4)* %cast
|
2017-07-28 23:52:08 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-03-24 02:45:18 +08:00
|
|
|
; GCN-LABEL: {{^}}opencl_kernel_implicitarg_ptr:
|
|
|
|
; GCN: enable_sgpr_kernarg_segment_ptr = 1
|
|
|
|
|
2018-03-24 02:58:47 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 160
|
2018-07-20 17:05:08 +08:00
|
|
|
; MESA: kernarg_segment_byte_size = 128
|
2018-03-24 02:45:18 +08:00
|
|
|
|
|
|
|
; HSA: s_load_dword s0, s[4:5], 0x1c
|
|
|
|
define amdgpu_kernel void @opencl_kernel_implicitarg_ptr([112 x i8]) #1 {
|
|
|
|
%implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%cast = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%load = load volatile i32, i32 addrspace(4)* %cast
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-08-04 07:12:44 +08:00
|
|
|
; GCN-LABEL: {{^}}func_implicitarg_ptr:
|
|
|
|
; GCN: s_waitcnt
|
2018-08-03 06:53:57 +08:00
|
|
|
; MESA: v_mov_b32_e32 v0, s6
|
|
|
|
; MESA: v_mov_b32_e32 v1, s7
|
|
|
|
; MESA: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
|
2018-03-05 23:12:21 +08:00
|
|
|
; HSA: v_mov_b32_e32 v0, s6
|
|
|
|
; HSA: v_mov_b32_e32 v1, s7
|
|
|
|
; HSA: flat_load_dword v0, v[0:1]
|
2017-08-04 07:12:44 +08:00
|
|
|
; GCN-NEXT: s_waitcnt
|
|
|
|
; GCN-NEXT: s_setpc_b64
|
2018-03-24 02:45:18 +08:00
|
|
|
define void @func_implicitarg_ptr() #0 {
|
|
|
|
%implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%cast = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%load = load volatile i32, i32 addrspace(4)* %cast
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}opencl_func_implicitarg_ptr:
|
|
|
|
; GCN: s_waitcnt
|
2018-08-03 06:53:57 +08:00
|
|
|
; MESA: v_mov_b32_e32 v0, s6
|
|
|
|
; MESA: v_mov_b32_e32 v1, s7
|
|
|
|
; MESA: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
|
2018-03-24 02:45:18 +08:00
|
|
|
; HSA: v_mov_b32_e32 v0, s6
|
|
|
|
; HSA: v_mov_b32_e32 v1, s7
|
|
|
|
; HSA: flat_load_dword v0, v[0:1]
|
|
|
|
; GCN-NEXT: s_waitcnt
|
|
|
|
; GCN-NEXT: s_setpc_b64
|
|
|
|
define void @opencl_func_implicitarg_ptr() #0 {
|
2018-02-14 02:00:25 +08:00
|
|
|
%implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%cast = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%load = load volatile i32, i32 addrspace(4)* %cast
|
2017-08-04 07:12:44 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}kernel_call_implicitarg_ptr_func_empty:
|
|
|
|
; GCN: enable_sgpr_kernarg_segment_ptr = 1
|
2018-03-24 02:45:18 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 0
|
2017-08-04 07:12:44 +08:00
|
|
|
; MESA: kernarg_segment_byte_size = 16
|
|
|
|
; GCN: s_mov_b64 s[6:7], s[4:5]
|
|
|
|
; GCN: s_swappc_b64
|
|
|
|
define amdgpu_kernel void @kernel_call_implicitarg_ptr_func_empty() #0 {
|
|
|
|
call void @func_implicitarg_ptr()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-03-24 02:45:18 +08:00
|
|
|
; GCN-LABEL: {{^}}opencl_kernel_call_implicitarg_ptr_func_empty:
|
|
|
|
; GCN: enable_sgpr_kernarg_segment_ptr = 1
|
2018-03-24 02:58:47 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 48
|
2018-03-24 02:45:18 +08:00
|
|
|
; MESA: kernarg_segment_byte_size = 16
|
|
|
|
; GCN: s_mov_b64 s[6:7], s[4:5]
|
|
|
|
; GCN: s_swappc_b64
|
|
|
|
define amdgpu_kernel void @opencl_kernel_call_implicitarg_ptr_func_empty() #1 {
|
|
|
|
call void @func_implicitarg_ptr()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-08-04 07:12:44 +08:00
|
|
|
; GCN-LABEL: {{^}}kernel_call_implicitarg_ptr_func:
|
|
|
|
; GCN: enable_sgpr_kernarg_segment_ptr = 1
|
2018-03-24 02:45:18 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 112
|
2018-07-20 17:05:08 +08:00
|
|
|
; MESA: kernarg_segment_byte_size = 128
|
2017-08-04 07:12:44 +08:00
|
|
|
|
|
|
|
; HSA: s_add_u32 s6, s4, 0x70
|
2018-07-20 17:05:08 +08:00
|
|
|
; MESA: s_add_u32 s6, s4, 0x70
|
2017-08-04 07:12:44 +08:00
|
|
|
|
|
|
|
; GCN: s_addc_u32 s7, s5, 0{{$}}
|
|
|
|
; GCN: s_swappc_b64
|
|
|
|
define amdgpu_kernel void @kernel_call_implicitarg_ptr_func([112 x i8]) #0 {
|
|
|
|
call void @func_implicitarg_ptr()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-03-24 02:45:18 +08:00
|
|
|
; GCN-LABEL: {{^}}opencl_kernel_call_implicitarg_ptr_func:
|
|
|
|
; GCN: enable_sgpr_kernarg_segment_ptr = 1
|
2018-03-24 02:58:47 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 160
|
2018-07-20 17:05:08 +08:00
|
|
|
; MESA: kernarg_segment_byte_size = 128
|
2018-03-24 02:45:18 +08:00
|
|
|
|
2018-07-20 17:05:08 +08:00
|
|
|
; GCN: s_add_u32 s6, s4, 0x70
|
2018-03-24 02:45:18 +08:00
|
|
|
|
|
|
|
; GCN: s_addc_u32 s7, s5, 0{{$}}
|
|
|
|
; GCN: s_swappc_b64
|
|
|
|
define amdgpu_kernel void @opencl_kernel_call_implicitarg_ptr_func([112 x i8]) #1 {
|
|
|
|
call void @func_implicitarg_ptr()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-08-04 07:12:44 +08:00
|
|
|
; GCN-LABEL: {{^}}func_call_implicitarg_ptr_func:
|
|
|
|
; GCN-NOT: s6
|
|
|
|
; GCN-NOT: s7
|
|
|
|
; GCN-NOT: s[6:7]
|
2018-03-24 02:45:18 +08:00
|
|
|
define void @func_call_implicitarg_ptr_func() #0 {
|
|
|
|
call void @func_implicitarg_ptr()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}opencl_func_call_implicitarg_ptr_func:
|
|
|
|
; GCN-NOT: s6
|
|
|
|
; GCN-NOT: s7
|
|
|
|
; GCN-NOT: s[6:7]
|
|
|
|
define void @opencl_func_call_implicitarg_ptr_func() #0 {
|
2017-08-04 07:12:44 +08:00
|
|
|
call void @func_implicitarg_ptr()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}func_kernarg_implicitarg_ptr:
|
|
|
|
; GCN: s_waitcnt
|
2018-08-03 06:53:57 +08:00
|
|
|
; MESA: v_mov_b32_e32 v0, s6
|
|
|
|
; MESA: v_mov_b32_e32 v1, s7
|
|
|
|
; MESA: v_mov_b32_e32 v2, s8
|
|
|
|
; MESA: v_mov_b32_e32 v3, s9
|
|
|
|
; MESA: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
|
2018-03-05 23:12:21 +08:00
|
|
|
; HSA: v_mov_b32_e32 v0, s6
|
|
|
|
; HSA: v_mov_b32_e32 v1, s7
|
|
|
|
; HSA: flat_load_dword v0, v[0:1]
|
2018-08-03 06:53:57 +08:00
|
|
|
; MESA: buffer_load_dword v0, v[2:3], s[8:11], 0 addr64
|
2018-03-05 23:12:21 +08:00
|
|
|
; HSA: v_mov_b32_e32 v0, s8
|
|
|
|
; HSA: v_mov_b32_e32 v1, s9
|
|
|
|
; HSA: flat_load_dword v0, v[0:1]
|
|
|
|
|
|
|
|
; GCN: s_waitcnt vmcnt(0)
|
2018-03-24 02:45:18 +08:00
|
|
|
define void @func_kernarg_implicitarg_ptr() #0 {
|
|
|
|
%kernarg.segment.ptr = call i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr()
|
|
|
|
%implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%cast.kernarg.segment.ptr = bitcast i8 addrspace(4)* %kernarg.segment.ptr to i32 addrspace(4)*
|
|
|
|
%cast.implicitarg = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%load0 = load volatile i32, i32 addrspace(4)* %cast.kernarg.segment.ptr
|
|
|
|
%load1 = load volatile i32, i32 addrspace(4)* %cast.implicitarg
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}opencl_func_kernarg_implicitarg_ptr:
|
|
|
|
; GCN: s_waitcnt
|
2018-08-03 06:53:57 +08:00
|
|
|
; MESA: v_mov_b32_e32 v0, s6
|
|
|
|
; MESA: v_mov_b32_e32 v1, s7
|
|
|
|
; MESA: v_mov_b32_e32 v2, s8
|
|
|
|
; MESA: v_mov_b32_e32 v3, s9
|
|
|
|
; MESA: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
|
2018-03-24 02:45:18 +08:00
|
|
|
; HSA: v_mov_b32_e32 v0, s6
|
|
|
|
; HSA: v_mov_b32_e32 v1, s7
|
|
|
|
; HSA: flat_load_dword v0, v[0:1]
|
2018-08-03 06:53:57 +08:00
|
|
|
; MESA: buffer_load_dword v0, v[2:3], s[8:11], 0 addr64
|
2018-03-24 02:45:18 +08:00
|
|
|
; HSA: v_mov_b32_e32 v0, s8
|
|
|
|
; HSA: v_mov_b32_e32 v1, s9
|
|
|
|
; HSA: flat_load_dword v0, v[0:1]
|
|
|
|
|
|
|
|
; GCN: s_waitcnt vmcnt(0)
|
|
|
|
define void @opencl_func_kernarg_implicitarg_ptr() #0 {
|
2018-02-14 02:00:25 +08:00
|
|
|
%kernarg.segment.ptr = call i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr()
|
|
|
|
%implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%cast.kernarg.segment.ptr = bitcast i8 addrspace(4)* %kernarg.segment.ptr to i32 addrspace(4)*
|
|
|
|
%cast.implicitarg = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%load0 = load volatile i32, i32 addrspace(4)* %cast.kernarg.segment.ptr
|
|
|
|
%load1 = load volatile i32, i32 addrspace(4)* %cast.implicitarg
|
2017-08-04 07:12:44 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}kernel_call_kernarg_implicitarg_ptr_func:
|
|
|
|
; GCN: s_mov_b64 s[6:7], s[4:5]
|
2018-07-20 17:05:08 +08:00
|
|
|
; GCN: s_add_u32 s8, s6, 0x70
|
2017-08-04 07:12:44 +08:00
|
|
|
; GCN: s_addc_u32 s9, s7, 0
|
|
|
|
; GCN: s_swappc_b64
|
|
|
|
define amdgpu_kernel void @kernel_call_kernarg_implicitarg_ptr_func([112 x i8]) #0 {
|
|
|
|
call void @func_kernarg_implicitarg_ptr()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-06-30 01:31:42 +08:00
|
|
|
; GCN-LABEL: {{^}}kernel_implicitarg_no_struct_align_padding:
|
|
|
|
; HSA: kernarg_segment_byte_size = 120
|
|
|
|
; MESA: kernarg_segment_byte_size = 84
|
|
|
|
; GCN: kernarg_segment_alignment = 6
|
|
|
|
define amdgpu_kernel void @kernel_implicitarg_no_struct_align_padding(<16 x i32>, i32) #1 {
|
|
|
|
%implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%cast = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%load = load volatile i32, i32 addrspace(4)* %cast
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-02-14 02:00:25 +08:00
|
|
|
declare i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr() #2
|
|
|
|
declare i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr() #2
|
2017-07-28 23:52:08 +08:00
|
|
|
|
|
|
|
attributes #0 = { nounwind noinline }
|
2018-03-24 02:58:47 +08:00
|
|
|
attributes #1 = { nounwind noinline "amdgpu-implicitarg-num-bytes"="48" }
|
2017-07-28 23:52:08 +08:00
|
|
|
attributes #2 = { nounwind readnone speculatable }
|