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 4 5@data = global [8193 x i32] zeroinitializer 6 7define void @ZC(i32 *%p) nounwind { 8entry: 9 ; ALL-LABEL: ZC: 10 11 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 0)) 12 13 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)( 14 ; ALL: #APP 15 ; ALL: lw $1, 0($[[BASEPTR]]) 16 ; ALL: #NO_APP 17 18 ret void 19} 20 21define void @ZC_offset_n4(i32 *%p) nounwind { 22entry: 23 ; ALL-LABEL: ZC_offset_n4: 24 25 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 -1)) 26 27 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)( 28 ; ALL: #APP 29 ; ALL: lw $1, -4($[[BASEPTR]]) 30 ; ALL: #NO_APP 31 32 ret void 33} 34 35define void @ZC_offset_4(i32 *%p) nounwind { 36entry: 37 ; ALL-LABEL: ZC_offset_4: 38 39 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 1)) 40 41 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)( 42 ; ALL: #APP 43 ; ALL: lw $1, 4($[[BASEPTR]]) 44 ; ALL: #NO_APP 45 46 ret void 47} 48 49define void @ZC_offset_252(i32 *%p) nounwind { 50entry: 51 ; ALL-LABEL: ZC_offset_252: 52 53 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 63)) 54 55 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)( 56 ; ALL: #APP 57 ; ALL: lw $1, 252($[[BASEPTR]]) 58 ; ALL: #NO_APP 59 60 ret void 61} 62 63define void @ZC_offset_256(i32 *%p) nounwind { 64entry: 65 ; ALL-LABEL: ZC_offset_256: 66 67 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 64)) 68 69 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)( 70 71 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 256 72 73 ; ALL: #APP 74 75 ; 09BIT: lw $1, 0($[[BASEPTR2]]) 76 ; 12BIT: lw $1, 256($[[BASEPTR]]) 77 ; 16BIT: lw $1, 256($[[BASEPTR]]) 78 79 ; ALL: #NO_APP 80 81 ret void 82} 83 84define void @ZC_offset_2044(i32 *%p) nounwind { 85entry: 86 ; ALL-LABEL: ZC_offset_2044: 87 88 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 511)) 89 90 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)( 91 92 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 2044 93 94 ; ALL: #APP 95 96 ; 09BIT: lw $1, 0($[[BASEPTR2]]) 97 ; 12BIT: lw $1, 2044($[[BASEPTR]]) 98 ; 16BIT: lw $1, 2044($[[BASEPTR]]) 99 100 ; ALL: #NO_APP 101 102 ret void 103} 104 105define void @ZC_offset_2048(i32 *%p) nounwind { 106entry: 107 ; ALL-LABEL: ZC_offset_2048: 108 109 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 512)) 110 111 ; ALL: lw $[[BASEPTR:[0-9]+]], %got(data)( 112 113 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 2048 114 ; 12BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 2048 115 116 ; ALL: #APP 117 118 ; 09BIT: lw $1, 0($[[BASEPTR2]]) 119 ; 12BIT: lw $1, 0($[[BASEPTR2]]) 120 ; 16BIT: lw $1, 2048($[[BASEPTR]]) 121 122 ; ALL: #NO_APP 123 124 ret void 125} 126 127define void @ZC_offset_32764(i32 *%p) nounwind { 128entry: 129 ; ALL-LABEL: ZC_offset_32764: 130 131 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 8191)) 132 133 ; ALL-DAG: lw $[[BASEPTR:[0-9]+]], %got(data)( 134 135 ; 09BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 32764 136 ; 12BIT: addiu $[[BASEPTR2:[0-9]+]], $[[BASEPTR]], 32764 137 138 ; ALL: #APP 139 140 ; 09BIT: lw $1, 0($[[BASEPTR2]]) 141 ; 12BIT: lw $1, 0($[[BASEPTR2]]) 142 ; 16BIT: lw $1, 32764($[[BASEPTR]]) 143 144 ; ALL: #NO_APP 145 146 ret void 147} 148 149define void @ZC_offset_32768(i32 *%p) nounwind { 150entry: 151 ; ALL-LABEL: ZC_offset_32768: 152 153 call void asm sideeffect "lw $$1, $0", "*^ZC,~{$1}"(i32* getelementptr inbounds ([8193 x i32], [8193 x i32]* @data, i32 0, i32 8192)) 154 155 ; ALL-DAG: lw $[[BASEPTR:[0-9]+]], %got(data)( 156 ; ALL-DAG: ori $[[T0:[0-9]+]], $zero, 32768 157 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: #APP 163 ; ALL: lw $1, 0($[[BASEPTR2]]) 164 ; ALL: #NO_APP 165 166 ret void 167} 168