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
|
; RUN: llc -mtriple=ppc64le -relocation-model=static < %s | FileCheck %s
@default = global i32 55
define dso_local i32* @get_default_global() {
; CHECK-LABEL: get_default_global:
; CHECK: addis 3, 2, .LC{{.*}}@toc@ha
; CHECK-NEXT: ld 3, .LC{{.*}}@toc@l(3)
; CHECK-NEXT: blr
ret i32* @default
}
@local_global = dso_local global i32 55
define dso_local i32* @get_local_global() {
; CHECK-LABEL: get_local_global:
; CHECK: addis 3, 2, local_global@toc@ha
; CHECK-NEXT: addi 3, 3, local_global@toc@l
; CHECK-NEXT: blr
ret i32* @local_global
}
@preemptable_global = dso_preemptable global i32 42
define dso_local i32* @get_preemptable_global() {
; CHECK-LABEL: get_preemptable_global:
; CHECK: addis 3, 2, .LC{{.*}}@toc@ha
; CHECK-NEXT: ld 3, .LC{{.*}}@toc@l(3)
; CHECK-NEXT: blr
ret i32* @preemptable_global
}
@external_default_global = external global i32
define dso_local i32* @get_external_default_global() {
; CHECK-LABEL: get_external_default_global:
; CHECK: addis 3, 2, .LC{{.*}}@toc@ha
; CHECK-NEXT: ld 3, .LC{{.*}}@toc@l(3)
; CHECK-NEXT: blr
ret i32* @external_default_global
}
@external_local_global = external dso_local global i32
define dso_local i32* @get_external_local_global() {
; CHECK-LABEL: get_external_local_global:
; CHECK: addis 3, 2, external_local_global@toc@ha
; CHECK-NEXT: addi 3, 3, external_local_global@toc@l
; CHECK-NEXT: blr
ret i32* @external_local_global
}
@external_preemptable_global = external dso_preemptable global i32
define dso_local i32* @get_external_preemptable_global() {
; CHECK-LABEL: get_external_preemptable_global:
; CHECK: addis 3, 2, .LC{{.*}}@toc@ha
; CHECK-NEXT: ld 3, .LC{{.*}}@toc@l(3)
; CHECK-NEXT: blr
ret i32* @external_preemptable_global
}
; functions
define signext i32 @default_function(i32 %i) {
ret i32 %i
}
define dso_local signext i32 @default_function_caller(i32 %i) {
; CHECK-LABEL: default_function_caller:
; CHECK: bl default_function
; CHECK-NEXT: nop
%call = notail call signext i32 @default_function(i32 signext %i)
ret i32 %call
}
define dso_local signext i32 @local_function(i32 %i) {
ret i32 %i
}
define dso_local signext i32 @local_function_caller(i32 %i) {
; CHECK-LABEL: local_function_caller:
; CHECK: bl local_function
; CHECK-NOT: nop
; CHECK: blr
%call = notail call signext i32 @local_function(i32 signext %i)
ret i32 %call
}
define dso_preemptable signext i32 @preemptable_function(i32 %i) {
ret i32 %i
}
define dso_local signext i32 @preemptable_function_caller(i32 %i) {
; CHECK-LABEL: preemptable_function_caller:
; CHECK: bl preemptable_function
; CHECK-NEXT: nop
%call = notail call signext i32 @preemptable_function(i32 signext %i)
ret i32 %call
}
declare i32 @external_default_function(i32 %i)
define dso_local i32 @external_default_function_caller(i32 %i) {
; CHECK-LABEL: external_default_function_caller:
; CHECK: bl external_default_function
; CHECK-NEXT: nop
; CHECK: blr
%call = notail call signext i32 @external_default_function(i32 signext %i)
ret i32 %call
}
declare dso_local i32 @external_local_function(i32 %i)
define dso_local i32 @external_local_function_caller(i32 %i) {
; CHECK-LABEL: external_local_function_caller:
; CHECK: bl external_local_function
; CHECK-NEXT: nop
%call = notail call signext i32 @external_local_function(i32 signext %i)
ret i32 %call
}
declare dso_preemptable i32 @external_preemptable_function(i32 %i)
define dso_local i32 @external_preemptable_function_caller(i32 %i) {
; CHECK-LABEL: external_preemptable_function_caller:
; CHECK: bl external_preemptable_function
; CHECK-NEXT: nop
%call = notail call signext i32 @external_preemptable_function(i32 signext %i)
ret i32 %call
}
|