R600 -> AMDGPU rename
[oota-llvm.git] / test / CodeGen / AMDGPU / gv-const-addrspace-fail.ll
1 ; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2 ; XUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
3
4
5 @a = internal addrspace(2) constant [1 x i8] [ i8 7 ], align 1
6
7 ; FUNC-LABEL: {{^}}test_i8:
8 ; EG: CF_END
9 ; SI: buffer_store_byte
10 ; SI: s_endpgm
11 define void @test_i8( i32 %s, i8 addrspace(1)* %out) #3 {
12   %arrayidx = getelementptr inbounds [1 x i8], [1 x i8] addrspace(2)* @a, i32 0, i32 %s
13   %1 = load i8, i8 addrspace(2)* %arrayidx, align 1
14   store i8 %1, i8 addrspace(1)* %out
15   ret void
16 }
17
18 @b = internal addrspace(2) constant [1 x i16] [ i16 7 ], align 2
19
20 ; FUNC-LABEL: {{^}}test_i16:
21 ; EG: CF_END
22 ; SI: buffer_store_short
23 ; SI: s_endpgm
24 define void @test_i16( i32 %s, i16 addrspace(1)* %out) #3 {
25   %arrayidx = getelementptr inbounds [1 x i16], [1 x i16] addrspace(2)* @b, i32 0, i32 %s
26   %1 = load i16, i16 addrspace(2)* %arrayidx, align 2
27   store i16 %1, i16 addrspace(1)* %out
28   ret void
29 }
30
31 %struct.bar = type { float, [5 x i8] }
32
33 ; The illegal i8s aren't handled
34 @struct_bar_gv = internal addrspace(2) constant [1 x %struct.bar] [ %struct.bar { float 16.0, [5 x i8] [i8 0, i8 1, i8 2, i8 3, i8 4] } ]
35
36 ; FUNC-LABEL: {{^}}struct_bar_gv_load:
37 define void @struct_bar_gv_load(i8 addrspace(1)* %out, i32 %index) {
38   %gep = getelementptr inbounds [1 x %struct.bar], [1 x %struct.bar] addrspace(2)* @struct_bar_gv, i32 0, i32 0, i32 1, i32 %index
39   %load = load i8, i8 addrspace(2)* %gep, align 1
40   store i8 %load, i8 addrspace(1)* %out, align 1
41   ret void
42 }
43
44
45 ; The private load isn't scalarzied.
46 @array_vector_gv = internal addrspace(2) constant [4 x <4 x i32>] [ <4 x i32> <i32 1, i32 2, i32 3, i32 4>,
47                                                                     <4 x i32> <i32 5, i32 6, i32 7, i32 8>,
48                                                                     <4 x i32> <i32 9, i32 10, i32 11, i32 12>,
49                                                                     <4 x i32> <i32 13, i32 14, i32 15, i32 16> ]
50
51 ; FUNC-LABEL: {{^}}array_vector_gv_load:
52 define void @array_vector_gv_load(<4 x i32> addrspace(1)* %out, i32 %index) {
53   %gep = getelementptr inbounds [4 x <4 x i32>], [4 x <4 x i32>] addrspace(2)* @array_vector_gv, i32 0, i32 %index
54   %load = load <4 x i32>, <4 x i32> addrspace(2)* %gep, align 16
55   store <4 x i32> %load, <4 x i32> addrspace(1)* %out, align 16
56   ret void
57 }