• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s | FileCheck %s
2target datalayout = "E-m:e-i64:64-n32:64"
3target triple = "powerpc64-unknown-linux-gnu"
4
5; Tests that the 'nest' parameter attribute causes the relevant parameter to be
6; passed in the right register (r11 for PPC).
7
8define i8* @nest_receiver(i8* nest %arg) nounwind {
9; CHECK-LABEL: nest_receiver:
10; CHECK: # BB#0:
11; CHECK-NEXT: mr 3, 11
12; CHECK-NEXT: blr
13
14  ret i8* %arg
15}
16
17define i8* @nest_caller(i8* %arg) nounwind {
18; CHECK-LABEL: nest_caller:
19; CHECK: mr 11, 3
20; CHECK-NEXT: bl nest_receiver
21; CHECK: blr
22
23  %result = call i8* @nest_receiver(i8* nest %arg)
24  ret i8* %result
25}
26
27define void @test_indirect(i32 ()* nocapture %f, i8* %p) {
28entry:
29
30; CHECK-LABEL: test_indirect
31; CHECK-DAG: ld [[DEST:[0-9]+]], 0(3)
32; CHECK-DAG: ld 2, 8(3)
33; CHECK-DAG: mr 11, 4
34; CHECK: mtctr [[DEST]]
35; CHECK: bctrl
36; CHECK: blr
37
38  %callee.knr.cast = bitcast i32 ()* %f to i32 (i8*)*
39  %call = tail call signext i32 %callee.knr.cast(i8* nest %p)
40  ret void
41}
42
43