1 ; RUN: llc %s -o - -mtriple=thumbv8m.main -mattr=+vfp4 | FileCheck %s
3 ;; No outgoing arguments, plenty of free registers to hold the target address.
4 define void @test0(ptr %fptr) {
6 ; CHECK: bx {{r0|r1|r2|r3|r12}}
12 ;; Four integer outgoing arguments, which use up r0-r3.
13 define void @test1(ptr %fptr) {
17 tail call void %fptr(i32 0, i32 0, i32 0, i32 0)
21 ;; Four integer outgoing arguments, which use up r0-r3, and sign-return-address
22 ;; uses r12, so we can never tail-call this.
23 define void @test2(ptr %fptr) "sign-return-address"="all" {
27 tail call void %fptr(i32 0, i32 0, i32 0, i32 0)
31 ;; An i32 and an i64 argument, which uses r0, r2 and r3 for arguments, leaving
32 ;; r1 free for the address.
33 define void @test3(ptr %fptr) {
35 ; CHECK: bx {{r1|r12}}
37 tail call void %fptr(i32 0, i64 0)
41 ;; Four float arguments, using the soft-float calling convention, which uses
43 define void @test4(ptr %fptr) {
47 tail call arm_aapcscc void %fptr(float 0.0, float 0.0, float 0.0, float 0.0)
51 ;; Four float arguments, using the soft-float calling convention, which uses
52 ;; r0-r3, and sign-return-address uses r12. Currently fails with "ran out of
53 ;; registers during register allocation".
54 define void @test5(ptr %fptr) "sign-return-address"="all" {
58 tail call arm_aapcscc void %fptr(float 0.0, float 0.0, float 0.0, float 0.0)
62 ;; Four float arguments, using the hard-float calling convention, which uses
63 ;; s0-s3, leaving the all of the integer registers free for the address.
64 define void @test6(ptr %fptr) {
66 ; CHECK: bx {{r0|r1|r2|r3|r12}}
68 tail call arm_aapcs_vfpcc void %fptr(float 0.0, float 0.0, float 0.0, float 0.0)
72 ;; Four float arguments, using the hard-float calling convention, which uses
73 ;; s0-s3, leaving r0-r3 free for the address, with r12 used for
74 ;; sign-return-address.
75 define void @test7(ptr %fptr) "sign-return-address"="all" {
77 ; CHECK: bx {{r0|r1|r2|r3}}
79 tail call arm_aapcs_vfpcc void %fptr(float 0.0, float 0.0, float 0.0, float 0.0)
83 ;; Two double arguments, using the soft-float calling convention, which uses
85 define void @test8(ptr %fptr) {
89 tail call arm_aapcscc void %fptr(double 0.0, double 0.0)
93 ;; Two double arguments, using the soft-float calling convention, which uses
94 ;; r0-r3, and sign-return-address uses r12, so we can't tail-call this.
95 define void @test9(ptr %fptr) "sign-return-address"="all" {
99 tail call arm_aapcscc void %fptr(double 0.0, double 0.0)
103 ;; Four integer arguments (one on the stack), but dut to alignment r1 is left
104 ;; empty, so can be used for the tail-call.
105 define void @test10(ptr %fptr, i64 %b, i32 %c) "sign-return-address"="all" {
106 ; CHECK-LABEL: test10:
109 tail call void %fptr(i32 0, i64 %b, i32 %c)