1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/AArch64/dllimport.ll
Martin Storsjo abdaedf85b [AArch64] Add support for dllimport of values and functions
Previously, the dllimport attribute did the right thing in terms
of treating it as a pointer to a value, but this makes sure the
names get mangled properly, and calls to such functions load the
function from the __imp_ pointer.

This is based on SVN r212431 and r212430 where the same was
implemented for ARM.

Differential Revision: https://reviews.llvm.org/D38530

llvm-svn: 316555
2017-10-25 07:25:18 +00:00

55 lines
1.0 KiB
LLVM

; RUN: llc -mtriple aarch64-unknown-windows-msvc -filetype asm -o - %s | FileCheck %s
@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
; CHECK: ldr w0, [x8, ext]
; CHECK: ret
define i32* @get_var_pointer() {
ret i32* @var
}
; CHECK-LABEL: get_var_pointer
; CHECK: adrp x0, __imp_var
; CHECK: ldr x0, [x0, __imp_var]
; 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
; CHECK: b internal