Nicolai Haehnle | bef1ceb | 2016-07-18 09:02:47 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -mtriple=amdgcn-unknown-unknown -amdgpu-promote-alloca < %s | FileCheck -check-prefix=IR %s |
| 2 | ; RUN: llc -march=amdgcn -mcpu=tonga < %s | FileCheck -check-prefix=ASM %s |
| 3 | |
| 4 | ; IR-LABEL: define amdgpu_vs void @promote_alloca_shaders(i32 addrspace(1)* inreg %out, i32 addrspace(1)* inreg %in) #0 { |
| 5 | ; IR: alloca [5 x i32] |
| 6 | ; ASM-LABEL: {{^}}promote_alloca_shaders: |
| 7 | ; ASM: ; LDSByteSize: 0 bytes/workgroup (compile time only) |
| 8 | |
| 9 | define amdgpu_vs void @promote_alloca_shaders(i32 addrspace(1)* inreg %out, i32 addrspace(1)* inreg %in) #0 { |
| 10 | entry: |
| 11 | %stack = alloca [5 x i32], align 4 |
| 12 | %tmp0 = load i32, i32 addrspace(1)* %in, align 4 |
| 13 | %arrayidx1 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 %tmp0 |
| 14 | store i32 4, i32* %arrayidx1, align 4 |
| 15 | %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 1 |
| 16 | %tmp1 = load i32, i32 addrspace(1)* %arrayidx2, align 4 |
| 17 | %arrayidx3 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 %tmp1 |
| 18 | store i32 5, i32* %arrayidx3, align 4 |
| 19 | %arrayidx4 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 0 |
| 20 | %tmp2 = load i32, i32* %arrayidx4, align 4 |
| 21 | store i32 %tmp2, i32 addrspace(1)* %out, align 4 |
| 22 | %arrayidx5 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 1 |
| 23 | %tmp3 = load i32, i32* %arrayidx5 |
| 24 | %arrayidx6 = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 1 |
| 25 | store i32 %tmp3, i32 addrspace(1)* %arrayidx6 |
| 26 | ret void |
| 27 | } |
| 28 | |
| 29 | attributes #0 = { nounwind "amdgpu-max-work-group-size"="64" } |