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 -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, i32* @var, align 4
15 ; CHECK-LABEL: get_var
16 ; CHECK: adrp x8, __imp_var
17 ; CHECK: ldr x8, [x8, __imp_var]
21 define i32 @get_ext() {
22 %1 = load i32, i32* @ext, align 4
26 ; CHECK-LABEL: get_ext
28 ; DAG-ISEL: ldr w0, [x8, ext]
29 ; FAST-ISEL: add x8, x8, ext
30 ; FAST-ISEL: ldr w0, [x8]
31 ; GLOBAL-ISEL-FALLBACK: add x8, x8, ext
32 ; GLOBAL-ISEL-FALLBACK: ldr w0, [x8]
35 define i32* @get_var_pointer() {
39 ; CHECK-LABEL: get_var_pointer
40 ; CHECK: adrp [[REG1:x[0-9]+]], __imp_var
41 ; CHECK: ldr {{x[0-9]+}}, {{\[}}[[REG1]], __imp_var]
44 define i32 @call_external() {
45 %call = tail call i32 @external()
49 ; CHECK-LABEL: call_external
50 ; CHECK: adrp x0, __imp_external
51 ; CHECK: ldr x0, [x0, __imp_external]
54 define i32 @call_internal() {
55 %call = tail call i32 @internal()
59 ; CHECK-LABEL: call_internal
60 ; DAG-ISEL: b internal
61 ; FAST-ISEL: b internal
62 ; GLOBAL-ISEL: bl internal