blob: d19a82eede576ba100f589566a2e87932d7a8148 [file] [log] [blame]
Tom Stellardfd155822013-08-26 15:05:36 +00001; RUN: llc < %s -march=r600 -mcpu=verde | FileCheck %s
2
3; On Southern Islands GPUs the local address space(3) uses 32-bit pointers and
4; the global address space(1) uses 64-bit pointers. These tests check to make sure
5; the correct pointer size is used for the local address space.
6
7; The e{{32|64}} suffix on the instructions refers to the encoding size and not
8; the size of the operands. The operand size is denoted in the instruction name.
9; Instructions with B32, U32, and I32 in their name take 32-bit operands, while
10; instructions with B64, U64, and I64 take 64-bit operands.
11
12; CHECK-LABEL: @local_address_load
13; CHECK: V_MOV_B32_e{{32|64}} [[PTR:VGPR[0-9]]]
14; CHECK: DS_READ_B32 [[PTR]]
15define void @local_address_load(i32 addrspace(1)* %out, i32 addrspace(3)* %in) {
16entry:
17 %0 = load i32 addrspace(3)* %in
18 store i32 %0, i32 addrspace(1)* %out
19 ret void
20}
21
22; CHECK-LABEL: @local_address_gep
23; CHECK: V_ADD_I32_e{{32|64}} [[PTR:VGPR[0-9]]]
24; CHECK: DS_READ_B32 [[PTR]]
25define void @local_address_gep(i32 addrspace(1)* %out, i32 addrspace(3)* %in, i32 %offset) {
26entry:
27 %0 = getelementptr i32 addrspace(3)* %in, i32 %offset
28 %1 = load i32 addrspace(3)* %0
29 store i32 %1, i32 addrspace(1)* %out
30 ret void
31}
32
33; CHECK-LABEL: @local_address_gep_const_offset
34; CHECK: V_ADD_I32_e{{32|64}} [[PTR:VGPR[0-9]]]
35; CHECK: DS_READ_B32 [[PTR]]
36define void @local_address_gep_const_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %in) {
37entry:
38 %0 = getelementptr i32 addrspace(3)* %in, i32 1
39 %1 = load i32 addrspace(3)* %0
40 store i32 %1, i32 addrspace(1)* %out
41 ret void
42}