llvm.org GIT mirror llvm / 9f5baa3
Tweak ARM fastcc by adopting these two AAPCS rules: * CPRCs may be allocated to co-processor registers or the stack – they may never be allocated to core registers * When a CPRC is allocated to the stack, all other VFP registers should be marked as unavailable The difference is only noticeable in rare cases where there are a large number of floating point arguments (e.g. 7 doubles + additional float, double arguments). Although it's probably still better to avoid vmov as it can cause stalls in some older ARM cores. The other, more subtle benefit, is to minimize difference between the various calling conventions. rdar://16039676 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201193 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 6 years ago
2 changed file(s) with 47 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
6363 CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>,
6464 CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, S8,
6565 S9, S10, S11, S12, S13, S14, S15]>>,
66
67 // CPRCs may be allocated to co-processor registers or the stack – they
68 // may never be allocated to core registers.
69 CCIfType<[f32], CCAssignToStackWithShadow<4, 4, [Q0, Q1, Q2, Q3]>>,
70 CCIfType<[f64], CCAssignToStackWithShadow<8, 4, [Q0, Q1, Q2, Q3]>>,
71 CCIfType<[v2f64], CCAssignToStackWithShadow<16, 4, [Q0, Q1, Q2, Q3]>>,
72
6673 CCDelegateTo
6774 ]>;
6875
0 ; RUN: llc < %s -mtriple=armv7-apple-ios -mattr=+vfp2 | FileCheck %s
1
2 define fastcc double @t1(double %d0, double %d1, double %d2, double %d3, double %d4, double %d5, double %d6, double %d7, float %a, float %b) {
3 entry:
4 ; CHECK-LABEL: t1:
5 ; CHECK-NOT: vmov
6 ; CHECK: vldr
7 %add = fadd float %a, %b
8 %conv = fpext float %add to double
9 ret double %conv
10 }
11
12 define fastcc double @t2(double %d0, double %d1, double %d2, double %d3, double %d4, double %d5, double %a, float %b, double %c) {
13 entry:
14 ; CHECK-LABEL: t2:
15 ; CHECK-NOT: vmov
16 ; CHECK: vldr
17 %add = fadd double %a, %c
18 ret double %add
19 }
20
21 define fastcc float @t3(double %d0, double %d1, double %d2, double %d3, double %d4, double %d5, double %d6, float %a, double %b, float %c) {
22 entry:
23 ; CHECK-LABEL: t3:
24 ; CHECK: vldr
25 %add = fadd float %a, %c
26 ret float %add
27 }
28
29 define fastcc double @t4(double %a, double %b) #0 {
30 entry:
31 ; CHECK-LABEL: t4:
32 ; CHECK: vstr
33 %add = fadd double %a, %b
34 %sub = fsub double %a, %b
35 %call = tail call fastcc double @x(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double %add, float 0.000000e+00, double %sub) #2
36 ret double %call
37 }
38
39 declare fastcc double @x(double, double, double, double, double, double, double, float, double)