Home | History | Annotate | Download | only in ARM
      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: vldr d0, [[CP_LABEL:.*]]
     58 ; CHECK-M4F: bl test_1double
     59 ; CHECK-M4F: [[CP_LABEL]]
     60 ; CHECK-M4F-NEXT: .long 0
     61 ; CHECK-M4F-NEXT: .long 1072693248
     62 
     63   call arm_aapcs_vfpcc void @test_1double({ double } { double 1.0 })
     64   ret void
     65 }
     66 
     67 ; Final double argument might be put in s15 & [sp] if we're careless. It should
     68 ; go all on the stack.
     69 define arm_aapcs_vfpcc void @test_1double_nosplit([4 x float], [4 x double], [3 x float], double %a) {
     70 ; CHECK-LABEL: test_1double_nosplit:
     71 ; CHECK-DAG: mov [[ONELO:r[0-9]+]], #0
     72 ; CHECK-DAG: movw [[ONEHI:r[0-9]+]], #0
     73 ; CHECK-DAG: movt [[ONEHI]], #16368
     74 ; CHECK: strd [[ONELO]], [[ONEHI]], [sp]
     75 ; CHECK: bl test_1double_nosplit
     76 
     77 ; CHECK-M4F-LABEL: test_1double_nosplit:
     78 ; CHECK-M4F: movs [[ONEHI:r[0-9]+]], #0
     79 ; CHECK-M4F: movs [[ONELO:r[0-9]+]], #0
     80 ; CHECK-M4F: movt [[ONEHI]], #16368
     81 ; CHECK-M4F: strd [[ONELO]], [[ONEHI]], [sp]
     82 ; CHECK-M4F: bl test_1double_nosplit
     83   call arm_aapcs_vfpcc void @test_1double_nosplit([4 x float] undef, [4 x double] undef, [3 x float] undef, double 1.0)
     84   ret void
     85 }
     86 
     87 ; Final double argument might go at [sp, #4] if we're careless. Should go at
     88 ; [sp, #8] to preserve alignment.
     89 define arm_aapcs_vfpcc void @test_1double_misaligned([4 x double], [4 x double], float, double) {
     90   call arm_aapcs_vfpcc void @test_1double_misaligned([4 x double] undef, [4 x double] undef, float undef, double 1.0)
     91 
     92 ; CHECK-LABEL: test_1double_misaligned:
     93 ; CHECK-DAG: movw [[ONEHI:r[0-9]+]], #0
     94 ; CHECK-DAG: mov [[ONELO:r[0-9]+]], #0
     95 ; CHECK-DAG: movt [[ONEHI]], #16368
     96 ; CHECK-DAG: strd [[ONELO]], [[ONEHI]], [sp, #8]
     97 
     98 ; CHECK-M4F-LABEL: test_1double_misaligned:
     99 ; CHECK-M4F: movs [[ONEHI:r[0-9]+]], #0
    100 ; CHECK-M4F: movs [[ONELO:r[0-9]+]], #0
    101 ; CHECK-M4F: movt [[ONEHI]], #16368
    102 ; CHECK-M4F: strd [[ONELO]], [[ONEHI]], [sp, #8]
    103 ; CHECK-M4F: bl test_1double_misaligned
    104 
    105   ret void
    106 }
    107