1; RUN: llc -march=mipsel -relocation-model=pic < %s | FileCheck %s
2
3@data = global [8193 x i32] zeroinitializer
4
5define void @m(i32 *%p) nounwind {
6entry:
7  ; CHECK-LABEL: m:
8
9  call void asm sideeffect "lw $$1, $0", "*m,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 0))
10
11  ; CHECK: lw $[[BASEPTR:[0-9]+]], %got(data)(
12  ; CHECK: #APP
13  ; CHECK: lw $1, 0($[[BASEPTR]])
14  ; CHECK: #NO_APP
15
16  ret void
17}
18
19define void @m_offset_4(i32 *%p) nounwind {
20entry:
21  ; CHECK-LABEL: m_offset_4:
22
23  call void asm sideeffect "lw $$1, $0", "*m,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 1))
24
25  ; CHECK: lw $[[BASEPTR:[0-9]+]], %got(data)(
26  ; CHECK: #APP
27  ; CHECK: lw $1, 4($[[BASEPTR]])
28  ; CHECK: #NO_APP
29
30  ret void
31}
32
33define void @m_offset_32764(i32 *%p) nounwind {
34entry:
35  ; CHECK-LABEL: m_offset_32764:
36
37  call void asm sideeffect "lw $$1, $0", "*m,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 8191))
38
39  ; CHECK-DAG: lw $[[BASEPTR:[0-9]+]], %got(data)(
40  ; CHECK: #APP
41  ; CHECK: lw $1, 32764($[[BASEPTR]])
42  ; CHECK: #NO_APP
43
44  ret void
45}
46
47define void @m_offset_32768(i32 *%p) nounwind {
48entry:
49  ; CHECK-LABEL: m_offset_32768:
50
51  call void asm sideeffect "lw $$1, $0", "*m,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 8192))
52
53  ; CHECK-DAG: lw $[[BASEPTR:[0-9]+]], %got(data)(
54  ; CHECK-DAG: ori $[[T0:[0-9]+]], $zero, 32768
55  ; CHECK: addu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], $[[T0]]
56  ; CHECK: #APP
57  ; CHECK: lw $1, 0($[[BASEPTR2]])
58  ; CHECK: #NO_APP
59
60  ret void
61}
62