Support for Hexagon VLIW Packetizer.
[oota-llvm.git] / test / CodeGen / XCore / global_negative_offset.ll
1 ; RUN: llc < %s -march=xcore | FileCheck %s
2
3 ; Don't fold negative offsets into cp / dp accesses to avoid a relocation
4 ; error if the address + addend is less than the start of the cp / dp.
5
6 @a = external constant [0 x i32], section ".cp.rodata"
7 @b = external global [0 x i32]
8
9 define i32 *@f() nounwind {
10 entry:
11 ; CHECK: f:
12 ; CHECK: ldaw r11, cp[a]
13 ; CHECK: sub r0, r11, 4
14         %0 = getelementptr [0 x i32]* @a, i32 0, i32 -1
15         ret i32* %0
16 }
17
18 define i32 *@g() nounwind {
19 entry:
20 ; CHECK: g:
21 ; CHECK: ldaw [[REG:r[0-9]+]], dp[b]
22 ; CHECK: sub r0, [[REG]], 4
23         %0 = getelementptr [0 x i32]* @b, i32 0, i32 -1
24         ret i32* %0
25 }