aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/AArch64/dllimport.ll
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
commit044eb2f6afba375a914ac9d8024f8f5142bb912e (patch)
tree1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /test/CodeGen/AArch64/dllimport.ll
parenteb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff)
Notes
Diffstat (limited to 'test/CodeGen/AArch64/dllimport.ll')
-rw-r--r--test/CodeGen/AArch64/dllimport.ll54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/CodeGen/AArch64/dllimport.ll b/test/CodeGen/AArch64/dllimport.ll
new file mode 100644
index 000000000000..fad049a54cd2
--- /dev/null
+++ b/test/CodeGen/AArch64/dllimport.ll
@@ -0,0 +1,54 @@
+; 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