2021-01-06 12:23:39 +08:00
|
|
|
; RUN: llc -march=amdgcn -mtriple=amdgcn-unknown-amdhsa --amdhsa-code-object-version=2 -mcpu=kaveri -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,CO-V2 %s
|
|
|
|
; RUN: llc -march=amdgcn -mtriple=amdgcn-unknown-amdhsa --amdhsa-code-object-version=2 -mcpu=carrizo -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,CO-V2 %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,UNKNOWN-OS %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,UNKNOWN-OS %s
|
|
|
|
; RUN: llc -mtriple=amdgcn-unknown-mesa3d -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2 %s
|
|
|
|
; RUN: llc -mtriple=amdgcn-unknown-mesa3d -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2 %s
|
2016-01-30 12:25:19 +08:00
|
|
|
|
|
|
|
declare i32 @llvm.amdgcn.workgroup.id.x() #0
|
|
|
|
declare i32 @llvm.amdgcn.workgroup.id.y() #0
|
|
|
|
declare i32 @llvm.amdgcn.workgroup.id.z() #0
|
|
|
|
|
2020-04-03 06:28:32 +08:00
|
|
|
; ALL-LABEL: {{^}}test_workgroup_id_x:
|
2016-01-30 12:25:19 +08:00
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; CO-V2: .amd_kernel_code_t
|
|
|
|
; CO-V2: user_sgpr_count = 6
|
|
|
|
; CO-V2: enable_sgpr_workgroup_id_x = 1
|
|
|
|
; CO-V2: enable_sgpr_workgroup_id_y = 0
|
|
|
|
; CO-V2: enable_sgpr_workgroup_id_z = 0
|
|
|
|
; CO-V2: enable_sgpr_workgroup_info = 0
|
|
|
|
; CO-V2: enable_vgpr_workitem_id = 0
|
|
|
|
; CO-V2: enable_sgpr_grid_workgroup_count_x = 0
|
|
|
|
; CO-V2: enable_sgpr_grid_workgroup_count_y = 0
|
|
|
|
; CO-V2: enable_sgpr_grid_workgroup_count_z = 0
|
|
|
|
; CO-V2: .end_amd_kernel_code_t
|
2016-01-30 12:25:19 +08:00
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; UNKNOWN-OS: v_mov_b32_e32 [[VCOPY:v[0-9]+]], s2{{$}}
|
|
|
|
; CO-V2: v_mov_b32_e32 [[VCOPY:v[0-9]+]], s6{{$}}
|
2016-01-30 12:25:19 +08:00
|
|
|
|
2016-02-13 01:57:54 +08:00
|
|
|
; ALL: {{buffer|flat}}_store_dword {{.*}}[[VCOPY]]
|
2016-01-30 12:25:19 +08:00
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; CO-V2: COMPUTE_PGM_RSRC2:USER_SGPR: 6
|
|
|
|
; ALL-NOCO-V2: COMPUTE_PGM_RSRC2:USER_SGPR: 2
|
2016-01-30 12:25:19 +08:00
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TGID_X_EN: 1
|
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
|
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
|
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_workgroup_id_x(i32 addrspace(1)* %out) #1 {
|
2016-01-30 12:25:19 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workgroup.id.x()
|
|
|
|
store i32 %id, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2020-04-03 06:28:32 +08:00
|
|
|
; ALL-LABEL: {{^}}test_workgroup_id_y:
|
2016-09-17 05:34:26 +08:00
|
|
|
; CO-V2: user_sgpr_count = 6
|
|
|
|
; CO-V2: enable_sgpr_workgroup_id_x = 1
|
|
|
|
; CO-V2: enable_sgpr_workgroup_id_y = 1
|
|
|
|
; CO-V2: enable_sgpr_workgroup_id_z = 0
|
|
|
|
; CO-V2: enable_sgpr_workgroup_info = 0
|
|
|
|
; CO-V2: enable_sgpr_grid_workgroup_count_x = 0
|
|
|
|
; CO-V2: enable_sgpr_grid_workgroup_count_y = 0
|
|
|
|
; CO-V2: enable_sgpr_grid_workgroup_count_z = 0
|
2016-01-30 12:25:19 +08:00
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; UNKNOWN-OS: v_mov_b32_e32 [[VCOPY:v[0-9]+]], s3{{$}}
|
2016-01-30 12:25:19 +08:00
|
|
|
; HSA: v_mov_b32_e32 [[VCOPY:v[0-9]+]], s7{{$}}
|
|
|
|
|
2016-02-13 01:57:54 +08:00
|
|
|
; ALL: {{buffer|flat}}_store_dword {{.*}}[[VCOPY]]
|
2016-01-30 12:25:19 +08:00
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; CO-V2: COMPUTE_PGM_RSRC2:USER_SGPR: 6
|
|
|
|
; ALL-NOCO-V2: COMPUTE_PGM_RSRC2:USER_SGPR: 2
|
2016-01-30 12:25:19 +08:00
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TGID_X_EN: 1
|
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
|
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
|
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_workgroup_id_y(i32 addrspace(1)* %out) #1 {
|
2016-01-30 12:25:19 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workgroup.id.y()
|
|
|
|
store i32 %id, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2020-04-03 06:28:32 +08:00
|
|
|
; ALL-LABEL: {{^}}test_workgroup_id_z:
|
2016-09-17 05:34:26 +08:00
|
|
|
; CO-V2: user_sgpr_count = 6
|
|
|
|
; CO-V2: enable_sgpr_workgroup_id_x = 1
|
|
|
|
; CO-V2: enable_sgpr_workgroup_id_y = 0
|
|
|
|
; CO-V2: enable_sgpr_workgroup_id_z = 1
|
|
|
|
; CO-V2: enable_sgpr_workgroup_info = 0
|
|
|
|
; CO-V2: enable_vgpr_workitem_id = 0
|
|
|
|
; CO-V2: enable_sgpr_private_segment_buffer = 1
|
|
|
|
; CO-V2: enable_sgpr_dispatch_ptr = 0
|
|
|
|
; CO-V2: enable_sgpr_queue_ptr = 0
|
|
|
|
; CO-V2: enable_sgpr_kernarg_segment_ptr = 1
|
|
|
|
; CO-V2: enable_sgpr_dispatch_id = 0
|
|
|
|
; CO-V2: enable_sgpr_flat_scratch_init = 0
|
|
|
|
; CO-V2: enable_sgpr_private_segment_size = 0
|
|
|
|
; CO-V2: enable_sgpr_grid_workgroup_count_x = 0
|
|
|
|
; CO-V2: enable_sgpr_grid_workgroup_count_y = 0
|
|
|
|
; CO-V2: enable_sgpr_grid_workgroup_count_z = 0
|
2016-01-30 12:25:19 +08:00
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; UNKNOWN-OS: v_mov_b32_e32 [[VCOPY:v[0-9]+]], s3{{$}}
|
2016-01-30 12:25:19 +08:00
|
|
|
; HSA: v_mov_b32_e32 [[VCOPY:v[0-9]+]], s7{{$}}
|
|
|
|
|
2016-02-13 01:57:54 +08:00
|
|
|
; ALL: {{buffer|flat}}_store_dword {{.*}}[[VCOPY]]
|
2016-01-30 12:25:19 +08:00
|
|
|
|
2016-09-17 05:34:26 +08:00
|
|
|
; CO-V2: COMPUTE_PGM_RSRC2:USER_SGPR: 6
|
|
|
|
; ALL-NOCO-V2: COMPUTE_PGM_RSRC2:USER_SGPR: 2
|
2016-01-30 12:25:19 +08:00
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TGID_X_EN: 1
|
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
|
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TGID_Z_EN: 1
|
|
|
|
; ALL: COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_workgroup_id_z(i32 addrspace(1)* %out) #1 {
|
2016-01-30 12:25:19 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workgroup.id.z()
|
|
|
|
store i32 %id, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
attributes #0 = { nounwind readnone }
|
|
|
|
attributes #1 = { nounwind }
|