1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
|
; RUN: llc -mtriple powerpc64le-unkown-gnu-linux -relocation-model=pic \
; RUN: < %s | FileCheck %s
; RUN: llc -mtriple powerpc64le-unkown-gnu-linux -relocation-model=static \
; RUN: < %s | FileCheck --check-prefix=STATIC %s
; RUN: llc -mtriple powerpc64le-unkown-gnu-linux -relocation-model=pic \
; RUN: < %s | FileCheck %s
; globals
@strong_default = global i32 55
define i32* @get_strong_default() #0 {
ret i32* @strong_default
; STATIC-LABEL: @get_strong_default
; STATIC: addis 3, 2, strong_default@toc@ha
; STATIC: addi 3, 3, strong_default@toc@l
; STATIC: blr
; CHECK-LABEL: @get_strong_default
; CHECK: addis 3, 2, .LC0@toc@ha
; CHECK: ld 3, .LC0@toc@l(3)
; CHECK: blr
}
@weak_default = weak global i32 55
define i32* @get_weak_default() #0 {
ret i32* @weak_default
; STATIC-LABEL: @get_weak_default
; STATIC: addis 3, 2, weak_default@toc@ha
; STATIC: addi 3, 3, weak_default@toc@l
; STATIC: blr
; CHECK-LABEL: @get_weak_default
; CHECK: addis 3, 2, .LC1@toc@ha
; CHECK: ld 3, .LC1@toc@l(3)
; CHECK: blr
}
@external_default_global = external global i32
define i32* @get_external_default_global() {
ret i32* @external_default_global
; STATIC-LABEL: @get_external_default_global
; STATIC: addis 3, 2, .LC0@toc@ha
; STATIC: ld 3, .LC0@toc@l(3)
; STATIC: blr
; CHECK-LABEL: @get_external_default_global
; CHECK: addis 3, 2, .LC2@toc@ha
; CHECK: ld 3, .LC2@toc@l(3)
; CHECK: blr
}
@strong_local_global = dso_local global i32 55
define i32* @get_strong_local_global() {
ret i32* @strong_local_global
; STATIC-LABEL: @get_strong_local_global
; STATIC: addis 3, 2, strong_local_global@toc@ha
; STATIC: addi 3, 3, strong_local_global@toc@l
; STATIC: blr
; CHECK-LABEL: @get_strong_local_global
; CHECK: addis 3, 2, strong_local_global@toc@ha
; CHECK: addi 3, 3, strong_local_global@toc@l
; CHECK: blr
}
@weak_local_global = weak dso_local global i32 42
define i32* @get_weak_local_global() {
ret i32* @weak_local_global
; STATIC-LABEL: @get_weak_local_global
; STATIC: addis 3, 2, weak_local_global@toc@ha
; STATIC: addi 3, 3, weak_local_global@toc@l
; STATIC: blr
; CHECK-LABEL: @get_weak_local_global
; CHECK: addis 3, 2, weak_local_global@toc@ha
; CHECK: addi 3, 3, weak_local_global@toc@l
; CHECK: blr
}
@external_local_global = external dso_local global i32
define i32* @get_external_local_global() {
ret i32* @external_local_global
; STATIC-LABEL: @get_external_local_global
; STATIC: addis 3, 2, external_local_global@toc@ha
; STATIC: addi 3, 3, external_local_global@toc@l
; STATIC: blr
; CHECK-LABEL: @get_external_local_global
; CHECK: addis 3, 2, external_local_global@toc@ha
; CHECK: addi 3, 3, external_local_global@toc@l
; CHECK: blr
}
@strong_preemptable_global = dso_preemptable global i32 42
define i32* @get_strong_preemptable_global() {
ret i32* @strong_preemptable_global
; STATIC-LABEL: @get_strong_preemptable_global
; STATIC: addis 3, 2, strong_preemptable_global@toc@ha
; STATIC: addi 3, 3, strong_preemptable_global@toc@l
; STATIC: blr
; CHECK-LABEL: @get_strong_preemptable_global
; CHECK: addis 3, 2, .LC3@toc@ha
; CHECK: ld 3, .LC3@toc@l(3)
; CHECK: blr
}
@weak_preemptable_global = weak dso_preemptable global i32 42
define i32* @get_weak_preemptable_global() {
ret i32* @weak_preemptable_global
; STATIC-LABEL: @get_weak_preemptable_global
; STATIC: addis 3, 2, weak_preemptable_global@toc@ha
; STATIC: addi 3, 3, weak_preemptable_global@toc@l
; STATIC: blr
; CHECK-LABEL: @get_weak_preemptable_global
; CHECK: addis 3, 2, .LC4@toc@ha
; CHECK: ld 3, .LC4@toc@l(3)
; CHECK: blr
}
@external_preemptable_global = external dso_preemptable global i32
define i32* @get_external_preemptable_global() {
ret i32* @external_preemptable_global
; STATIC-LABEL: @get_external_preemptable_global
; STATIC: addis 3, 2, .LC1@toc@ha
; STATIC: ld 3, .LC1@toc@l(3)
; STATIC: blr
; CHECK-LABEL: @get_external_preemptable_global
; CHECK: addis 3, 2, .LC5@toc@ha
; CHECK: ld 3, .LC5@toc@l(3)
; CHECK: blr
}
; functions
define signext i32 @strong_default_function(i32 %i) {
ret i32 %i
}
define signext i32 @strong_default_function_caller(i32 %i) {
%call = notail call signext i32 @strong_default_function(i32 signext %i)
ret i32 %call
; STATIC-LABEL: @strong_default_function_caller
; STATIC: bl strong_default_function
; STATIC-NOT: nop
; STATIC: blr
; CHECK-LABEL: @strong_default_function_caller
; CHECK: bl strong_default_function
; CHECK-NEXT: nop
; CHECK: blr
}
define weak signext i32 @weak_default_function(i32 %i) {
ret i32 %i
}
define signext i32 @weak_default_function_caller(i32 %i) {
%call = notail call signext i32 @weak_default_function(i32 signext %i)
ret i32 %call
; STATIC-LABEL: @weak_default_function_caller
; STATIC: bl weak_default_function
; STATIC-NOT: nop
; STATIC: blr
; CHECK-LABEL: @weak_default_function_caller
; CHECK: bl weak_default_function
; CHECK-NEXT: nop
; CHECK: blr
}
declare i32 @external_default_function(i32 %i)
define i32 @external_default_function_caller(i32 %i) {
%call = notail call signext i32 @external_default_function(i32 signext %i)
ret i32 %call
; STATIC-LABEL: @external_default_function_caller
; STATIC: bl external_default_function
; STATIC-NEXT: nop
; STATIC: blr
; CHECK-LABEL: @external_default_function_caller
; CHECK: bl external_default_function
; CHECK-NEXT: nop
; CHECK: blr
}
define dso_local signext i32 @strong_local_function(i32 %i) {
ret i32 %i
}
define signext i32 @strong_local_function_caller(i32 %i) {
%call = notail call signext i32 @strong_local_function(i32 signext %i)
ret i32 %call
; STATIC-LABEL: @strong_local_function_caller
; STATIC: bl strong_local_function
; STATIC-NOT: nop
; STATIC: blr
; CHECK-LABEL: @strong_local_function_caller
; CHECK: bl strong_local_function
; CHECK-NOT: nop
; CHECK: blr
}
define weak dso_local signext i32 @weak_local_function(i32 %i) {
ret i32 %i
}
define signext i32 @weak_local_function_caller(i32 %i) {
%call = notail call signext i32 @weak_local_function(i32 signext %i)
ret i32 %call
; STATIC-LABEL: @weak_local_function_caller
; STATIC: bl weak_local_function
; STATIC-NOT: nop
; STATIC: blr
; CHECK-LABEL: @weak_local_function_caller
; CHECK: bl weak_local_function
; CHECK-NOT: nop
; CHECK: blr
}
declare dso_local i32 @external_local_function(i32 %i)
define i32 @external_local_function_caller(i32 %i) {
%call = notail call signext i32 @external_local_function(i32 signext %i)
ret i32 %call
; STATIC-LABEL: @external_local_function_caller
; STATIC: bl external_local_function
; STATIC-NOT: nop
; STATIC: blr
; CHECK-LABEL: @external_local_function_caller
; CHECK: bl external_local_function
; CHECK-NOT: nop
; CHECK: blr
}
define dso_preemptable signext i32 @strong_preemptable_function(i32 %i) {
ret i32 %i
}
define signext i32 @strong_preemptable_function_caller(i32 %i) {
%call = notail call signext i32 @strong_preemptable_function(i32 signext %i)
ret i32 %call
; STATIC-LABEL: @strong_preemptable_function_caller
; STATIC: bl strong_preemptable_function
; STATIC-NOT: nop
; STATIC: blr
; CHECK-LABEL: @strong_preemptable_function_caller
; CHECK: bl strong_preemptable_function
; CHECK-NEXT: nop
; CHECK: blr
}
define weak dso_preemptable signext i32 @weak_preemptable_function(i32 %i) {
ret i32 %i
}
define signext i32 @weak_preemptable_function_caller(i32 %i) {
%call = notail call signext i32 @weak_preemptable_function(i32 signext %i)
ret i32 %call
; STATIC-LABEL: @weak_preemptable_function_caller
; STATIC: bl weak_preemptable_function
; STATIC-NOT: nop
; STATIC: blr
; CHECK-LABEL: @weak_preemptable_function_caller
; CHECK: bl weak_preemptable_function
; CHECK-NEXT: nop
; CHECK: blr
}
declare dso_preemptable i32 @external_preemptable_function(i32 %i)
define i32 @external_preemptable_function_caller(i32 %i) {
%call = notail call signext i32 @external_preemptable_function(i32 signext %i)
ret i32 %call
; STATIC-LABEL: @external_preemptable_function_caller
; STATIC: bl external_preemptable_function
; STATIC-NEXT: nop
; STATIC: blr
; CHECK-LABEL: @external_preemptable_function_caller
; CHECK: bl external_preemptable_function
; CHECK-NEXT: nop
; CHECK: blr
}
|