brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · c6ace3e Raw
112 lines · plain
1; RUN: llc %s -o - -mtriple=thumbv8m.main -mattr=+vfp4 | FileCheck %s2 3;; No outgoing arguments, plenty of free registers to hold the target address.4define void @test0(ptr %fptr) {5; CHECK-LABEL: test0:6; CHECK: bx {{r0|r1|r2|r3|r12}}7entry:8  tail call void %fptr()9  ret void10}11 12;; Four integer outgoing arguments, which use up r0-r3.13define void @test1(ptr %fptr) {14; CHECK-LABEL: test1:15; CHECK: bx r1216entry:17  tail call void %fptr(i32 0, i32 0, i32 0, i32 0)18  ret void19}20 21;; Four integer outgoing arguments, which use up r0-r3, and sign-return-address22;; uses r12, so we can never tail-call this.23define void @test2(ptr %fptr) "sign-return-address"="all" {24; CHECK-LABEL: test2:25; CHECK: blx26  entry:27  tail call void %fptr(i32 0, i32 0, i32 0, i32 0)28  ret void29}30 31;; An i32 and an i64 argument, which uses r0, r2 and r3 for arguments, leaving32;; r1 free for the address.33define void @test3(ptr %fptr) {34; CHECK-LABEL: test3:35; CHECK: bx {{r1|r12}}36entry:37  tail call void %fptr(i32 0, i64 0)38  ret void39}40 41;; Four float arguments, using the soft-float calling convention, which uses42;; r0-r3.43define void @test4(ptr %fptr) {44; CHECK-LABEL: test4:45; CHECK: bx r1246entry:47  tail call arm_aapcscc void %fptr(float 0.0, float 0.0, float 0.0, float 0.0)48  ret void49}50 51;; Four float arguments, using the soft-float calling convention, which uses52;; r0-r3, and sign-return-address uses r12. Currently fails with "ran out of53;; registers during register allocation".54define void @test5(ptr %fptr) "sign-return-address"="all" {55; CHECK-LABEL: test5:56; CHECK: blx57entry:58  tail call arm_aapcscc void %fptr(float 0.0, float 0.0, float 0.0, float 0.0)59  ret void60}61 62;; Four float arguments, using the hard-float calling convention, which uses63;; s0-s3, leaving the all of the integer registers free for the address.64define void @test6(ptr %fptr) {65; CHECK-LABEL: test6:66; CHECK: bx {{r0|r1|r2|r3|r12}}67entry:68  tail call arm_aapcs_vfpcc void %fptr(float 0.0, float 0.0, float 0.0, float 0.0)69  ret void70}71 72;; Four float arguments, using the hard-float calling convention, which uses73;; s0-s3, leaving r0-r3 free for the address, with r12 used for74;; sign-return-address.75define void @test7(ptr %fptr) "sign-return-address"="all" {76; CHECK-LABEL: test7:77; CHECK: bx {{r0|r1|r2|r3}}78entry:79  tail call arm_aapcs_vfpcc void %fptr(float 0.0, float 0.0, float 0.0, float 0.0)80  ret void81}82 83;; Two double arguments, using the soft-float calling convention, which uses84;; r0-r3.85define void @test8(ptr %fptr) {86; CHECK-LABEL: test8:87; CHECK: bx r1288entry:89  tail call arm_aapcscc void %fptr(double 0.0, double 0.0)90  ret void91}92 93;; Two double arguments, using the soft-float calling convention, which uses94;; r0-r3, and sign-return-address uses r12, so we can't tail-call this.95define void @test9(ptr %fptr) "sign-return-address"="all" {96; CHECK-LABEL: test9:97; CHECK: blx98entry:99  tail call arm_aapcscc void %fptr(double 0.0, double 0.0)100  ret void101}102 103;; Four integer arguments (one on the stack), but dut to alignment r1 is left104;; empty, so can be used for the tail-call.105define void @test10(ptr %fptr, i64 %b, i32 %c) "sign-return-address"="all" {106; CHECK-LABEL: test10:107; CHECK: bx r1108entry:109  tail call void %fptr(i32 0, i64 %b, i32 %c)110  ret void111}112