Home | History | Annotate | Download | only in ARM
      1 ;Check 5.5 Parameter Passing --> Stage C --> C.5 statement, when NSAA is not
      2 ;equal to SP.
      3 ;
      4 ; Our purpose: make NSAA != SP, and only after start to use GPRs, then pass
      5 ;              byval parameter and check that it goes to stack only.
      6 ;
      7 ;Co-Processor register candidates may be either in VFP or in stack, so after
      8 ;all VFP are allocated, stack is used. We can use stack without GPR allocation
      9 ;in that case, passing 9 f64 params, for example.
     10 ;First eight params goes to d0-d7, ninth one goes to the stack.
     11 ;Now, as 10th parameter, we pass i32, and it must go to R0.
     12 ;
     13 ;For more information,
     14 ;please, read 5.5 Parameter Passing, Stage C, stages C.2.cp, C.4 and C.5
     15 ;
     16 ;
     17 ;RUN: llc -mtriple=thumbv7-linux-gnueabihf -float-abi=hard < %s | FileCheck %s
     18 
     19 %struct_t = type { i32, i32, i32, i32 }
     20 @static_val = constant %struct_t { i32 777, i32 888, i32 999, i32 1000 }
     21 declare void @fooUseStruct(%struct_t*)
     22 
     23 define void @foo2(double %p0, ; --> D0
     24                   double %p1, ; --> D1
     25 		  double %p2, ; --> D2
     26 		  double %p3, ; --> D3
     27 		  double %p4, ; --> D4
     28 		  double %p5, ; --> D5
     29 		  double %p6, ; --> D6
     30 		  double %p7, ; --> D7
     31 		  double %p8, ; --> Stack
     32 		  i32 %p9,    ; --> R0
     33                   %struct_t* byval %p10) ; --> Stack+8
     34 {
     35 entry:
     36 ;CHECK:     push.w {r11, lr}
     37 ;CHECK-NOT: stm
     38 ;CHECK:     add r0, sp, #16
     39 ;CHECK:     bl fooUseStruct
     40   call void @fooUseStruct(%struct_t* %p10)
     41 
     42   ret void
     43 }
     44 
     45 define void @doFoo2() {
     46 entry:
     47 ;CHECK-NOT: ldm
     48   tail call void @foo2(double 23.0, ; --> D0
     49                        double 23.1, ; --> D1
     50 		       double 23.2, ; --> D2
     51                        double 23.3, ; --> D3
     52                        double 23.4, ; --> D4
     53                        double 23.5, ; --> D5
     54                        double 23.6, ; --> D6
     55                        double 23.7, ; --> D7
     56                        double 23.8, ; --> Stack
     57                        i32 43,      ; --> R0, not Stack+8
     58                        %struct_t* byval @static_val) ; --> Stack+8, not R1     
     59   ret void
     60 }
     61 
     62