aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC/ppc32-pic.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/PowerPC/ppc32-pic.ll')
-rw-r--r--test/CodeGen/PowerPC/ppc32-pic.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/ppc32-pic.ll b/test/CodeGen/PowerPC/ppc32-pic.ll
new file mode 100644
index 000000000000..5bb78a4655ae
--- /dev/null
+++ b/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