2018-11-15 10:32:43 +08:00
|
|
|
; RUN: llc -mtriple=amdgcn--amdhsa -mattr=-code-object-v3 -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefixes=CO-V2,HSA,ALL %s
|
2016-09-17 05:34:26 +08:00
|
|
|
; RUN: llc -mtriple=amdgcn-mesa-mesa3d -verify-machineinstrs < %s | FileCheck -check-prefixes=CO-V2,OS-MESA3D,MESA,ALL %s
|
|
|
|
; RUN: llc -mtriple=amdgcn-mesa-unknown -verify-machineinstrs < %s | FileCheck -check-prefixes=OS-UNKNOWN,MESA,ALL %s
|
2016-04-30 05:16:52 +08:00
|
|
|
|
|
|
|
; ALL-LABEL: {{^}}test:
|
2016-09-17 05:34:26 +08:00
|
|
|
; CO-V2: enable_sgpr_kernarg_segment_ptr = 1
|
2018-05-30 03:35:00 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 8
|
|
|
|
; HSA: kernarg_segment_alignment = 4
|
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; CO-V2: s_load_dword s{{[0-9]+}}, s[4:5], 0xa
|
2016-04-30 05:16:52 +08:00
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; OS-UNKNOWN: s_load_dword s{{[0-9]+}}, s[0:1], 0xa
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test(i32 addrspace(1)* %out) #1 {
|
2018-02-14 02:00:25 +08:00
|
|
|
%kernarg.segment.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr()
|
|
|
|
%header.ptr = bitcast i8 addrspace(4)* %kernarg.segment.ptr to i32 addrspace(4)*
|
|
|
|
%gep = getelementptr i32, i32 addrspace(4)* %header.ptr, i64 10
|
|
|
|
%value = load i32, i32 addrspace(4)* %gep
|
2016-04-30 05:16:52 +08:00
|
|
|
store i32 %value, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-06-22 04:46:20 +08:00
|
|
|
; ALL-LABEL: {{^}}test_implicit:
|
2018-05-30 03:35:00 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 8
|
|
|
|
; OS-MESA3D: kernarg_segment_byte_size = 24
|
|
|
|
; CO-V2: kernarg_segment_alignment = 4
|
|
|
|
|
2016-06-22 04:46:20 +08:00
|
|
|
; 10 + 9 (36 prepended implicit bytes) + 2(out pointer) = 21 = 0x15
|
2016-09-17 05:34:26 +08:00
|
|
|
; OS-UNKNOWN: s_load_dword s{{[0-9]+}}, s[0:1], 0x15
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_implicit(i32 addrspace(1)* %out) #1 {
|
2018-02-14 02:00:25 +08:00
|
|
|
%implicitarg.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%header.ptr = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%gep = getelementptr i32, i32 addrspace(4)* %header.ptr, i64 10
|
|
|
|
%value = load i32, i32 addrspace(4)* %gep
|
2016-06-22 04:46:20 +08:00
|
|
|
store i32 %value, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-05-30 03:35:00 +08:00
|
|
|
; ALL-LABEL: {{^}}test_implicit_alignment:
|
|
|
|
; HSA: kernarg_segment_byte_size = 12
|
2016-09-23 09:33:26 +08:00
|
|
|
; OS-MESA3D: kernarg_segment_byte_size = 28
|
2018-05-30 03:35:00 +08:00
|
|
|
; CO-V2: kernarg_segment_alignment = 4
|
|
|
|
|
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; OS-UNKNOWN: s_load_dword [[VAL:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0xc
|
2016-09-10 03:28:00 +08:00
|
|
|
; HSA: s_load_dword [[VAL:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0x4
|
2016-09-17 05:34:26 +08:00
|
|
|
; OS-MESA3D: s_load_dword [[VAL:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0x3
|
2016-09-01 02:46:07 +08:00
|
|
|
; ALL: v_mov_b32_e32 [[V_VAL:v[0-9]+]], [[VAL]]
|
|
|
|
; MESA: buffer_store_dword [[V_VAL]]
|
|
|
|
; HSA: flat_store_dword v[{{[0-9]+:[0-9]+}}], [[V_VAL]]
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_implicit_alignment(i32 addrspace(1)* %out, <2 x i8> %in) #1 {
|
2018-02-14 02:00:25 +08:00
|
|
|
%implicitarg.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%arg.ptr = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%val = load i32, i32 addrspace(4)* %arg.ptr
|
2016-09-01 02:46:07 +08:00
|
|
|
store i32 %val, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-03-24 02:45:18 +08:00
|
|
|
; ALL-LABEL: {{^}}opencl_test_implicit_alignment
|
2018-03-24 02:58:47 +08:00
|
|
|
; HSA: kernarg_segment_byte_size = 64
|
2018-03-24 02:45:18 +08:00
|
|
|
; OS-MESA3D: kernarg_segment_byte_size = 28
|
2018-05-30 03:35:00 +08:00
|
|
|
; CO-V2: kernarg_segment_alignment = 4
|
|
|
|
|
|
|
|
|
2018-03-24 02:45:18 +08:00
|
|
|
; OS-UNKNOWN: s_load_dword [[VAL:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0xc
|
|
|
|
; HSA: s_load_dword [[VAL:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0x4
|
|
|
|
; OS-MESA3D: s_load_dword [[VAL:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0x3
|
|
|
|
; ALL: v_mov_b32_e32 [[V_VAL:v[0-9]+]], [[VAL]]
|
|
|
|
; MESA: buffer_store_dword [[V_VAL]]
|
|
|
|
; HSA: flat_store_dword v[{{[0-9]+:[0-9]+}}], [[V_VAL]]
|
|
|
|
define amdgpu_kernel void @opencl_test_implicit_alignment(i32 addrspace(1)* %out, <2 x i8> %in) #2 {
|
|
|
|
%implicitarg.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%arg.ptr = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%val = load i32, i32 addrspace(4)* %arg.ptr
|
|
|
|
store i32 %val, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-07-14 08:11:13 +08:00
|
|
|
; ALL-LABEL: {{^}}test_no_kernargs:
|
2018-05-30 03:35:00 +08:00
|
|
|
; CO-V2: enable_sgpr_kernarg_segment_ptr = 1
|
|
|
|
; HSA: kernarg_segment_byte_size = 0
|
|
|
|
; OS-MESA3D: kernarg_segment_byte_size = 16
|
2018-07-20 17:05:08 +08:00
|
|
|
; CO-V2: kernarg_segment_alignment = 4
|
2018-05-30 03:35:00 +08:00
|
|
|
|
2017-07-14 08:11:13 +08:00
|
|
|
; HSA: s_load_dword s{{[0-9]+}}, s[4:5]
|
|
|
|
define amdgpu_kernel void @test_no_kernargs() #1 {
|
2018-02-14 02:00:25 +08:00
|
|
|
%kernarg.segment.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr()
|
|
|
|
%header.ptr = bitcast i8 addrspace(4)* %kernarg.segment.ptr to i32 addrspace(4)*
|
|
|
|
%gep = getelementptr i32, i32 addrspace(4)* %header.ptr, i64 10
|
|
|
|
%value = load i32, i32 addrspace(4)* %gep
|
2017-07-14 08:11:13 +08:00
|
|
|
store volatile i32 %value, i32 addrspace(1)* undef
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-05-30 03:35:00 +08:00
|
|
|
; GCN-LABEL: {{^}}opencl_test_implicit_alignment_no_explicit_kernargs:
|
|
|
|
; HSA: kernarg_segment_byte_size = 48
|
|
|
|
; OS-MESA3d: kernarg_segment_byte_size = 16
|
|
|
|
; CO-V2: kernarg_segment_alignment = 4
|
|
|
|
define amdgpu_kernel void @opencl_test_implicit_alignment_no_explicit_kernargs() #2 {
|
|
|
|
%implicitarg.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%arg.ptr = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%val = load volatile i32, i32 addrspace(4)* %arg.ptr
|
|
|
|
store volatile i32 %val, i32 addrspace(1)* null
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}opencl_test_implicit_alignment_no_explicit_kernargs_round_up:
|
|
|
|
; HSA: kernarg_segment_byte_size = 40
|
|
|
|
; OS-MESA3D: kernarg_segment_byte_size = 16
|
|
|
|
; CO-V2: kernarg_segment_alignment = 4
|
|
|
|
define amdgpu_kernel void @opencl_test_implicit_alignment_no_explicit_kernargs_round_up() #3 {
|
|
|
|
%implicitarg.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
|
|
|
|
%arg.ptr = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
|
|
|
|
%val = load volatile i32, i32 addrspace(4)* %arg.ptr
|
|
|
|
store volatile i32 %val, i32 addrspace(1)* null
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-02-14 02:00:25 +08:00
|
|
|
declare i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr() #0
|
|
|
|
declare i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr() #0
|
2016-04-30 05:16:52 +08:00
|
|
|
|
|
|
|
attributes #0 = { nounwind readnone }
|
|
|
|
attributes #1 = { nounwind }
|
2018-03-24 02:58:47 +08:00
|
|
|
attributes #2 = { nounwind "amdgpu-implicitarg-num-bytes"="48" }
|
2018-05-30 03:35:00 +08:00
|
|
|
attributes #3 = { nounwind "amdgpu-implicitarg-num-bytes"="38" }
|