1 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck --check-prefix=EG -check-prefix=FUNC %s
2 ; RUN: llc -march=r600 -mcpu=verde -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-ALLOCA -check-prefix=SI -check-prefix=FUNC %s
3 ; RUN: llc -march=r600 -mcpu=verde -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-PROMOTE -check-prefix=SI -check-prefix=FUNC %s
5 ; FUNC-LABEL: @vector_read
11 define void @vector_read(i32 addrspace(1)* %out, i32 %index) {
14 %x = getelementptr [4 x i32]* %0, i32 0, i32 0
15 %y = getelementptr [4 x i32]* %0, i32 0, i32 1
16 %z = getelementptr [4 x i32]* %0, i32 0, i32 2
17 %w = getelementptr [4 x i32]* %0, i32 0, i32 3
22 %1 = getelementptr [4 x i32]* %0, i32 0, i32 %index
24 store i32 %2, i32 addrspace(1)* %out
28 ; FUNC-LABEL: @vector_write
35 define void @vector_write(i32 addrspace(1)* %out, i32 %w_index, i32 %r_index) {
38 %x = getelementptr [4 x i32]* %0, i32 0, i32 0
39 %y = getelementptr [4 x i32]* %0, i32 0, i32 1
40 %z = getelementptr [4 x i32]* %0, i32 0, i32 2
41 %w = getelementptr [4 x i32]* %0, i32 0, i32 3
46 %1 = getelementptr [4 x i32]* %0, i32 0, i32 %w_index
48 %2 = getelementptr [4 x i32]* %0, i32 0, i32 %r_index
50 store i32 %3, i32 addrspace(1)* %out
54 ; This test should be optimize to:
55 ; store i32 0, i32 addrspace(1)* %out
56 ; FUNC-LABEL: @bitcast_gep
58 define void @bitcast_gep(i32 addrspace(1)* %out, i32 %w_index, i32 %r_index) {
61 %x = getelementptr [4 x i32]* %0, i32 0, i32 0
62 %y = getelementptr [4 x i32]* %0, i32 0, i32 1
63 %z = getelementptr [4 x i32]* %0, i32 0, i32 2
64 %w = getelementptr [4 x i32]* %0, i32 0, i32 3
69 %1 = getelementptr [4 x i32]* %0, i32 0, i32 1
70 %2 = bitcast i32* %1 to [4 x i32]*
71 %3 = getelementptr [4 x i32]* %2, i32 0, i32 0
73 store i32 %4, i32 addrspace(1)* %out