3
3
; Make sure flat_scratch_init is set
4
4
5
5
; GCN-LABEL: {{^}}stack_object_addrspacecast_in_kernel_no_calls:
6
- ; GCN: .amdhsa_user_sgpr_flat_scratch_init 1
6
+ ; GCN: s_add_u32 flat_scratch_lo, s4, s7
7
+ ; GCN: s_addc_u32 flat_scratch_hi, s5, 0
8
+ ; GCN: flat_store_dword
9
+ ; GCN: .amdhsa_user_sgpr_flat_scratch_init 1
10
+ ; GCN: .amdhsa_system_sgpr_private_segment_wavefront_offset
11
+ ; GCN-NOT: .amdhsa_reserve_flat_scratch
12
+ ; GCN: COMPUTE_PGM_RSRC2:SCRATCH_EN: 1
13
+ ; GCN: COMPUTE_PGM_RSRC2:USER_SGPR: 6
7
14
define amdgpu_kernel void @stack_object_addrspacecast_in_kernel_no_calls () {
8
15
%alloca = alloca i32 , addrspace (5 )
9
16
%cast = addrspacecast i32 addrspace (5 )* %alloca to i32*
@@ -13,15 +20,29 @@ define amdgpu_kernel void @stack_object_addrspacecast_in_kernel_no_calls() {
13
20
14
21
; TODO: Could optimize out in this case
15
22
; GCN-LABEL: {{^}}stack_object_in_kernel_no_calls:
16
- ; GCN: .amdhsa_user_sgpr_flat_scratch_init 1
23
+ ; GCN: s_add_u32 flat_scratch_lo, s4, s7
24
+ ; GCN: s_addc_u32 flat_scratch_hi, s5, 0
25
+ ; GCN: buffer_store_dword
26
+ ; GCN: .amdhsa_user_sgpr_private_segment_buffer 1
27
+ ; GCN: .amdhsa_user_sgpr_flat_scratch_init 1
28
+ ; GCN: .amdhsa_system_sgpr_private_segment_wavefront_offset 1
29
+ ; GCN-NOT: .amdhsa_reserve_flat_scratch
30
+ ; GCN: COMPUTE_PGM_RSRC2:SCRATCH_EN: 1
31
+ ; GCN: COMPUTE_PGM_RSRC2:USER_SGPR: 6
17
32
define amdgpu_kernel void @stack_object_in_kernel_no_calls () {
18
33
%alloca = alloca i32 , addrspace (5 )
19
34
store volatile i32 0 , i32 addrspace (5 )* %alloca
20
35
ret void
21
36
}
22
37
23
38
; GCN-LABEL: {{^}}kernel_no_calls_no_stack:
24
- ; GCN: .amdhsa_user_sgpr_flat_scratch_init 0
39
+ ; GCN-NOT: flat_scratch
40
+ ; GCN: .amdhsa_user_sgpr_private_segment_buffer 1
41
+ ; GCN: .amdhsa_user_sgpr_flat_scratch_init 0
42
+ ; GCN: .amdhsa_system_sgpr_private_segment_wavefront_offset 0
43
+ ; GCN: .amdhsa_reserve_flat_scratch 0
44
+ ; GCN: COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
45
+ ; GCN: COMPUTE_PGM_RSRC2:USER_SGPR: 4
25
46
define amdgpu_kernel void @kernel_no_calls_no_stack () {
26
47
ret void
27
48
}
0 commit comments