1; RUN: llc -fast-isel-sink-local-values < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios | FileCheck %s --check-prefix=ARM
2; RUN: llc -fast-isel-sink-local-values < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi | FileCheck %s --check-prefix=ARM
3; RUN: llc -fast-isel-sink-local-values < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios | FileCheck %s --check-prefix=THUMB
4
5define i32 @VarArg() nounwind {
6entry:
7  %i = alloca i32, align 4
8  %j = alloca i32, align 4
9  %k = alloca i32, align 4
10  %m = alloca i32, align 4
11  %n = alloca i32, align 4
12  %tmp = alloca i32, align 4
13  %0 = load i32, i32* %i, align 4
14  %1 = load i32, i32* %j, align 4
15  %2 = load i32, i32* %k, align 4
16  %3 = load i32, i32* %m, align 4
17  %4 = load i32, i32* %n, align 4
18; ARM: VarArg
19; ARM: mov [[FP:r[0-9]+]], sp
20; ARM: sub sp, sp, #{{(36|40)}}
21; ARM: ldr r1, {{\[}}[[FP]], #-4]
22; ARM: ldr r2, {{\[}}[[FP]], #-8]
23; ARM: ldr r3, {{\[}}[[FP]], #-12]
24; ARM: ldr [[Ra:r[0-9]+]], {{\[}}[[FP]], #-16]
25; ARM: ldr [[Rb:[lr]+[0-9]*]], [sp, #{{(16|20)}}]
26; ARM: movw [[Rc:[lr]+[0-9]*]], #5
27;   Ra got spilled
28; ARM: mov r0, [[Rc]]
29; ARM: str {{.*}}, [sp]
30; ARM: str [[Rb]], [sp, #4]
31; ARM: bl {{_?CallVariadic}}
32; THUMB: sub sp, #{{36}}
33; THUMB: ldr r1, [sp, #32]
34; THUMB: ldr r2, [sp, #28]
35; THUMB: ldr r3, [sp, #24]
36; THUMB: ldr {{[a-z0-9]+}}, [sp, #20]
37; THUMB: ldr.w {{[a-z0-9]+}}, [sp, #16]
38; THUMB: str.w {{[a-z0-9]+}}, [sp]
39; THUMB: str.w {{[a-z0-9]+}}, [sp, #4]
40; THUMB: bl {{_?}}CallVariadic
41  %call = call i32 (i32, ...) @CallVariadic(i32 5, i32 %0, i32 %1, i32 %2, i32 %3, i32 %4)
42  store i32 %call, i32* %tmp, align 4
43  %5 = load i32, i32* %tmp, align 4
44  ret i32 %5
45}
46
47declare i32 @CallVariadic(i32, ...)
48