1; RUN: llc -mattr=+promote-alloca -verify-machineinstrs -mtriple=amdgcn < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s 2; RUN: llc -mattr=+promote-alloca,-flat-for-global -verify-machineinstrs -mtriple=amdgcn--amdhsa -mcpu=kaveri < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s 3; RUN: llc -mattr=-promote-alloca -verify-machineinstrs -mtriple=amdgcn < %s | FileCheck --check-prefixes=GCN,GCN-ALLOCA %s 4; RUN: llc -mattr=-promote-alloca,-flat-for-global -verify-machineinstrs -mtriple=amdgcn-amdhsa -mcpu=kaveri < %s | FileCheck --check-prefixes=GCN,GCN-ALLOCA %s 5; RUN: llc -mattr=+promote-alloca -verify-machineinstrs -mtriple=amdgcn -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s 6; RUN: llc -mattr=-promote-alloca -verify-machineinstrs -mtriple=amdgcn -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck --check-prefixes=GCN,GCN-ALLOCA %s 7 8 9declare i32 @llvm.amdgcn.workitem.id.x() nounwind readnone 10 11 12; Make sure we don't overwrite workitem information with private memory 13 14; GCN-LABEL: {{^}}work_item_info: 15; GCN-NOT: v0 16; GCN: s_load_dword [[IN:s[0-9]+]] 17; GCN-NOT: v0 18 19; GCN-ALLOCA: v_add_{{[iu]}}32_e32 [[RESULT:v[0-9]+]], vcc, v{{[0-9]+}}, v0 20 21; GCN-PROMOTE: s_cmp_eq_u32 [[IN]], 1 22; GCN-PROMOTE-NEXT: s_cselect_b64 vcc, -1, 0 23; GCN-PROMOTE-NEXT: v_addc_u32_e32 [[RESULT:v[0-9]+]], vcc, 0, v0, vcc 24 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 1 30 store i32 0, ptr addrspace(5) %0 31 store i32 1, ptr addrspace(5) %1 32 %2 = getelementptr [2 x i32], ptr addrspace(5) %0, i32 0, i32 %in 33 %3 = load i32, ptr addrspace(5) %2 34 %4 = call i32 @llvm.amdgcn.workitem.id.x() 35 %5 = add i32 %3, %4 36 store i32 %5, ptr addrspace(1) %out 37 ret void 38} 39