• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs< %s | FileCheck --check-prefix=SI --check-prefix=CHECK %s
2; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs< %s | FileCheck --check-prefix=CI --check-prefix=CHECK %s
3; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs< %s | FileCheck --check-prefix=CI --check-prefix=CHECK %s
4
5define void @use_gep_address_space([1024 x i32] addrspace(3)* %array) nounwind {
6; CHECK-LABEL: {{^}}use_gep_address_space:
7; CHECK: v_mov_b32_e32 [[PTR:v[0-9]+]], s{{[0-9]+}}
8; CHECK: ds_write_b32 [[PTR]], v{{[0-9]+}} offset:64
9  %p = getelementptr [1024 x i32], [1024 x i32] addrspace(3)* %array, i16 0, i16 16
10  store i32 99, i32 addrspace(3)* %p
11  ret void
12}
13
14define void @use_gep_address_space_large_offset([1024 x i32] addrspace(3)* %array) nounwind {
15; CHECK-LABEL: {{^}}use_gep_address_space_large_offset:
16; The LDS offset will be 65536 bytes, which is larger than the size of LDS on
17; SI, which is why it is being OR'd with the base pointer.
18; SI: s_or_b32
19; CI: s_add_i32
20; CHECK: ds_write_b32
21  %p = getelementptr [1024 x i32], [1024 x i32] addrspace(3)* %array, i16 0, i16 16384
22  store i32 99, i32 addrspace(3)* %p
23  ret void
24}
25
26define void @gep_as_vector_v4(<4 x [1024 x i32] addrspace(3)*> %array) nounwind {
27; CHECK-LABEL: {{^}}gep_as_vector_v4:
28; CHECK: s_add_i32
29; CHECK: s_add_i32
30; CHECK: s_add_i32
31; CHECK: s_add_i32
32  %p = getelementptr [1024 x i32], <4 x [1024 x i32] addrspace(3)*> %array, <4 x i16> zeroinitializer, <4 x i16> <i16 16, i16 16, i16 16, i16 16>
33  %p0 = extractelement <4 x i32 addrspace(3)*> %p, i32 0
34  %p1 = extractelement <4 x i32 addrspace(3)*> %p, i32 1
35  %p2 = extractelement <4 x i32 addrspace(3)*> %p, i32 2
36  %p3 = extractelement <4 x i32 addrspace(3)*> %p, i32 3
37  store i32 99, i32 addrspace(3)* %p0
38  store i32 99, i32 addrspace(3)* %p1
39  store i32 99, i32 addrspace(3)* %p2
40  store i32 99, i32 addrspace(3)* %p3
41  ret void
42}
43
44define void @gep_as_vector_v2(<2 x [1024 x i32] addrspace(3)*> %array) nounwind {
45; CHECK-LABEL: {{^}}gep_as_vector_v2:
46; CHECK: s_add_i32
47; CHECK: s_add_i32
48  %p = getelementptr [1024 x i32], <2 x [1024 x i32] addrspace(3)*> %array, <2 x i16> zeroinitializer, <2 x i16> <i16 16, i16 16>
49  %p0 = extractelement <2 x i32 addrspace(3)*> %p, i32 0
50  %p1 = extractelement <2 x i32 addrspace(3)*> %p, i32 1
51  store i32 99, i32 addrspace(3)* %p0
52  store i32 99, i32 addrspace(3)* %p1
53  ret void
54}
55
56