Matt Arsenault | 7aad8fd | 2017-01-24 22:02:15 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=fiji -mattr=-flat-for-global -relocation-model=static < %s | FileCheck %s |
Tom Stellard | b164a98 | 2016-06-25 01:59:16 +0000 | [diff] [blame] | 2 | |
| 3 | @lds = external addrspace(3) global [4 x i32] |
| 4 | |
| 5 | ; Function Attrs: nounwind |
| 6 | |
| 7 | ; Offset folding is an optimization done for global variables with relocations, |
| 8 | ; which allows you to store the offset in the r_addend of the relocation entry. |
| 9 | ; The offset is apllied to the variables address at link time, which eliminates |
| 10 | ; the need to emit shader instructions to do this calculation. |
| 11 | ; We don't use relocations for local memory, so we should never fold offsets |
| 12 | ; for local memory globals. |
| 13 | |
| 14 | ; CHECK-LABEL: lds_no_offset: |
Benjamin Kramer | db9e0b6 | 2017-01-22 20:28:56 +0000 | [diff] [blame] | 15 | ; CHECK: ds_write_b32 v{{[0-9]+}}, v{{[0-9]+}} offset:4 |
Matt Arsenault | 3dbeefa | 2017-03-21 21:39:51 +0000 | [diff] [blame] | 16 | define amdgpu_kernel void @lds_no_offset() { |
Tom Stellard | b164a98 | 2016-06-25 01:59:16 +0000 | [diff] [blame] | 17 | entry: |
| 18 | %ptr = getelementptr [4 x i32], [4 x i32] addrspace(3)* @lds, i32 0, i32 1 |
| 19 | store i32 0, i32 addrspace(3)* %ptr |
| 20 | ret void |
| 21 | } |