168 lines · plain
1; RUN: llc -mtriple=mipsel -mcpu=mips32r6 -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,09BIT2; RUN: llc -mtriple=mipsel -mattr=+micromips -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,12BIT3; RUN: llc -mtriple=mipsel -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,16BIT4 5@data = global [8193 x i32] zeroinitializer6 7define void @ZC(ptr %p) nounwind {8entry:9 ; ALL-LABEL: ZC:10 11 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) @data)12 13 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(14 ; ALL: #APP15 ; ALL: lw $1, 0($[[BASEPTR]])16 ; ALL: #NO_APP17 18 ret void19}20 21define void @ZC_offset_n4(ptr %p) nounwind {22entry:23 ; ALL-LABEL: ZC_offset_n4:24 25 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 -1))26 27 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(28 ; ALL: #APP29 ; ALL: lw $1, -4($[[BASEPTR]])30 ; ALL: #NO_APP31 32 ret void33}34 35define void @ZC_offset_4(ptr %p) nounwind {36entry:37 ; ALL-LABEL: ZC_offset_4:38 39 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 1))40 41 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(42 ; ALL: #APP43 ; ALL: lw $1, 4($[[BASEPTR]])44 ; ALL: #NO_APP45 46 ret void47}48 49define void @ZC_offset_252(ptr %p) nounwind {50entry:51 ; ALL-LABEL: ZC_offset_252:52 53 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 63))54 55 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(56 ; ALL: #APP57 ; ALL: lw $1, 252($[[BASEPTR]])58 ; ALL: #NO_APP59 60 ret void61}62 63define void @ZC_offset_256(ptr %p) nounwind {64entry:65 ; ALL-LABEL: ZC_offset_256:66 67 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 64))68 69 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(70 71 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 25672 73 ; ALL: #APP74 75 ; 09BIT: lw $1, 0($[[BASEPTR2]])76 ; 12BIT: lw $1, 256($[[BASEPTR]])77 ; 16BIT: lw $1, 256($[[BASEPTR]])78 79 ; ALL: #NO_APP80 81 ret void82}83 84define void @ZC_offset_2044(ptr %p) nounwind {85entry:86 ; ALL-LABEL: ZC_offset_2044:87 88 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 511))89 90 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(91 92 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 204493 94 ; ALL: #APP95 96 ; 09BIT: lw $1, 0($[[BASEPTR2]])97 ; 12BIT: lw $1, 2044($[[BASEPTR]])98 ; 16BIT: lw $1, 2044($[[BASEPTR]])99 100 ; ALL: #NO_APP101 102 ret void103}104 105define void @ZC_offset_2048(ptr %p) nounwind {106entry:107 ; ALL-LABEL: ZC_offset_2048:108 109 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 512))110 111 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)(112 113 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 2048114 ; 12BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 2048115 116 ; ALL: #APP117 118 ; 09BIT: lw $1, 0($[[BASEPTR2]])119 ; 12BIT: lw $1, 0($[[BASEPTR2]])120 ; 16BIT: lw $1, 2048($[[BASEPTR]])121 122 ; ALL: #NO_APP123 124 ret void125}126 127define void @ZC_offset_32764(ptr %p) nounwind {128entry:129 ; ALL-LABEL: ZC_offset_32764:130 131 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 8191))132 133 ; ALL-DAG: lw $[[BASEPTR:[0-9]+]], %got(data)(134 135 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 32764136 ; 12BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 32764137 138 ; ALL: #APP139 140 ; 09BIT: lw $1, 0($[[BASEPTR2]])141 ; 12BIT: lw $1, 0($[[BASEPTR2]])142 ; 16BIT: lw $1, 32764($[[BASEPTR]])143 144 ; ALL: #NO_APP145 146 ret void147}148 149define void @ZC_offset_32768(ptr %p) nounwind {150entry:151 ; ALL-LABEL: ZC_offset_32768:152 153 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(ptr elementtype(i32) getelementptr inbounds ([8193 x i32], ptr @data, i32 0, i32 8192))154 155 ; ALL-DAG: lw $[[BASEPTR:[0-9]+]], %got(data)(156 ; ALL-DAG: ori $[[T0:[0-9]+]], $zero, 32768157 158 ; 09BIT: addu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], $[[T0]]159 ; 12BIT: addu16 $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], $[[T0]]160 ; 16BIT: addu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], $[[T0]]161 162 ; ALL: #APP163 ; ALL: lw $1, 0($[[BASEPTR2]])164 ; ALL: #NO_APP165 166 ret void167}168