xref: /aosp_15_r20/external/llvm/test/CodeGen/PowerPC/2010-03-09-indirect-call.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=ppc32 -mcpu=g5 -mtriple=powerpc-apple-darwin10.0 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; ModuleID = 'nn.c'
3*9880d681SAndroid Build Coastguard Workertarget 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"
4*9880d681SAndroid Build Coastguard Workertarget triple = "powerpc-apple-darwin11.0"
5*9880d681SAndroid Build Coastguard Worker; Indirect calls must use R12 on Darwin (i.e., R12 must contain the address of
6*9880d681SAndroid Build Coastguard Worker; the function being called; the mtctr is not required to use it).
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker@p = external global void (...)*                  ; <void (...)**> [#uses=1]
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workerdefine void @foo() nounwind ssp {
11*9880d681SAndroid Build Coastguard Workerentry:
12*9880d681SAndroid Build Coastguard Worker; CHECK: mtctr r12
13*9880d681SAndroid Build Coastguard Worker; CHECK: bctrl
14*9880d681SAndroid Build Coastguard Worker  %0 = load void (...)*, void (...)** @p, align 4              ; <void (...)*> [#uses=1]
15*9880d681SAndroid Build Coastguard Worker  call void (...) %0() nounwind
16*9880d681SAndroid Build Coastguard Worker  br label %return
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerreturn:                                           ; preds = %entry
19*9880d681SAndroid Build Coastguard Worker  ret void
20*9880d681SAndroid Build Coastguard Worker}
21