summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SPARC
diff options
context:
space:
mode:
authorDaniel Cederman <cederman@gaisler.com>2018-06-11 05:50:08 +0000
committerDaniel Cederman <cederman@gaisler.com>2018-06-11 05:50:08 +0000
commit33f67a256b5eafab7d73c644875c8c6a97d9dbdc (patch)
tree36a7e8e614b5474c3120df1952399080af3f62e2 /llvm/test/CodeGen/SPARC
parentb60532f89af6672ef86b7254df1c7226243497f3 (diff)
downloadbcm5719-llvm-33f67a256b5eafab7d73c644875c8c6a97d9dbdc.tar.gz
bcm5719-llvm-33f67a256b5eafab7d73c644875c8c6a97d9dbdc.zip
[Sparc] Add support for 13-bit PIC
Summary: When compiling with -fpic, in contrast to -fPIC, use only the immediate field to index into the GOT. This saves space if the GOT is known to be small. The linker will warn if the GOT is too large for this method. Reviewers: jyknight, venkatra Reviewed By: jyknight Subscribers: brad, fedor.sergeev, jrtc27, llvm-commits Differential Revision: https://reviews.llvm.org/D47136 llvm-svn: 334383
Diffstat (limited to 'llvm/test/CodeGen/SPARC')
-rw-r--r--llvm/test/CodeGen/SPARC/pic.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SPARC/pic.ll b/llvm/test/CodeGen/SPARC/pic.ll
new file mode 100644
index 00000000000..4edbffcc12b
--- /dev/null
+++ b/llvm/test/CodeGen/SPARC/pic.ll
@@ -0,0 +1,14 @@
+; RUN: llc < %s -relocation-model=pic -mtriple=sparc | FileCheck %s
+
+@value = external global i32
+
+define i32 @test() nounwind {
+; CHECK: ld [%i0+value], %i0
+entry:
+ %0 = load i32, i32* @value
+ ret i32 %0
+}
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 7, !"PIC Level", i32 1}
OpenPOWER on IntegriCloud