1 ; RUN: llc -mtriple x86_64-pc-win32 \
2 ; RUN: -relocation-model=static < %s | FileCheck --check-prefix=COFF_S %s
3 ; RUN: llc -mtriple x86_64-pc-win32 \
4 ; RUN: -relocation-model=pic < %s | FileCheck --check-prefix=COFF %s
5 ; RUN: llc -mtriple x86_64-pc-win32 \
6 ; RUN: -relocation-model=dynamic-no-pic < %s | FileCheck --check-prefix=COFF %s
11 ; RUN: llc -mtriple i386-pc-win32 \
12 ; RUN: -relocation-model=static < %s | FileCheck --check-prefix=COFF32 %s
13 ; RUN: llc -mtriple i386-pc-win32 \
14 ; RUN: -relocation-model=pic < %s | FileCheck --check-prefix=COFF32 %s
15 ; RUN: llc -mtriple i386-pc-win32 \
16 ; RUN: -relocation-model=dynamic-no-pic < %s | \
17 ; RUN: FileCheck --check-prefix=COFF32 %s
21 @strong_default_global = global i32 42
22 define ptr @get_strong_default_global() {
23 ret ptr @strong_default_global
25 ; COFF: leaq strong_default_global(%rip), %rax
26 ; COFF_S: movl $strong_default_global, %eax
27 ; COFF32: movl $_strong_default_global, %eax
29 @weak_default_global = weak global i32 42
30 define ptr @get_weak_default_global() {
31 ret ptr @weak_default_global
33 ; COFF: leaq weak_default_global(%rip), %rax
34 ; COFF_S: movl $weak_default_global, %eax
35 ; COFF32: movl $_weak_default_global, %eax
37 @external_default_global = external global i32
38 define ptr @get_external_default_global() {
39 ret ptr @external_default_global
41 ; COFF: leaq external_default_global(%rip), %rax
42 ; COFF_S: movl $external_default_global, %eax
43 ; COFF32: movl $_external_default_global, %eax
46 @strong_local_global = dso_local global i32 42
47 define ptr @get_strong_local_global() {
48 ret ptr @strong_local_global
50 ; COFF: leaq strong_local_global(%rip), %rax
51 ; COFF_S: movl $strong_local_global, %eax
52 ; COFF32: movl $_strong_local_global, %eax
54 @weak_local_global = weak dso_local global i32 42
55 define ptr @get_weak_local_global() {
56 ret ptr @weak_local_global
58 ; COFF: leaq weak_local_global(%rip), %rax
59 ; COFF_S: movl $weak_local_global, %eax
60 ; COFF32: movl $_weak_local_global, %eax
62 @external_local_global = external dso_local global i32
63 define ptr @get_external_local_global() {
64 ret ptr @external_local_global
66 ; COFF: leaq external_local_global(%rip), %rax
67 ; COFF_S: movl $external_local_global, %eax
68 ; COFF32: movl $_external_local_global, %eax
71 @strong_preemptable_global = dso_preemptable global i32 42
72 define ptr @get_strong_preemptable_global() {
73 ret ptr @strong_preemptable_global
75 ; COFF: leaq strong_preemptable_global(%rip), %rax
76 ; COFF_S: movl $strong_preemptable_global, %eax
77 ; COFF32: movl $_strong_preemptable_global, %eax
79 @weak_preemptable_global = weak dso_preemptable global i32 42
80 define ptr @get_weak_preemptable_global() {
81 ret ptr @weak_preemptable_global
83 ; COFF: leaq weak_preemptable_global(%rip), %rax
84 ; COFF_S: movl $weak_preemptable_global, %eax
85 ; COFF32: movl $_weak_preemptable_global, %eax
87 @external_preemptable_global = external dso_preemptable global i32
88 define ptr @get_external_preemptable_global() {
89 ret ptr @external_preemptable_global
91 ; COFF: leaq external_preemptable_global(%rip), %rax
92 ; COFF_S: movl $external_preemptable_global, %eax
93 ; COFF32: movl $_external_preemptable_global, %eax
97 @aliasee = global i32 42
99 @strong_default_alias = alias i32, ptr @aliasee
100 define ptr @get_strong_default_alias() {
101 ret ptr @strong_default_alias
103 ; COFF: leaq strong_default_alias(%rip), %rax
104 ; COFF_S: movl $strong_default_alias, %eax
105 ; COFF32: movl $_strong_default_alias, %eax
107 @weak_default_alias = weak alias i32, ptr @aliasee
108 define ptr @get_weak_default_alias() {
109 ret ptr @weak_default_alias
111 ; COFF: leaq weak_default_alias(%rip), %rax
112 ; COFF_S: movl $weak_default_alias, %eax
113 ; COFF32: movl $_weak_default_alias, %eax
116 @strong_local_alias = dso_local alias i32, ptr @aliasee
117 define ptr @get_strong_local_alias() {
118 ret ptr @strong_local_alias
120 ; COFF: leaq strong_local_alias(%rip), %rax
121 ; COFF_S: movl $strong_local_alias, %eax
122 ; COFF32: movl $_strong_local_alias, %eax
124 @weak_local_alias = weak dso_local alias i32, ptr @aliasee
125 define ptr @get_weak_local_alias() {
126 ret ptr @weak_local_alias
128 ; COFF: leaq weak_local_alias(%rip), %rax
129 ; COFF_S: movl $weak_local_alias, %eax
130 ; COFF32: movl $_weak_local_alias, %eax
133 @strong_preemptable_alias = dso_preemptable alias i32, ptr @aliasee
134 define ptr @get_strong_preemptable_alias() {
135 ret ptr @strong_preemptable_alias
137 ; COFF: leaq strong_preemptable_alias(%rip), %rax
138 ; COFF_S: movl $strong_preemptable_alias, %eax
139 ; COFF32: movl $_strong_preemptable_alias, %eax
141 @weak_preemptable_alias = weak dso_preemptable alias i32, ptr @aliasee
142 define ptr @get_weak_preemptable_alias() {
143 ret ptr @weak_preemptable_alias
145 ; COFF: leaq weak_preemptable_alias(%rip), %rax
146 ; COFF_S: movl $weak_preemptable_alias, %eax
147 ; COFF32: movl $_weak_preemptable_alias, %eax
152 define void @strong_default_function() {
155 define ptr @get_strong_default_function() {
156 ret ptr @strong_default_function
158 ; COFF: leaq strong_default_function(%rip), %rax
159 ; COFF_S: movl $strong_default_function, %eax
160 ; COFF32: movl $_strong_default_function, %eax
162 define weak void @weak_default_function() {
165 define ptr @get_weak_default_function() {
166 ret ptr @weak_default_function
168 ; COFF: leaq weak_default_function(%rip), %rax
169 ; COFF_S: movl $weak_default_function, %eax
170 ; COFF32: movl $_weak_default_function, %eax
172 declare void @external_default_function()
173 define ptr @get_external_default_function() {
174 ret ptr @external_default_function
176 ; COFF: leaq external_default_function(%rip), %rax
177 ; COFF_S: movl $external_default_function, %eax
178 ; COFF32: movl $_external_default_function, %eax
181 define dso_local void @strong_local_function() {
184 define ptr @get_strong_local_function() {
185 ret ptr @strong_local_function
187 ; COFF: leaq strong_local_function(%rip), %rax
188 ; COFF_S: movl $strong_local_function, %eax
189 ; COFF32: movl $_strong_local_function, %eax
191 define weak dso_local void @weak_local_function() {
194 define ptr @get_weak_local_function() {
195 ret ptr @weak_local_function
197 ; COFF: leaq weak_local_function(%rip), %rax
198 ; COFF_S: movl $weak_local_function, %eax
199 ; COFF32: movl $_weak_local_function, %eax
201 declare dso_local void @external_local_function()
202 define ptr @get_external_local_function() {
203 ret ptr @external_local_function
205 ; COFF: leaq external_local_function(%rip), %rax
206 ; COFF_S: movl $external_local_function, %eax
207 ; COFF32: movl $_external_local_function, %eax
210 define dso_preemptable void @strong_preemptable_function() {
213 define ptr @get_strong_preemptable_function() {
214 ret ptr @strong_preemptable_function
216 ; COFF: leaq strong_preemptable_function(%rip), %rax
217 ; COFF_S: movl $strong_preemptable_function, %eax
218 ; COFF32: movl $_strong_preemptable_function, %eax
220 define weak dso_preemptable void @weak_preemptable_function() {
223 define ptr @get_weak_preemptable_function() {
224 ret ptr @weak_preemptable_function
226 ; COFF: leaq weak_preemptable_function(%rip), %rax
227 ; COFF_S: movl $weak_preemptable_function, %eax
228 ; COFF32: movl $_weak_preemptable_function, %eax
230 declare dso_preemptable void @external_preemptable_function()
231 define ptr @get_external_preemptable_function() {
232 ret ptr @external_preemptable_function
234 ; COFF: leaq external_preemptable_function(%rip), %rax
235 ; COFF_S: movl $external_preemptable_function, %eax
236 ; COFF32: movl $_external_preemptable_function, %eax