Tom Stellard | 70f13db | 2013-10-10 17:11:46 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=r600 -mcpu=verde -verify-machineinstrs | FileCheck %s |
Tom Stellard | fd15582 | 2013-08-26 15:05:36 +0000 | [diff] [blame] | 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 |
Matt Arsenault | 72b31ee | 2013-11-12 02:35:51 +0000 | [diff] [blame^] | 13 | ; CHECK: V_MOV_B32_e{{32|64}} [[PTR:v[0-9]]] |
Tom Stellard | fd15582 | 2013-08-26 15:05:36 +0000 | [diff] [blame] | 14 | ; CHECK: DS_READ_B32 [[PTR]] |
| 15 | define void @local_address_load(i32 addrspace(1)* %out, i32 addrspace(3)* %in) { |
| 16 | entry: |
| 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 |
Matt Arsenault | 72b31ee | 2013-11-12 02:35:51 +0000 | [diff] [blame^] | 23 | ; CHECK: V_ADD_I32_e{{32|64}} [[PTR:v[0-9]]] |
Tom Stellard | fd15582 | 2013-08-26 15:05:36 +0000 | [diff] [blame] | 24 | ; CHECK: DS_READ_B32 [[PTR]] |
| 25 | define void @local_address_gep(i32 addrspace(1)* %out, i32 addrspace(3)* %in, i32 %offset) { |
| 26 | entry: |
| 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 |
Matt Arsenault | 72b31ee | 2013-11-12 02:35:51 +0000 | [diff] [blame^] | 34 | ; CHECK: V_ADD_I32_e{{32|64}} [[PTR:v[0-9]]] |
Tom Stellard | fd15582 | 2013-08-26 15:05:36 +0000 | [diff] [blame] | 35 | ; CHECK: DS_READ_B32 [[PTR]] |
| 36 | define void @local_address_gep_const_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %in) { |
| 37 | entry: |
| 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 | } |