summaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC/ppc32-nest.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/PowerPC/ppc32-nest.ll')
-rw-r--r--test/CodeGen/PowerPC/ppc32-nest.ll26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/ppc32-nest.ll b/test/CodeGen/PowerPC/ppc32-nest.ll
new file mode 100644
index 000000000000..ed7bbe2b8f37
--- /dev/null
+++ b/test/CodeGen/PowerPC/ppc32-nest.ll
@@ -0,0 +1,26 @@
+; RUN: llc < %s | FileCheck %s
+target datalayout = "E-m:e-p:32:32-i64:64-n32"
+target triple = "powerpc-unknown-linux-gnu"
+
+; Tests that the 'nest' parameter attribute causes the relevant parameter to be
+; passed in the right register (r11 for PPC).
+
+define i8* @nest_receiver(i8* nest %arg) nounwind {
+; CHECK-LABEL: nest_receiver:
+; CHECK: # BB#0:
+; CHECK-NEXT: mr 3, 11
+; CHECK-NEXT: blr
+
+ ret i8* %arg
+}
+
+define i8* @nest_caller(i8* %arg) nounwind {
+; CHECK-LABEL: nest_caller:
+; CHECK: mr 11, 3
+; CHECK-NEXT: bl nest_receiver
+; CHECK: blr
+
+ %result = call i8* @nest_receiver(i8* nest %arg)
+ ret i8* %result
+}
+