1 ; RUN: llc -mtriple aarch64-unknown-windows-msvc -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,DAG-ISEL
2 ; RUN: llc -mtriple aarch64-unknown-windows-msvc -fast-isel -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,FAST-ISEL
3 ; RUN: llc -mtriple aarch64-unknown-windows-msvc -verify-machineinstrs -O0 -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,GLOBAL-ISEL,GLOBAL-ISEL-FALLBACK
5 @var = external dllimport global i32
6 @ext = external global i32
7 declare dllimport i32 @external()
8 declare i32 @internal()
10 define i32 @get_var() {
11 %1 = load i32, ptr @var, align 4
15 ; CHECK-LABEL: get_var
16 ; CHECK: adrp x8, __imp_var
17 ; CHECK: ldr x8, [x8, :lo12:__imp_var]
21 define i32 @get_ext() {
22 %1 = load i32, ptr @ext, align 4
26 ; CHECK-LABEL: get_ext
28 ; DAG-ISEL: ldr w0, [x8, :lo12:ext]
29 ; FAST-ISEL: add x8, x8, :lo12:ext
30 ; FAST-ISEL: ldr w0, [x8]
31 ; GLOBAL-ISEL-FALLBACK: ldr w0, [x8, :lo12:ext]
34 define ptr @get_var_pointer() {
38 ; CHECK-LABEL: get_var_pointer
39 ; CHECK: adrp [[REG1:x[0-9]+]], __imp_var
40 ; CHECK: ldr {{x[0-9]+}}, [[[REG1]], :lo12:__imp_var]
43 define i32 @call_external() {
44 %call = tail call i32 @external()
48 ; CHECK-LABEL: call_external
49 ; CHECK: adrp x0, __imp_external
50 ; CHECK: ldr x0, [x0, :lo12:__imp_external]
53 define i32 @call_internal() {
54 %call = tail call i32 @internal()
58 ; CHECK-LABEL: call_internal
59 ; DAG-ISEL: b internal
60 ; FAST-ISEL: b internal
61 ; GLOBAL-ISEL: b internal