diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2014-07-18 23:29:49 +0000 |
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2014-07-18 23:29:49 +0000 |
| commit | 3ee2af7d1c0decb43729d239b5c6c0052b5308b7 (patch) | |
| tree | ed2c775d579da6195162e9146eea3a83c8e0d678 /llvm/test/CodeGen/PowerPC/ppc32-pic.ll | |
| parent | 8924d27c02b546d1f4da3be97b353792df4e6211 (diff) | |
| download | bcm5719-llvm-3ee2af7d1c0decb43729d239b5c6c0052b5308b7.tar.gz bcm5719-llvm-3ee2af7d1c0decb43729d239b5c6c0052b5308b7.zip | |
[PowerPC] 32-bit ELF PIC support
This adds initial support for PPC32 ELF PIC (Position Independent Code; the
-fPIC variety), thus rectifying a long-standing deficiency in the PowerPC
backend.
Patch by Justin Hibbits!
llvm-svn: 213427
Diffstat (limited to 'llvm/test/CodeGen/PowerPC/ppc32-pic.ll')
| -rw-r--r-- | llvm/test/CodeGen/PowerPC/ppc32-pic.ll | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/PowerPC/ppc32-pic.ll b/llvm/test/CodeGen/PowerPC/ppc32-pic.ll new file mode 100644 index 00000000000..5bb78a4655a --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/ppc32-pic.ll @@ -0,0 +1,21 @@ +; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic | FileCheck %s +@foobar = common global i32 0, align 4 + +define i32 @foo() { +entry: + %0 = load i32* @foobar, align 4 + ret i32 %0 +} + +; CHECK: [[POFF:\.L[0-9]+\$poff]]: +; CHECK-NEXT: .long .L.TOC.-[[PB:\.L[0-9]+\$pb]] +; CHECK-NEXT: foo: +; CHECK: bl [[PB]] +; CHECK-NEXT: [[PB]]: +; CHECK: mflr 30 +; CHECK: lwz [[REG:[0-9]+]], [[POFF]]-[[PB]](30) +; CHECK-NEXT: add 30, [[REG]], 30 +; CHECK: lwz [[VREG:[0-9]+]], [[VREF:\.LC[0-9]+]]-.L.TOC.(30) +; CHECK: lwz {{[0-9]+}}, 0([[VREG]]) +; CHECK: [[VREF]]: +; CHECK-NEXT: .long foobar |

