1 ; RUN: llc < %s -mtriple=aarch64-w64-mingw32 | FileCheck %s
2 ; RUN: llc < %s -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel* \
3 ; RUN: -mtriple=aarch64-w64-mingw32 2>&1| FileCheck %s --check-prefixes=GISEL,FALLBACK
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-LABEL: getVar:
13 ; CHECK: adrp x8, .refptr.var
14 ; CHECK: ldr x8, [x8, :lo12:.refptr.var]
18 %0 = load i32, ptr @var, align 4
22 define dso_local i32 @getDsoLocalVar() {
23 ; CHECK-LABEL: getDsoLocalVar:
24 ; CHECK: adrp x8, dsolocalvar
25 ; CHECK: ldr w0, [x8, :lo12:dsolocalvar]
28 %0 = load i32, ptr @dsolocalvar, align 4
32 define dso_local i32 @getLocalVar() {
33 ; CHECK-LABEL: getLocalVar:
34 ; CHECK: adrp x8, localvar
35 ; CHECK: ldr w0, [x8, :lo12:localvar]
38 %0 = load i32, ptr @localvar, align 4
42 define dso_local i32 @getLocalCommon() {
43 ; CHECK-LABEL: getLocalCommon:
44 ; CHECK: adrp x8, localcommon
45 ; CHECK: ldr w0, [x8, :lo12:localcommon]
48 %0 = load i32, ptr @localcommon, align 4
52 define dso_local i32 @getExtVar() {
53 ; CHECK-LABEL: getExtVar:
54 ; CHECK: adrp x8, __imp_extvar
55 ; CHECK: ldr x8, [x8, :lo12:__imp_extvar]
59 %0 = load i32, ptr @extvar, align 4
63 define dso_local void @callFunc() {
64 ; CHECK-LABEL: callFunc:
67 tail call void @otherFunc()
71 declare dso_local void @otherFunc()
73 ; FALLBACK-NOT: remark:{{.*}}sspFunc
74 define dso_local void @sspFunc() #0 {
75 ; CHECK-LABEL: sspFunc:
76 ; CHECK: adrp x8, .refptr.__stack_chk_guard
77 ; CHECK: ldr x8, [x8, :lo12:.refptr.__stack_chk_guard]
79 ; GISEL-LABEL: sspFunc:
80 ; GISEL: adrp x8, .refptr.__stack_chk_guard
81 ; GISEL: ldr x8, [x8, :lo12:.refptr.__stack_chk_guard]
84 %c = alloca i8, align 1
85 call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c)
86 call void @ptrUser(ptr nonnull %c)
87 call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c)
91 declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
92 declare dso_local void @ptrUser(ptr) local_unnamed_addr #2
93 declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
95 attributes #0 = { sspstrong }
97 ; CHECK: .section .rdata$.refptr.__stack_chk_guard,"dr",discard,.refptr.__stack_chk_guard
98 ; CHECK: .globl .refptr.__stack_chk_guard
99 ; CHECK: .refptr.__stack_chk_guard:
100 ; CHECK: .xword __stack_chk_guard
101 ; CHECK: .section .rdata$.refptr.var,"dr",discard,.refptr.var
102 ; CHECK: .globl .refptr.var
103 ; CHECK: .refptr.var: