1 ; RUN: llc < %s -mtriple=x86_64-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X64
2 ; RUN: llc < %s -mtriple=i686-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X86
3 ; RUN: llc < %s -mtriple=i686-w64-mingw32-none-elf | FileCheck %s -check-prefix=CHECK-X86-ELF
5 @var = external local_unnamed_addr global i32, align 4
6 @dsolocalvar = external dso_local local_unnamed_addr global i32, align 4
7 @localvar = dso_local local_unnamed_addr global i32 0, align 4
8 @localcommon = common dso_local local_unnamed_addr global i32 0, align 4
9 @extvar = external dllimport local_unnamed_addr global i32, align 4
11 define dso_local i32 @getVar() {
12 ; CHECK-X64-LABEL: getVar:
13 ; CHECK-X64: movq .refptr.var(%rip), %rax
14 ; CHECK-X64: movl (%rax), %eax
16 ; CHECK-X86-LABEL: _getVar:
17 ; CHECK-X86: movl .refptr._var, %eax
18 ; CHECK-X86: movl (%eax), %eax
20 ; CHECK-X86-ELF-LABEL: getVar:
21 ; CHECK-X86-ELF: movl var, %eax
24 %0 = load i32, i32* @var, align 4
28 define dso_local i32 @getDsoLocalVar() {
29 ; CHECK-X64-LABEL: getDsoLocalVar:
30 ; CHECK-X64: movl dsolocalvar(%rip), %eax
32 ; CHECK-X86-LABEL: _getDsoLocalVar:
33 ; CHECK-X86: movl _dsolocalvar, %eax
36 %0 = load i32, i32* @dsolocalvar, align 4
40 define dso_local i32 @getLocalVar() {
41 ; CHECK-X64-LABEL: getLocalVar:
42 ; CHECK-X64: movl localvar(%rip), %eax
44 ; CHECK-X86-LABEL: _getLocalVar:
45 ; CHECK-X86: movl _localvar, %eax
48 %0 = load i32, i32* @localvar, align 4
52 define dso_local i32 @getLocalCommon() {
53 ; CHECK-X64-LABEL: getLocalCommon:
54 ; CHECK-X64: movl localcommon(%rip), %eax
56 ; CHECK-X86-LABEL: _getLocalCommon:
57 ; CHECK-X86: movl _localcommon, %eax
60 %0 = load i32, i32* @localcommon, align 4
64 define dso_local i32 @getExtVar() {
65 ; CHECK-X64-LABEL: getExtVar:
66 ; CHECK-X64: movq __imp_extvar(%rip), %rax
67 ; CHECK-X64: movl (%rax), %eax
69 ; CHECK-X86-LABEL: _getExtVar:
70 ; CHECK-X86: movl __imp__extvar, %eax
71 ; CHECK-X86: movl (%eax), %eax
73 ; CHECK-X86-ELF-LABEL: getExtVar:
74 ; CHECK-X86-ELF: movl extvar, %eax
77 %0 = load i32, i32* @extvar, align 4
81 define dso_local void @callFunc() {
82 ; CHECK-X64-LABEL: callFunc:
83 ; CHECK-X64: jmp otherFunc
84 ; CHECK-X86-LABEL: _callFunc:
85 ; CHECK-X86: jmp _otherFunc
87 tail call void @otherFunc()
91 declare dso_local void @otherFunc()
93 ; CHECK-X64: .section .rdata$.refptr.var,"dr",discard,.refptr.var
94 ; CHECK-X64: .globl .refptr.var
95 ; CHECK-X64: .refptr.var:
96 ; CHECK-X64: .quad var
98 ; CHECK-X86: .section .rdata$.refptr._var,"dr",discard,.refptr._var
99 ; CHECK-X86: .globl .refptr._var
100 ; CHECK-X86: .refptr._var:
101 ; CHECK-X86: .long _var