• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
2; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
3
4
5@b = internal addrspace(2) constant [1 x i16] [ i16 7 ], align 2
6
7; XXX: Test on SI once 64-bit adds are supportes.
8
9@float_gv = internal unnamed_addr addrspace(2) constant [5 x float] [float 0.0, float 1.0, float 2.0, float 3.0, float 4.0], align 4
10
11; FUNC-LABEL: @float
12
13; EG-DAG: MOV {{\** *}}T2.X
14; EG-DAG: MOV {{\** *}}T3.X
15; EG-DAG: MOV {{\** *}}T4.X
16; EG-DAG: MOV {{\** *}}T5.X
17; EG-DAG: MOV {{\** *}}T6.X
18; EG: MOVA_INT
19
20define void @float(float addrspace(1)* %out, i32 %index) {
21entry:
22  %0 = getelementptr inbounds [5 x float] addrspace(2)* @float_gv, i32 0, i32 %index
23  %1 = load float addrspace(2)* %0
24  store float %1, float addrspace(1)* %out
25  ret void
26}
27
28@i32_gv = internal unnamed_addr addrspace(2) constant [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4], align 4
29
30; FUNC-LABEL: @i32
31
32; EG-DAG: MOV {{\** *}}T2.X
33; EG-DAG: MOV {{\** *}}T3.X
34; EG-DAG: MOV {{\** *}}T4.X
35; EG-DAG: MOV {{\** *}}T5.X
36; EG-DAG: MOV {{\** *}}T6.X
37; EG: MOVA_INT
38
39define void @i32(i32 addrspace(1)* %out, i32 %index) {
40entry:
41  %0 = getelementptr inbounds [5 x i32] addrspace(2)* @i32_gv, i32 0, i32 %index
42  %1 = load i32 addrspace(2)* %0
43  store i32 %1, i32 addrspace(1)* %out
44  ret void
45}
46
47
48%struct.foo = type { float, [5 x i32] }
49
50@struct_foo_gv = internal unnamed_addr addrspace(2) constant [1 x %struct.foo] [ %struct.foo { float 16.0, [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4] } ]
51
52; FUNC-LABEL: @struct_foo_gv_load
53
54define void @struct_foo_gv_load(i32 addrspace(1)* %out, i32 %index) {
55  %gep = getelementptr inbounds [1 x %struct.foo] addrspace(2)* @struct_foo_gv, i32 0, i32 0, i32 1, i32 %index
56  %load = load i32 addrspace(2)* %gep, align 4
57  store i32 %load, i32 addrspace(1)* %out, align 4
58  ret void
59}
60
61@array_v1_gv = internal addrspace(2) constant [4 x <1 x i32>] [ <1 x i32> <i32 1>,
62                                                                <1 x i32> <i32 2>,
63                                                                <1 x i32> <i32 3>,
64                                                                <1 x i32> <i32 4> ]
65
66; FUNC-LABEL: @array_v1_gv_load
67define void @array_v1_gv_load(<1 x i32> addrspace(1)* %out, i32 %index) {
68  %gep = getelementptr inbounds [4 x <1 x i32>] addrspace(2)* @array_v1_gv, i32 0, i32 %index
69  %load = load <1 x i32> addrspace(2)* %gep, align 4
70  store <1 x i32> %load, <1 x i32> addrspace(1)* %out, align 4
71  ret void
72}
73