1 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck --check-prefix=EG -check-prefix=FUNC %s
2 ; RUN: llc -march=amdgcn -mcpu=verde -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-ALLOCA -check-prefix=SI -check-prefix=FUNC %s
3 ; RUN: llc -march=amdgcn -mcpu=verde -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-PROMOTE -check-prefix=SI -check-prefix=FUNC %s
4 ; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-ALLOCA -check-prefix=SI -check-prefix=FUNC %s
5 ; RUN: llc -march=amdgcn -mcpu=tonga -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-PROMOTE -check-prefix=SI -check-prefix=FUNC %s
7 ; FUNC-LABEL: {{^}}vector_read:
13 define void @vector_read(i32 addrspace(1)* %out, i32 %index) {
16 %x = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 0
17 %y = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 1
18 %z = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 2
19 %w = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 3
24 %1 = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 %index
25 %2 = load i32, i32* %1
26 store i32 %2, i32 addrspace(1)* %out
30 ; FUNC-LABEL: {{^}}vector_write:
37 define void @vector_write(i32 addrspace(1)* %out, i32 %w_index, i32 %r_index) {
40 %x = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 0
41 %y = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 1
42 %z = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 2
43 %w = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 3
48 %1 = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 %w_index
50 %2 = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 %r_index
51 %3 = load i32, i32* %2
52 store i32 %3, i32 addrspace(1)* %out
56 ; This test should be optimize to:
57 ; store i32 0, i32 addrspace(1)* %out
58 ; FUNC-LABEL: {{^}}bitcast_gep:
60 define void @bitcast_gep(i32 addrspace(1)* %out, i32 %w_index, i32 %r_index) {
63 %x = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 0
64 %y = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 1
65 %z = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 2
66 %w = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 3
71 %1 = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 1
72 %2 = bitcast i32* %1 to [4 x i32]*
73 %3 = getelementptr [4 x i32], [4 x i32]* %2, i32 0, i32 0
74 %4 = load i32, i32* %3
75 store i32 %4, i32 addrspace(1)* %out