1 ; RUN: llc -march=mipsel -mcpu=mips32r6 -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,09BIT
2 ; RUN: llc -march=mipsel -mattr=+micromips -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,12BIT
3 ; RUN: llc -march=mipsel -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,16BIT
5 @data = global [8193 x i32] zeroinitializer
7 define void @ZC(ptr %p) nounwind {
11 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) @data)
13 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(
15 ; ALL: lw $1, 0($[[BASEPTR]])
21 define void @ZC_offset_n4(ptr %p) nounwind {
23 ; ALL-LABEL: ZC_offset_n4:
25 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 -1))
27 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(
29 ; ALL: lw $1, -4($[[BASEPTR]])
35 define void @ZC_offset_4(ptr %p) nounwind {
37 ; ALL-LABEL: ZC_offset_4:
39 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 1))
41 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(
43 ; ALL: lw $1, 4($[[BASEPTR]])
49 define void @ZC_offset_252(ptr %p) nounwind {
51 ; ALL-LABEL: ZC_offset_252:
53 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 63))
55 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(
57 ; ALL: lw $1, 252($[[BASEPTR]])
63 define void @ZC_offset_256(ptr %p) nounwind {
65 ; ALL-LABEL: ZC_offset_256:
67 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 64))
69 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(
71 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 256
75 ; 09BIT: lw $1, 0($[[BASEPTR2]])
76 ; 12BIT: lw $1, 256($[[BASEPTR]])
77 ; 16BIT: lw $1, 256($[[BASEPTR]])
84 define void @ZC_offset_2044(ptr %p) nounwind {
86 ; ALL-LABEL: ZC_offset_2044:
88 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 511))
90 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(
92 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 2044
96 ; 09BIT: lw $1, 0($[[BASEPTR2]])
97 ; 12BIT: lw $1, 2044($[[BASEPTR]])
98 ; 16BIT: lw $1, 2044($[[BASEPTR]])
105 define void @ZC_offset_2048(ptr %p) nounwind {
107 ; ALL-LABEL: ZC_offset_2048:
109 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 512))
111 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(
113 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 2048
114 ; 12BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 2048
118 ; 09BIT: lw $1, 0($[[BASEPTR2]])
119 ; 12BIT: lw $1, 0($[[BASEPTR2]])
120 ; 16BIT: lw $1, 2048($[[BASEPTR]])
127 define void @ZC_offset_32764(ptr %p) nounwind {
129 ; ALL-LABEL: ZC_offset_32764:
131 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 8191))
133 ; ALL-DAG: lw $[[BASEPTR:[0-9]+]], %got(data)(
135 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 32764
136 ; 12BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 32764
140 ; 09BIT: lw $1, 0($[[BASEPTR2]])
141 ; 12BIT: lw $1, 0($[[BASEPTR2]])
142 ; 16BIT: lw $1, 32764($[[BASEPTR]])
149 define void @ZC_offset_32768(ptr %p) nounwind {
151 ; ALL-LABEL: ZC_offset_32768:
153 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 8192))
155 ; ALL-DAG: lw $[[BASEPTR:[0-9]+]], %got(data)(
156 ; ALL-DAG: ori $[[T0:[0-9]+]], $zero, 32768
158 ; 09BIT: addu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], $[[T0]]
159 ; 12BIT: addu16 $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], $[[T0]]
160 ; 16BIT: addu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], $[[T0]]
163 ; ALL: lw $1, 0($[[BASEPTR2]])