blob: 8cca7e0f70683e0d8b7d1bad920cc109d1ebb038 [file] [log] [blame]
Pablo Barrioc41e8562016-11-17 10:56:58 +00001; RUN: llc -mtriple armv7 -target-abi aapcs -float-abi soft -O0 -o - < %s \
2; RUN: | FileCheck %s -check-prefix CHECK-SOFT -check-prefix CHECK
3; RUN: llc -mtriple armv7 -target-abi aapcs -float-abi hard -O0 -o - < %s \
4; RUN: | FileCheck %s -check-prefix CHECK-HARD -check-prefix CHECK
5
6; Tests for passing floating-point regs. Variadic functions will always use
7; general-purpose registers. Standard functions will use the floating-point
8; registers if there is hardware FP available.
9
10declare i1 @non_variadic(float, float, float, float)
11declare i1 @non_variadic_big(float, float, float, float, float, float)
12declare i1 @variadic(float, ...)
13
14define void @non_variadic_fp(float %x, float %y) {
15; CHECK-LABEL: non_variadic_fp:
16; CHECK: b non_variadic
17entry:
18 %call = tail call i1 (float, float, float, float) @non_variadic(float %y, float %x, float %x, float %y)
19 ret void
20}
21
22define void @variadic_fp(float %x, float %y) {
23; CHECK-LABEL: variadic_fp:
24; CHECK: b variadic
25entry:
26 %call = tail call i1 (float, ...) @variadic(float %y, float %x, float %x, float %y)
27 ret void
28}
29
30; With soft-float, general-purpose registers are used and there are not enough
31; of them to handle the 6 arguments. With hard-float, we have plenty of regs
32; (s0-s15) to pass FP arguments.
33define void @non_variadic_fp_big(float %x, float %y) {
34; CHECK-LABEL: non_variadic_fp_big:
35; CHECK-SOFT: bl non_variadic_big
36; CHECK-HARD: b non_variadic_big
37entry:
38 %call = tail call i1 (float, float, float, float, float, float) @non_variadic_big(float %y, float %x, float %x, float %y, float %x, float %y)
39 ret void
40}
41
42; Variadic functions cannot use FP regs to pass arguments; only GP regs.
43define void @variadic_fp_big(float %x, float %y) {
44; CHECK-LABEL: variadic_fp_big:
45; CHECK: bl variadic
46entry:
47 %call = tail call i1 (float, ...) @variadic(float %y, float %x, float %x, float %y, float %x, float %y)
48 ret void
49}