brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.5 KiB · e897838 Raw
187 lines · plain
1; RUN: opt -S -mtriple=amdgcn-- -passes='amdgpu-promote-alloca,sroa,instcombine' -amdgpu-promote-alloca-to-vector-max-regs=64 < %s | FileCheck -check-prefix=OPT %s2; RUN: opt -S -mtriple=amdgcn-- -passes='amdgpu-promote-alloca,sroa,instcombine' -amdgpu-promote-alloca-to-vector-limit=32 -amdgpu-promote-alloca-to-vector-max-regs=64 < %s | FileCheck -check-prefix=LIMIT32 %s3 4; OPT-LABEL: @alloca_8xi64_max1024(5; OPT-NOT: alloca6; OPT: <8 x i64>7; LIMIT32: alloca8; LIMIT32-NOT: <8 x i64>9define amdgpu_kernel void @alloca_8xi64_max1024(ptr addrspace(1) %out, i32 %index, i32 %index1) #0 {10entry:11  %tmp = alloca [8 x i64], addrspace(5)12  store i64 0, ptr addrspace(5) %tmp13  %gep0 = getelementptr [8 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index114  store i64 1, ptr addrspace(5) %gep015  %tmp1 = getelementptr [8 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index16  %tmp2 = load i64, ptr addrspace(5) %tmp117  store i64 %tmp2, ptr addrspace(1) %out18  ret void19}20 21; OPT-LABEL: @alloca_9xi64_max1024(22; OPT: alloca [9 x i64]23; OPT-NOT: <9 x i64>24; LIMIT32: alloca25; LIMIT32-NOT: <9 x i64>26define amdgpu_kernel void @alloca_9xi64_max1024(ptr addrspace(1) %out, i32 %index) #0 {27entry:28  %tmp = alloca [9 x i64], addrspace(5)29  store i64 0, ptr addrspace(5) %tmp30  %tmp1 = getelementptr [9 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index31  %tmp2 = load i64, ptr addrspace(5) %tmp132  store i64 %tmp2, ptr addrspace(1) %out33  ret void34}35 36; OPT-LABEL: @alloca_16xi64_max512(37; OPT-NOT: alloca38; OPT: <16 x i64>39; LIMIT32: alloca40; LIMIT32-NOT: <16 x i64>41define amdgpu_kernel void @alloca_16xi64_max512(ptr addrspace(1) %out, i32 %index, i32 %index1) #1 {42entry:43  %tmp = alloca [16 x i64], addrspace(5)44  store i64 0, ptr addrspace(5) %tmp45  %gep0 = getelementptr [8 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index146  store i64 1, ptr addrspace(5) %gep047  %tmp1 = getelementptr [16 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index48  %tmp2 = load i64, ptr addrspace(5) %tmp149  store i64 %tmp2, ptr addrspace(1) %out50  ret void51}52 53; OPT-LABEL: @alloca_17xi64_max512(54; OPT: alloca [17 x i64]55; OPT-NOT: <17 x i64>56; LIMIT32: alloca57; LIMIT32-NOT: <17 x i64>58define amdgpu_kernel void @alloca_17xi64_max512(ptr addrspace(1) %out, i32 %index) #1 {59entry:60  %tmp = alloca [17 x i64], addrspace(5)61  store i64 0, ptr addrspace(5) %tmp62  %tmp1 = getelementptr [17 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index63  %tmp2 = load i64, ptr addrspace(5) %tmp164  store i64 %tmp2, ptr addrspace(1) %out65  ret void66}67 68; OPT-LABEL: @alloca_9xi128_max512(69; OPT: alloca [9 x i128]70; OPT-NOT: <9 x i128>71; LIMIT32: alloca72; LIMIT32-NOT: <9 x i128>73define amdgpu_kernel void @alloca_9xi128_max512(ptr addrspace(1) %out, i32 %index) #1 {74entry:75  %tmp = alloca [9 x i128], addrspace(5)76  store i128 0, ptr addrspace(5) %tmp77  %tmp1 = getelementptr [9 x i128], ptr addrspace(5) %tmp, i32 0, i32 %index78  %tmp2 = load i128, ptr addrspace(5) %tmp179  store i128 %tmp2, ptr addrspace(1) %out80  ret void81}82 83; OPT-LABEL: @alloca_9xi128_max256(84; OPT-NOT: alloca85; OPT: <9 x i128>86; LIMIT32: alloca87; LIMIT32-NOT: <9 x i128>88define amdgpu_kernel void @alloca_9xi128_max256(ptr addrspace(1) %out, i32 %index, i32 %index1) #2 {89entry:90  %tmp = alloca [9 x i128], addrspace(5)91  store i128 0, ptr addrspace(5) %tmp92  %gep0 = getelementptr [8 x i128], ptr addrspace(5) %tmp, i32 0, i32 %index193  store i128 1, ptr addrspace(5) %gep094  %tmp1 = getelementptr [9 x i128], ptr addrspace(5) %tmp, i32 0, i32 %index95  %tmp2 = load i128, ptr addrspace(5) %tmp196  store i128 %tmp2, ptr addrspace(1) %out97  ret void98}99 100; OPT-LABEL: @alloca_16xi128_max256(101; OPT-NOT: alloca102; OPT: <16 x i128>103; LIMIT32: alloca104; LIMIT32-NOT: <16 x i128>105define amdgpu_kernel void @alloca_16xi128_max256(ptr addrspace(1) %out, i32 %index, i32 %index1) #2 {106entry:107  %tmp = alloca [16 x i128], addrspace(5)108  store i128 0, ptr addrspace(5) %tmp109  %gep0 = getelementptr [8 x i128], ptr addrspace(5) %tmp, i32 0, i32 %index1110  store i128 1, ptr addrspace(5) %gep0111  %tmp1 = getelementptr [16 x i128], ptr addrspace(5) %tmp, i32 0, i32 %index112  %tmp2 = load i128, ptr addrspace(5) %tmp1113  store i128 %tmp2, ptr addrspace(1) %out114  ret void115}116 117; OPT-LABEL: @alloca_9xi256_max256(118; OPT: alloca [9 x i256]119; OPT-NOT: <9 x i256>120; LIMIT32: alloca121; LIMIT32-NOT: <9 x i256>122define amdgpu_kernel void @alloca_9xi256_max256(ptr addrspace(1) %out, i32 %index, i32 %index1) #2 {123entry:124  %tmp = alloca [9 x i256], addrspace(5)125  store i256 0, ptr addrspace(5) %tmp126  %gep0 = getelementptr [8 x i256], ptr addrspace(5) %tmp, i32 0, i32 %index1127  store i128 1, ptr addrspace(5) %gep0128  %tmp1 = getelementptr [9 x i256], ptr addrspace(5) %tmp, i32 0, i32 %index129  %tmp2 = load i256, ptr addrspace(5) %tmp1130  store i256 %tmp2, ptr addrspace(1) %out131  ret void132}133 134; OPT-LABEL: @alloca_9xi64_max256(135; OPT-NOT: alloca136; OPT: <9 x i64>137; LIMIT32: alloca138; LIMIT32-NOT: <9 x i64>139define amdgpu_kernel void @alloca_9xi64_max256(ptr addrspace(1) %out, i32 %index, i32 %index1) #2 {140entry:141  %tmp = alloca [9 x i64], addrspace(5)142  store i64 0, ptr addrspace(5) %tmp143  %gep0 = getelementptr [8 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index1144  store i64 1, ptr addrspace(5) %gep0145  %tmp1 = getelementptr [9 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index146  %tmp2 = load i64, ptr addrspace(5) %tmp1147  store i64 %tmp2, ptr addrspace(1) %out148  ret void149}150 151; OPT-LABEL: @func_alloca_9xi64_max256(152; OPT: alloca153; OPT-NOT: <9 x i64>154; LIMIT32: alloca155; LIMIT32-NOT: <9 x i64>156define void @func_alloca_9xi64_max256(ptr addrspace(1) %out, i32 %index) #2 {157entry:158  %tmp = alloca [9 x i64], addrspace(5)159  store i64 0, ptr addrspace(5) %tmp160  %tmp1 = getelementptr [9 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index161  %tmp2 = load i64, ptr addrspace(5) %tmp1162  store i64 %tmp2, ptr addrspace(1) %out163  ret void164}165 166; OPT-LABEL: @alwaysinlined_func_alloca_9xi64_max256(167; OPT-NOT: alloca168; OPT: <9 x i64>169; LIMIT32: alloca170; LIMIT32-NOT: <9 x i64>171define void @alwaysinlined_func_alloca_9xi64_max256(ptr addrspace(1) %out, i32 %index, i32 %index1) #3 {172entry:173  %tmp = alloca [9 x i64], addrspace(5)174  store i64 0, ptr addrspace(5) %tmp175  %gep0 = getelementptr [8 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index1176  store i64 1, ptr addrspace(5) %gep0177  %tmp1 = getelementptr [9 x i64], ptr addrspace(5) %tmp, i32 0, i32 %index178  %tmp2 = load i64, ptr addrspace(5) %tmp1179  store i64 %tmp2, ptr addrspace(1) %out180  ret void181}182 183attributes #0 = { "amdgpu-flat-work-group-size"="1,1024" }184attributes #1 = { "amdgpu-flat-work-group-size"="1,512" }185attributes #2 = { "amdgpu-flat-work-group-size"="1,256" }186attributes #3 = { alwaysinline "amdgpu-flat-work-group-size"="1,256" }187