1; RUN: llc -march=amdgcn -mcpu=SI -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-ALLOCA -check-prefix=SI %s 2; RUN: llc -march=amdgcn -mcpu=SI -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-PROMOTE -check-prefix=SI %s 3; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-ALLOCA -check-prefix=SI %s 4; RUN: llc -march=amdgcn -mcpu=tonga -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-PROMOTE -check-prefix=SI %s 5 6 7declare void @llvm.AMDGPU.barrier.local() noduplicate nounwind 8 9; SI-LABEL: {{^}}private_access_f64_alloca: 10 11; SI-ALLOCA: buffer_store_dwordx2 12; SI-ALLOCA: buffer_load_dwordx2 13 14; SI-PROMOTE: ds_write_b64 15; SI-PROMOTE: ds_read_b64 16define void @private_access_f64_alloca(double addrspace(1)* noalias %out, double addrspace(1)* noalias %in, i32 %b) nounwind { 17 %val = load double, double addrspace(1)* %in, align 8 18 %array = alloca double, i32 16, align 8 19 %ptr = getelementptr double, double* %array, i32 %b 20 store double %val, double* %ptr, align 8 21 call void @llvm.AMDGPU.barrier.local() noduplicate nounwind 22 %result = load double, double* %ptr, align 8 23 store double %result, double addrspace(1)* %out, align 8 24 ret void 25} 26 27; SI-LABEL: {{^}}private_access_v2f64_alloca: 28 29; SI-ALLOCA: buffer_store_dwordx4 30; SI-ALLOCA: buffer_load_dwordx4 31 32; SI-PROMOTE: ds_write_b32 33; SI-PROMOTE: ds_write_b32 34; SI-PROMOTE: ds_write_b32 35; SI-PROMOTE: ds_write_b32 36; SI-PROMOTE: ds_read_b32 37; SI-PROMOTE: ds_read_b32 38; SI-PROMOTE: ds_read_b32 39; SI-PROMOTE: ds_read_b32 40define void @private_access_v2f64_alloca(<2 x double> addrspace(1)* noalias %out, <2 x double> addrspace(1)* noalias %in, i32 %b) nounwind { 41 %val = load <2 x double>, <2 x double> addrspace(1)* %in, align 16 42 %array = alloca <2 x double>, i32 16, align 16 43 %ptr = getelementptr <2 x double>, <2 x double>* %array, i32 %b 44 store <2 x double> %val, <2 x double>* %ptr, align 16 45 call void @llvm.AMDGPU.barrier.local() noduplicate nounwind 46 %result = load <2 x double>, <2 x double>* %ptr, align 16 47 store <2 x double> %result, <2 x double> addrspace(1)* %out, align 16 48 ret void 49} 50 51; SI-LABEL: {{^}}private_access_i64_alloca: 52 53; SI-ALLOCA: buffer_store_dwordx2 54; SI-ALLOCA: buffer_load_dwordx2 55 56; SI-PROMOTE: ds_write_b64 57; SI-PROMOTE: ds_read_b64 58define void @private_access_i64_alloca(i64 addrspace(1)* noalias %out, i64 addrspace(1)* noalias %in, i32 %b) nounwind { 59 %val = load i64, i64 addrspace(1)* %in, align 8 60 %array = alloca i64, i32 16, align 8 61 %ptr = getelementptr i64, i64* %array, i32 %b 62 store i64 %val, i64* %ptr, align 8 63 call void @llvm.AMDGPU.barrier.local() noduplicate nounwind 64 %result = load i64, i64* %ptr, align 8 65 store i64 %result, i64 addrspace(1)* %out, align 8 66 ret void 67} 68 69; SI-LABEL: {{^}}private_access_v2i64_alloca: 70 71; SI-ALLOCA: buffer_store_dwordx4 72; SI-ALLOCA: buffer_load_dwordx4 73 74; SI-PROMOTE: ds_write_b32 75; SI-PROMOTE: ds_write_b32 76; SI-PROMOTE: ds_write_b32 77; SI-PROMOTE: ds_write_b32 78; SI-PROMOTE: ds_read_b32 79; SI-PROMOTE: ds_read_b32 80; SI-PROMOTE: ds_read_b32 81; SI-PROMOTE: ds_read_b32 82define void @private_access_v2i64_alloca(<2 x i64> addrspace(1)* noalias %out, <2 x i64> addrspace(1)* noalias %in, i32 %b) nounwind { 83 %val = load <2 x i64>, <2 x i64> addrspace(1)* %in, align 16 84 %array = alloca <2 x i64>, i32 16, align 16 85 %ptr = getelementptr <2 x i64>, <2 x i64>* %array, i32 %b 86 store <2 x i64> %val, <2 x i64>* %ptr, align 16 87 call void @llvm.AMDGPU.barrier.local() noduplicate nounwind 88 %result = load <2 x i64>, <2 x i64>* %ptr, align 16 89 store <2 x i64> %result, <2 x i64> addrspace(1)* %out, align 16 90 ret void 91} 92