1; RUN: llc < %s -mtriple=arm-linux-gnueabi -mattr=+vfp2 | FileCheck %s -check-prefix=ELF
2; RUN: llc < %s -mtriple=arm-apple-darwin -mattr=+vfp2 | FileCheck %s -check-prefix=DARWIN
3
4define i32 @f1(i32 %a, i64 %b) {
5; ELF-LABEL: f1:
6; ELF: mov r0, r2
7; DARWIN-LABEL: f1:
8; DARWIN: mov r0, r1
9        %tmp = call i32 @g1(i64 %b)
10        ret i32 %tmp
11}
12
13; test that allocating the double to r2/r3 makes r1 unavailable on gnueabi.
14define i32 @f2() nounwind optsize {
15; ELF-LABEL: f2:
16; ELF: mov  [[REGISTER:(r[0-9]+)]], #128
17; ELF: str  [[REGISTER]], [
18; DARWIN-LABEL: f2:
19; DARWIN: mov	r3, #128
20entry:
21  %0 = tail call i32 (i32, ...) @g2(i32 5, double 1.600000e+01, i32 128) nounwind optsize ; <i32> [#uses=1]
22  %not. = icmp ne i32 %0, 128                     ; <i1> [#uses=1]
23  %.0 = zext i1 %not. to i32                      ; <i32> [#uses=1]
24  ret i32 %.0
25}
26
27; test that on gnueabi a 64 bit value at this position will cause r3 to go
28; unused and the value stored in [sp]
29; ELF-LABEL: f3:
30; ELF: ldr r0, [sp]
31; ELF-NEXT: mov pc, lr
32; DARWIN-LABEL: f3:
33; DARWIN: mov r0, r3
34; DARWIN-NEXT: mov pc, lr
35define i32 @f3(i32 %i, i32 %j, i32 %k, i64 %l, ...) {
36entry:
37  %0 = trunc i64 %l to i32
38  ret i32 %0
39}
40
41declare i32 @g1(i64)
42
43declare i32 @g2(i32 %i, ...)
44