39 lines · plain
1; RUN: llc -mattr=+promote-alloca -mtriple=amdgcn < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s2; RUN: llc -mattr=+promote-alloca,-flat-for-global -mtriple=amdgcn--amdhsa -mcpu=kaveri < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s3; RUN: llc -mattr=-promote-alloca -mtriple=amdgcn < %s | FileCheck --check-prefixes=GCN,GCN-ALLOCA %s4; RUN: llc -mattr=-promote-alloca,-flat-for-global -mtriple=amdgcn-amdhsa -mcpu=kaveri < %s | FileCheck --check-prefixes=GCN,GCN-ALLOCA %s5; RUN: llc -mattr=+promote-alloca -mtriple=amdgcn -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s6; RUN: llc -mattr=-promote-alloca -mtriple=amdgcn -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck --check-prefixes=GCN,GCN-ALLOCA %s7 8 9declare i32 @llvm.amdgcn.workitem.id.x() nounwind readnone10 11 12; Make sure we don't overwrite workitem information with private memory13 14; GCN-LABEL: {{^}}work_item_info:15; GCN-NOT: v016; GCN: s_load_dword [[IN:s[0-9]+]]17; GCN-NOT: v018 19; GCN-ALLOCA: v_add_{{[iu]}}32_e32 [[RESULT:v[0-9]+]], vcc, v{{[0-9]+}}, v020 21; GCN-PROMOTE: s_cmp_eq_u32 [[IN]], 122; GCN-PROMOTE-NEXT: s_cselect_b32 [[SCC:s[0-9]+]], 1, 023; GCN-PROMOTE-NEXT: v_add_{{[iu]}}32_e32 [[RESULT:v[0-9]+]], vcc, [[SCC]], v024 25; GCN: buffer_store_dword [[RESULT]]26define amdgpu_kernel void @work_item_info(ptr addrspace(1) %out, i32 %in) {27entry:28 %0 = alloca [2 x i32], addrspace(5)29 %1 = getelementptr [2 x i32], ptr addrspace(5) %0, i32 0, i32 130 store i32 0, ptr addrspace(5) %031 store i32 1, ptr addrspace(5) %132 %2 = getelementptr [2 x i32], ptr addrspace(5) %0, i32 0, i32 %in33 %3 = load i32, ptr addrspace(5) %234 %4 = call i32 @llvm.amdgcn.workitem.id.x()35 %5 = add i32 %3, %436 store i32 %5, ptr addrspace(1) %out37 ret void38}39