1; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -O0 -amdgpu-ir-lower-kernel-arguments=0 -stop-after=irtranslator -global-isel %s -o - | FileCheck -check-prefix=HSA %s 2 3; HSA-LABEL: name: default_kernel 4; HSA: liveins: 5; HSA-NEXT: - { reg: '$sgpr0_sgpr1_sgpr2_sgpr3', virtual-reg: '%0' } 6; HSA-NEXT: - { reg: '$vgpr0', virtual-reg: '%1' } 7; HSA-NEXT: - { reg: '$sgpr4', virtual-reg: '%2' } 8; HSA-NEXT: - { reg: '$sgpr5', virtual-reg: '%3' } 9; HSA-NEXT: frameInfo: 10define amdgpu_kernel void @default_kernel() { 11 ret void 12} 13 14 15; HSA-LABEL: name: workgroup_id_x{{$}} 16; HSA: liveins: 17; HSA-NEXT: - { reg: '$sgpr0_sgpr1_sgpr2_sgpr3', virtual-reg: '%0' } 18; HSA-NEXT: - { reg: '$vgpr0', virtual-reg: '%1' } 19; HSA-NEXT: - { reg: '$sgpr4', virtual-reg: '%2' } 20; HSA-NEXT: - { reg: '$sgpr5', virtual-reg: '%3' } 21; HSA-NEXT: frameInfo: 22define amdgpu_kernel void @workgroup_id_x() { 23 %id = call i32 @llvm.amdgcn.workgroup.id.x() 24 store volatile i32 %id, i32 addrspace(1)* undef 25 ret void 26} 27 28; HSA-LABEL: name: workgroup_id_y{{$}} 29; HSA: liveins: 30; HSA-NEXT: - { reg: '$sgpr0_sgpr1_sgpr2_sgpr3', virtual-reg: '%0' } 31; HSA-NEXT: - { reg: '$vgpr0', virtual-reg: '%1' } 32; HSA-NEXT: - { reg: '$sgpr4', virtual-reg: '%2' } 33; HSA-NEXT: - { reg: '$sgpr5', virtual-reg: '%3' } 34; HSA-NEXT: - { reg: '$sgpr6', virtual-reg: '%4' } 35; HSA-NEXT: frameInfo: 36define amdgpu_kernel void @workgroup_id_y() { 37 %id = call i32 @llvm.amdgcn.workgroup.id.y() 38 store volatile i32 %id, i32 addrspace(1)* undef 39 ret void 40} 41 42; HSA-LABEL: name: workgroup_id_z{{$}} 43; HSA: liveins: 44; HSA-NEXT: - { reg: '$sgpr0_sgpr1_sgpr2_sgpr3', virtual-reg: '%0' } 45; HSA-NEXT: - { reg: '$vgpr0', virtual-reg: '%1' } 46; HSA-NEXT: - { reg: '$sgpr4', virtual-reg: '%2' } 47; HSA-NEXT: - { reg: '$sgpr5', virtual-reg: '%3' } 48; HSA-NEXT: - { reg: '$sgpr6', virtual-reg: '%4' } 49; HSA-NEXT: frameInfo: 50define amdgpu_kernel void @workgroup_id_z() { 51 %id = call i32 @llvm.amdgcn.workgroup.id.z() 52 store volatile i32 %id, i32 addrspace(1)* undef 53 ret void 54} 55 56; HSA-LABEL: name: workgroup_id_xy{{$}} 57; HSA: liveins: 58; HSA-NEXT: - { reg: '$sgpr0_sgpr1_sgpr2_sgpr3', virtual-reg: '%0' } 59; HSA-NEXT: - { reg: '$vgpr0', virtual-reg: '%1' } 60; HSA-NEXT: - { reg: '$sgpr4', virtual-reg: '%2' } 61; HSA-NEXT: - { reg: '$sgpr5', virtual-reg: '%3' } 62; HSA-NEXT: - { reg: '$sgpr6', virtual-reg: '%4' } 63; HSA-NEXT: frameInfo: 64define amdgpu_kernel void @workgroup_id_xy() { 65 %id0 = call i32 @llvm.amdgcn.workgroup.id.x() 66 store volatile i32 %id0, i32 addrspace(1)* undef 67 %id1 = call i32 @llvm.amdgcn.workgroup.id.y() 68 store volatile i32 %id1, i32 addrspace(1)* undef 69 ret void 70} 71 72; HSA-LABEL: name: workgroup_id_xyz{{$}} 73; HSA: liveins: 74; HSA-NEXT: - { reg: '$sgpr0_sgpr1_sgpr2_sgpr3', virtual-reg: '%0' } 75; HSA-NEXT: - { reg: '$vgpr0', virtual-reg: '%1' } 76; HSA-NEXT: - { reg: '$sgpr4', virtual-reg: '%2' } 77; HSA-NEXT: - { reg: '$sgpr5', virtual-reg: '%3' } 78; HSA-NEXT: - { reg: '$sgpr6', virtual-reg: '%4' } 79; HSA-NEXT: frameInfo: 80define amdgpu_kernel void @workgroup_id_xyz() { 81 %id0 = call i32 @llvm.amdgcn.workgroup.id.x() 82 store volatile i32 %id0, i32 addrspace(1)* undef 83 %id1 = call i32 @llvm.amdgcn.workgroup.id.y() 84 store volatile i32 %id1, i32 addrspace(1)* undef 85 %id2 = call i32 @llvm.amdgcn.workgroup.id.y() 86 store volatile i32 %id2, i32 addrspace(1)* undef 87 ret void 88} 89 90; HSA-LABEL: name: workgroup_id_yz{{$}} 91; HSA: liveins: 92; HSA-NEXT: - { reg: '$sgpr0_sgpr1_sgpr2_sgpr3', virtual-reg: '%0' } 93; HSA-NEXT: - { reg: '$vgpr0', virtual-reg: '%1' } 94; HSA-NEXT: - { reg: '$sgpr4', virtual-reg: '%2' } 95; HSA-NEXT: - { reg: '$sgpr5', virtual-reg: '%3' } 96; HSA-NEXT: - { reg: '$sgpr6', virtual-reg: '%4' } 97; HSA-NEXT: frameInfo: 98define amdgpu_kernel void @workgroup_id_yz() { 99 %id0 = call i32 @llvm.amdgcn.workgroup.id.x() 100 store volatile i32 %id0, i32 addrspace(1)* undef 101 %id1 = call i32 @llvm.amdgcn.workgroup.id.y() 102 store volatile i32 %id1, i32 addrspace(1)* undef 103 ret void 104} 105 106; HSA-LABEL: name: workgroup_id_xz{{$}} 107; HSA: liveins: 108; HSA-NEXT: - { reg: '$sgpr0_sgpr1_sgpr2_sgpr3', virtual-reg: '%0' } 109; HSA-NEXT: - { reg: '$vgpr0', virtual-reg: '%1' } 110; HSA-NEXT: - { reg: '$sgpr4', virtual-reg: '%2' } 111; HSA-NEXT: - { reg: '$sgpr5', virtual-reg: '%3' } 112; HSA-NEXT: - { reg: '$sgpr6', virtual-reg: '%4' } 113; HSA-NEXT: frameInfo: 114define amdgpu_kernel void @workgroup_id_xz() { 115 %id0 = call i32 @llvm.amdgcn.workgroup.id.x() 116 store volatile i32 %id0, i32 addrspace(1)* undef 117 %id1 = call i32 @llvm.amdgcn.workgroup.id.z() 118 store volatile i32 %id1, i32 addrspace(1)* undef 119 ret void 120} 121 122declare i32 @llvm.amdgcn.workgroup.id.x() #0 123declare i32 @llvm.amdgcn.workgroup.id.y() #0 124declare i32 @llvm.amdgcn.workgroup.id.z() #0 125 126attributes #0 = { nounwind readnone speculatable } 127