1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
llvm-mirror/test/CodeGen/ARM/nest-register.ll
Renato Golin 943837bfb6 [ARM] Add support for nest attribute using r12
Register r12 ('ip') is used by GCC for this purpose
and hence is used here. As discussed on the GCC mailing
list, the register choice is an ABI issue and so
choosing the same register as GCC means
__builtin_call_with_static_chain is compatible.

A similar patch has just gone in the AArch64 backend,
so this is just the ARM counterpart, following the same
discussion.

Patch by Stephen Cross.

llvm-svn: 241996
2015-07-12 18:16:40 +00:00

22 lines
568 B
LLVM

; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s
; Tests that the 'nest' parameter attribute causes the relevant parameter to be
; passed in the right register.
define i8* @nest_receiver(i8* nest %arg) nounwind {
; CHECK-LABEL: nest_receiver:
; CHECK: @ BB#0:
; CHECK-NEXT: mov r0, r12
; CHECK-NEXT: mov pc, lr
ret i8* %arg
}
define i8* @nest_caller(i8* %arg) nounwind {
; CHECK-LABEL: nest_caller:
; CHECK: mov r12, r0
; CHECK-NEXT: bl nest_receiver
; CHECK: mov pc, lr
%result = call i8* @nest_receiver(i8* nest %arg)
ret i8* %result
}