1; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s 2; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s 3; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s 4 5; RUN: llc -global-isel -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s 6; RUN: llc -global-isel -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s 7; RUN: llc -global-isel -mtriple=amdgcn--amdhsa -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s 8 9 10; GCN-LABEL: {{^}}s_getreg_test: 11; GCN: s_getreg_b32 s{{[0-9]+}}, hwreg(HW_REG_LDS_ALLOC, 8, 23) 12define amdgpu_kernel void @s_getreg_test(i32 addrspace(1)* %out) { ; simm16=45574 for lds size. 13 %lds_size_64dwords = call i32 @llvm.amdgcn.s.getreg(i32 45574) 14 %lds_size_bytes = shl i32 %lds_size_64dwords, 8 15 store i32 %lds_size_bytes, i32 addrspace(1)* %out 16 ret void 17} 18 19; Call site has additional readnone knowledge. 20; GCN-LABEL: {{^}}readnone_s_getreg_test: 21; GCN: s_getreg_b32 s{{[0-9]+}}, hwreg(HW_REG_LDS_ALLOC, 8, 23) 22define amdgpu_kernel void @readnone_s_getreg_test(i32 addrspace(1)* %out) { ; simm16=45574 for lds size. 23 %lds_size_64dwords = call i32 @llvm.amdgcn.s.getreg(i32 45574) #1 24 %lds_size_bytes = shl i32 %lds_size_64dwords, 8 25 store i32 %lds_size_bytes, i32 addrspace(1)* %out 26 ret void 27} 28 29declare i32 @llvm.amdgcn.s.getreg(i32 immarg) #0 30 31attributes #0 = { nounwind readonly } 32attributes #1 = { nounwind readnone } 33