1 ; RUN: llc < %s -mtriple=armv7-linux-gnueabihf -o - | FileCheck %s 2 ; RUN: llc < %s -mtriple=thumbv7em-none-eabi -mcpu=cortex-m4 | FileCheck %s --check-prefix=CHECK-M4F 3 4 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64" 5 6 define arm_aapcs_vfpcc void @test_1float({ float } %a) { 7 call arm_aapcs_vfpcc void @test_1float({ float } { float 1.0 }) 8 ret void 9 10 ; CHECK-LABEL: test_1float: 11 ; CHECK-DAG: vmov.f32 s0, #1.{{0+}}e+00 12 ; CHECK: bl test_1float 13 14 ; CHECK-M4F-LABEL: test_1float: 15 ; CHECK-M4F-DAG: vmov.f32 s0, #1.{{0+}}e+00 16 ; CHECK-M4F: bl test_1float 17 } 18 19 define arm_aapcs_vfpcc void @test_2float({ float, float } %a) { 20 call arm_aapcs_vfpcc void @test_2float({ float, float } { float 1.0, float 2.0 }) 21 ret void 22 23 ; CHECK-LABEL: test_2float: 24 ; CHECK-DAG: vmov.f32 s0, #1.{{0+}}e+00 25 ; CHECK-DAG: vmov.f32 s1, #2.{{0+}}e+00 26 ; CHECK: bl test_2float 27 28 ; CHECK-M4F-LABEL: test_2float: 29 ; CHECK-M4F-DAG: vmov.f32 s0, #1.{{0+}}e+00 30 ; CHECK-M4F-DAG: vmov.f32 s1, #2.{{0+}}e+00 31 ; CHECK-M4F: bl test_2float 32 } 33 34 define arm_aapcs_vfpcc void @test_3float({ float, float, float } %a) { 35 call arm_aapcs_vfpcc void @test_3float({ float, float, float } { float 1.0, float 2.0, float 3.0 }) 36 ret void 37 38 ; CHECK-LABEL: test_3float: 39 ; CHECK-DAG: vmov.f32 s0, #1.{{0+}}e+00 40 ; CHECK-DAG: vmov.f32 s1, #2.{{0+}}e+00 41 ; CHECK-DAG: vmov.f32 s2, #3.{{0+}}e+00 42 ; CHECK: bl test_3float 43 44 ; CHECK-M4F-LABEL: test_3float: 45 ; CHECK-M4F-DAG: vmov.f32 s0, #1.{{0+}}e+00 46 ; CHECK-M4F-DAG: vmov.f32 s1, #2.{{0+}}e+00 47 ; CHECK-M4F-DAG: vmov.f32 s2, #3.{{0+}}e+00 48 ; CHECK-M4F: bl test_3float 49 } 50 51 define arm_aapcs_vfpcc void @test_1double({ double } %a) { 52 ; CHECK-LABEL: test_1double: 53 ; CHECK-DAG: vmov.f64 d0, #1.{{0+}}e+00 54 ; CHECK: bl test_1double 55 56 ; CHECK-M4F-LABEL: test_1double: 57 ; CHECK-M4F: movs [[ONEHI:r[0-9]+]], #0 58 ; CHECK-M4F: movs [[ONELO:r[0-9]+]], #0 59 ; CHECK-M4F: movt [[ONEHI]], #16368 60 ; CHECK-M4F-DAG: vmov s0, [[ONELO]] 61 ; CHECK-M4F-DAG: vmov s1, [[ONEHI]] 62 ; CHECK-M4F: bl test_1double 63 64 call arm_aapcs_vfpcc void @test_1double({ double } { double 1.0 }) 65 ret void 66 } 67 68 ; Final double argument might be put in s15 & [sp] if we're careless. It should 69 ; go all on the stack. 70 define arm_aapcs_vfpcc void @test_1double_nosplit([4 x float], [4 x double], [3 x float], double %a) { 71 ; CHECK-LABEL: test_1double_nosplit: 72 ; CHECK-DAG: mov [[ONELO:r[0-9]+]], #0 73 ; CHECK-DAG: movw [[ONEHI:r[0-9]+]], #0 74 ; CHECK-DAG: movt [[ONEHI]], #16368 75 ; CHECK: strd [[ONELO]], [[ONEHI]], [sp] 76 ; CHECK: bl test_1double_nosplit 77 78 ; CHECK-M4F-LABEL: test_1double_nosplit: 79 ; CHECK-M4F: movs [[ONELO:r[0-9]+]], #0 80 ; CHECK-M4F: movs [[ONEHI:r[0-9]+]], #0 81 ; CHECK-M4F: movt [[ONEHI]], #16368 82 ; CHECK-M4F-DAG: str [[ONELO]], [sp] 83 ; CHECK-M4F-DAG: str [[ONEHI]], [sp, #4] 84 ; CHECK-M4F: bl test_1double_nosplit 85 call arm_aapcs_vfpcc void @test_1double_nosplit([4 x float] undef, [4 x double] undef, [3 x float] undef, double 1.0) 86 ret void 87 } 88 89 ; Final double argument might go at [sp, #4] if we're careless. Should go at 90 ; [sp, #8] to preserve alignment. 91 define arm_aapcs_vfpcc void @test_1double_misaligned([4 x double], [4 x double], float, double) { 92 call arm_aapcs_vfpcc void @test_1double_misaligned([4 x double] undef, [4 x double] undef, float undef, double 1.0) 93 94 ; CHECK-LABEL: test_1double_misaligned: 95 ; CHECK-DAG: mov [[ONELO:r[0-9]+]], #0 96 ; CHECK-DAG: mov r[[BASE:[0-9]+]], sp 97 ; CHECK-DAG: movw [[ONEHI:r[0-9]+]], #0 98 ; CHECK-DAG: movt [[ONEHI]], #16368 99 ; CHECK-DAG: str [[ONELO]], [r[[BASE]], #8]! 100 ; CHECK-DAG: str [[ONEHI]], [r[[BASE]], #4] 101 102 ; CHECK-M4F-LABEL: test_1double_misaligned: 103 ; CHECK-M4F: movs [[ONELO:r[0-9]+]], #0 104 ; CHECK-M4F: movs [[ONEHI:r[0-9]+]], #0 105 ; CHECK-M4F: movt [[ONEHI]], #16368 106 ; CHECK-M4F-DAG: str [[ONELO]], [sp, #8] 107 ; CHECK-M4F-DAG: str [[ONEHI]], [sp, #12] 108 ; CHECK-M4F: bl test_1double_misaligned 109 110 ret void 111 } 112