Pablo Barrio | c41e856 | 2016-11-17 10:56:58 +0000 | [diff] [blame] | 1 | ; 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 | |
| 10 | declare i1 @non_variadic(float, float, float, float) |
| 11 | declare i1 @non_variadic_big(float, float, float, float, float, float) |
| 12 | declare i1 @variadic(float, ...) |
| 13 | |
| 14 | define void @non_variadic_fp(float %x, float %y) { |
| 15 | ; CHECK-LABEL: non_variadic_fp: |
| 16 | ; CHECK: b non_variadic |
| 17 | entry: |
| 18 | %call = tail call i1 (float, float, float, float) @non_variadic(float %y, float %x, float %x, float %y) |
| 19 | ret void |
| 20 | } |
| 21 | |
| 22 | define void @variadic_fp(float %x, float %y) { |
| 23 | ; CHECK-LABEL: variadic_fp: |
| 24 | ; CHECK: b variadic |
| 25 | entry: |
| 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. |
| 33 | define 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 |
| 37 | entry: |
| 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. |
| 43 | define void @variadic_fp_big(float %x, float %y) { |
| 44 | ; CHECK-LABEL: variadic_fp_big: |
| 45 | ; CHECK: bl variadic |
| 46 | entry: |
| 47 | %call = tail call i1 (float, ...) @variadic(float %y, float %x, float %x, float %y, float %x, float %y) |
| 48 | ret void |
| 49 | } |