1; RUN: llc -mattr=+promote-alloca -verify-machineinstrs -march=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 -march=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 -march=amdgcn -mcpu=tonga -mattr=-flat-for-global < %s | FileCheck --check-prefixes=GCN,GCN-PROMOTE %s 6; RUN: llc -mattr=-promote-alloca -verify-machineinstrs -march=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(i32 addrspace(1)* %out, i32 %in) { 27entry: 28 %0 = alloca [2 x i32], addrspace(5) 29 %1 = getelementptr [2 x i32], [2 x i32] addrspace(5)* %0, i32 0, i32 0 30 %2 = getelementptr [2 x i32], [2 x i32] addrspace(5)* %0, i32 0, i32 1 31 store i32 0, i32 addrspace(5)* %1 32 store i32 1, i32 addrspace(5)* %2 33 %3 = getelementptr [2 x i32], [2 x i32] addrspace(5)* %0, i32 0, i32 %in 34 %4 = load i32, i32 addrspace(5)* %3 35 %5 = call i32 @llvm.amdgcn.workitem.id.x() 36 %6 = add i32 %4, %5 37 store i32 %6, i32 addrspace(1)* %out 38 ret void 39} 40