aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-03-10 17:45:15 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-03-10 17:45:15 +0000
commitea5b2dd11c0526581803e7eb58224a2eabf191e6 (patch)
tree231646bba785a129b3a2d409badb74e7ccd1594c /test/CodeGen/PowerPC
parentf5a3459adfde823bc7617f8ecfdd9fbc5a1ffadf (diff)
Notes
Diffstat (limited to 'test/CodeGen/PowerPC')
-rw-r--r--test/CodeGen/PowerPC/2010-03-09-indirect-call.ll19
-rw-r--r--test/CodeGen/PowerPC/indirectbr.ll12
2 files changed, 25 insertions, 6 deletions
diff --git a/test/CodeGen/PowerPC/2010-03-09-indirect-call.ll b/test/CodeGen/PowerPC/2010-03-09-indirect-call.ll
new file mode 100644
index 000000000000..d09450950d00
--- /dev/null
+++ b/test/CodeGen/PowerPC/2010-03-09-indirect-call.ll
@@ -0,0 +1,19 @@
+; RUN: llc < %s -march=ppc32 -mcpu=g5 -mtriple=powerpc-apple-darwin10.0 | FileCheck %s
+; ModuleID = 'nn.c'
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
+target triple = "powerpc-apple-darwin11.0"
+; Indirect calls must use R12 on Darwin (i.e., R12 must contain the address of
+; the function being called; the mtctr is not required to use it).
+
+@p = external global void (...)* ; <void (...)**> [#uses=1]
+
+define void @foo() nounwind ssp {
+entry:
+; CHECK: mtctr r12
+ %0 = load void (...)** @p, align 4 ; <void (...)*> [#uses=1]
+ call void (...)* %0() nounwind
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/CodeGen/PowerPC/indirectbr.ll b/test/CodeGen/PowerPC/indirectbr.ll
index 2094e10a5879..233d923695af 100644
--- a/test/CodeGen/PowerPC/indirectbr.ll
+++ b/test/CodeGen/PowerPC/indirectbr.ll
@@ -43,13 +43,13 @@ L2: ; preds = %L3, %bb2
L1: ; preds = %L2, %bb2
%res.3 = phi i32 [ %phitmp, %L2 ], [ 2, %bb2 ] ; <i32> [#uses=1]
-; PIC: addis r5, r4, ha16(L_BA4__foo_L5-"L1$pb")
+; PIC: addis r4, r4, ha16(L_BA4__foo_L5-"L1$pb")
; PIC: li r6, lo16(L_BA4__foo_L5-"L1$pb")
-; PIC: add r5, r5, r6
-; PIC: stw r5
-; STATIC: li r4, lo16(L_BA4__foo_L5)
-; STATIC: addis r4, r4, ha16(L_BA4__foo_L5)
-; STATIC: stw r4
+; PIC: add r4, r4, r6
+; PIC: stw r4
+; STATIC: li r5, lo16(L_BA4__foo_L5)
+; STATIC: addis r5, r5, ha16(L_BA4__foo_L5)
+; STATIC: stw r5
store i8* blockaddress(@foo, %L5), i8** @nextaddr, align 4
ret i32 %res.3
}