summaryrefslogtreecommitdiff
path: root/test/CodeGen/XCore
diff options
context:
space:
mode:
authorRichard Osborne <richard@xmos.com>2012-11-16 21:12:38 +0000
committerRichard Osborne <richard@xmos.com>2012-11-16 21:12:38 +0000
commitccc015d4314e966253668deec2b18a0d3e0cf4c0 (patch)
treeecbfb0490b187f55e813eb26882bc17a689c0cf3 /test/CodeGen/XCore
parent2085d00d09f4f3678a6c67da46df3a04e31b499c (diff)
downloadllvm-ccc015d4314e966253668deec2b18a0d3e0cf4c0.tar.gz
llvm-ccc015d4314e966253668deec2b18a0d3e0cf4c0.tar.bz2
llvm-ccc015d4314e966253668deec2b18a0d3e0cf4c0.tar.xz
Fix handling of aliases to functions.
An alias to a function should use pc relative addressing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/XCore')
-rw-r--r--test/CodeGen/XCore/aliases.ll32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/CodeGen/XCore/aliases.ll b/test/CodeGen/XCore/aliases.ll
new file mode 100644
index 0000000000..d83b246a55
--- /dev/null
+++ b/test/CodeGen/XCore/aliases.ll
@@ -0,0 +1,32 @@
+; RUN: llc < %s -march=xcore | FileCheck %s
+declare void @a_val() nounwind
+@b_val = external constant i32, section ".cp.rodata"
+@c_val = external global i32
+
+@a = alias void ()* @a_val
+@b = alias i32* @b_val
+@c = alias i32* @c_val
+
+; CHECK: a_addr:
+; CHECK: ldap r11, a
+; CHECK: retsp
+define void ()* @a_addr() nounwind {
+entry:
+ ret void ()* @a
+}
+
+; CHECK: b_addr:
+; CHECK: ldaw r11, cp[b]
+; CHECK: retsp
+define i32 *@b_addr() nounwind {
+entry:
+ ret i32* @b
+}
+
+; CHECK: c_addr:
+; CHECK: ldaw r0, dp[c]
+; CHECK: retsp
+define i32 *@c_addr() nounwind {
+entry:
+ ret i32* @c
+}