summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2012-08-22 03:18:13 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2012-08-22 03:18:13 +0000
commite7338cd550a4ccde6796d2987b482ea9f0e239ef (patch)
tree8a7a5d4c5768e1389c53c38dbf0db39827c1c50d /test/CodeGen
parent6522a9e04bcfa447299f4fd10ee9afffd5834a47 (diff)
downloadllvm-e7338cd550a4ccde6796d2987b482ea9f0e239ef.tar.gz
llvm-e7338cd550a4ccde6796d2987b482ea9f0e239ef.tar.bz2
llvm-e7338cd550a4ccde6796d2987b482ea9f0e239ef.tar.xz
Add register Mips::GP to the list of reserved registers if target is bare-metal
to prevent it from being clobbered. mips uses $gp to access small data section. This bug was originally reported by Carl Norum. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/Mips/small-section-reserve-gp.ll12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/small-section-reserve-gp.ll b/test/CodeGen/Mips/small-section-reserve-gp.ll
new file mode 100644
index 0000000000..fc251cb612
--- /dev/null
+++ b/test/CodeGen/Mips/small-section-reserve-gp.ll
@@ -0,0 +1,12 @@
+; RUN: llc -mtriple=mipsel-sde-elf -march=mipsel -relocation-model=static < %s \
+; RUN: | FileCheck %s
+
+@i = internal unnamed_addr global i32 0, align 4
+
+define i32 @geti() nounwind readonly {
+entry:
+; CHECK: addiu ${{[0-9]+}}, $gp, %gp_rel(i)
+ %0 = load i32* @i, align 4
+ ret i32 %0
+}
+