llvm-6502/test/CodeGen/PowerPC/ppc32-pic.ll
Hal Finkel d644d17dd4 [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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213427 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-18 23:29:49 +00:00

22 lines
657 B
LLVM

; 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