2018-01-31 03:50:51 +08:00
|
|
|
; RUN: llc -mtriple aarch64-unknown-windows-msvc -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,DAG-ISEL
|
|
|
|
; RUN: llc -mtriple aarch64-unknown-windows-msvc -fast-isel -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,FAST-ISEL
|
2019-09-10 01:15:56 +08:00
|
|
|
; RUN: llc -mtriple aarch64-unknown-windows-msvc -verify-machineinstrs -O0 -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,GLOBAL-ISEL,GLOBAL-ISEL-FALLBACK
|
2017-10-25 15:25:18 +08:00
|
|
|
|
|
|
|
@var = external dllimport global i32
|
|
|
|
@ext = external global i32
|
|
|
|
declare dllimport i32 @external()
|
|
|
|
declare i32 @internal()
|
|
|
|
|
|
|
|
define i32 @get_var() {
|
|
|
|
%1 = load i32, i32* @var, align 4
|
|
|
|
ret i32 %1
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: get_var
|
|
|
|
; CHECK: adrp x8, __imp_var
|
|
|
|
; CHECK: ldr x8, [x8, __imp_var]
|
|
|
|
; CHECK: ldr w0, [x8]
|
|
|
|
; CHECK: ret
|
|
|
|
|
|
|
|
define i32 @get_ext() {
|
|
|
|
%1 = load i32, i32* @ext, align 4
|
|
|
|
ret i32 %1
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: get_ext
|
|
|
|
; CHECK: adrp x8, ext
|
2018-01-31 03:50:51 +08:00
|
|
|
; DAG-ISEL: ldr w0, [x8, ext]
|
|
|
|
; FAST-ISEL: add x8, x8, ext
|
|
|
|
; FAST-ISEL: ldr w0, [x8]
|
2018-01-31 03:50:58 +08:00
|
|
|
; GLOBAL-ISEL-FALLBACK: add x8, x8, ext
|
|
|
|
; GLOBAL-ISEL-FALLBACK: ldr w0, [x8]
|
2017-10-25 15:25:18 +08:00
|
|
|
; CHECK: ret
|
|
|
|
|
|
|
|
define i32* @get_var_pointer() {
|
|
|
|
ret i32* @var
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: get_var_pointer
|
2018-01-31 03:50:51 +08:00
|
|
|
; CHECK: adrp [[REG1:x[0-9]+]], __imp_var
|
|
|
|
; CHECK: ldr {{x[0-9]+}}, {{\[}}[[REG1]], __imp_var]
|
2017-10-25 15:25:18 +08:00
|
|
|
; CHECK: ret
|
|
|
|
|
|
|
|
define i32 @call_external() {
|
|
|
|
%call = tail call i32 @external()
|
|
|
|
ret i32 %call
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: call_external
|
|
|
|
; CHECK: adrp x0, __imp_external
|
|
|
|
; CHECK: ldr x0, [x0, __imp_external]
|
|
|
|
; CHECK: br x0
|
|
|
|
|
|
|
|
define i32 @call_internal() {
|
|
|
|
%call = tail call i32 @internal()
|
|
|
|
ret i32 %call
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: call_internal
|
2018-01-31 03:50:58 +08:00
|
|
|
; DAG-ISEL: b internal
|
|
|
|
; FAST-ISEL: b internal
|
2019-09-10 01:15:56 +08:00
|
|
|
; GLOBAL-ISEL: b internal
|