From c3e7c725b540c837e25093e2f488a4667f4d4ea0 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Thu, 21 Nov 2013 21:14:25 +0800 Subject: [PATCH] Fix counting of VFP regs in ARM's gfunc_prolog Fix in gfunc_prolog for ARM the counting of the highest numbered VFP float register used for parameter passing, rounded to 2. It can be computed from the range of VFP float register with the highest range start and adding the number of VFP float register occupied. This ensure that parameter of type struct that spans over more than 2 float registers are correctly taken into account. --- arm-gen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arm-gen.c b/arm-gen.c index 488de76..0fa2eb0 100644 --- a/arm-gen.c +++ b/arm-gen.c @@ -1227,7 +1227,8 @@ void gfunc_prolog(CType *func_type) #ifdef TCC_ARM_HARDFLOAT if (!variadic && (is_float(sym2->type.t) || is_hgen_float_aggr(&sym2->type))) { - int tmpnf = assign_vfpreg(&avregs, align, size) + 1; + int tmpnf = assign_vfpreg(&avregs, align, size); + tmpnf += (size + 3) / 4; nf = (tmpnf > nf) ? tmpnf : nf; } else #endif