On Thu, 02 Jun 2011 16:35:01 +0100
Richard Earnshaw <rearn...@arm.com> wrote:
> I see Paul has already approved this, but I've just spotted one
> potential problem that might cause latent bugs sometime in the future.
>
> The code to register the libcalls is only run once, the first time we
> try to look up a libcall. If we ever end up allowing dynamic changing
> of CPU and optimization options, not registering the other libcalls
> will lead to subtle problems at run time. I suggest that these
> functions be unconditionally added along with the other libcalls.
Done.
> I also don't understand why all the tests are needed in
> arm_init_cumulative_args? Surely arm_libcall_uses_aapcs_base() will
> already have run that test.
I did some archaeology to try to figure out why things were like that
(the patch was written a while ago) -- and yeah, it looks like it's
completely unnecessary to have those tests in arm_init_cumulative_args.
That bit of code was refactored a while ago, and it looks like the
patch wasn't ever updated properly. My mistake!
I'm re-testing the attached version.
Thanks,
Julian
ChangeLog
gcc/
* config/arm/arm.c (arm_libcall_uses_aapcs_base): Use correct ABI
for double-precision helper functions in hard-float mode if only
single-precision arithmetic is supported in hardware.
commit 8084eeee248e648e3276b91a957f667c299f84e1
Author: Julian Brown <jul...@henry7.codesourcery.com>
Date: Fri Jun 3 04:34:23 2011 -0700
VFP ABI fix for double-precision helpers on single-only processors.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 057f9ba..a1d009b 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3345,6 +3345,28 @@ arm_libcall_uses_aapcs_base (const_rtx libcall)
convert_optab_libfunc (sfix_optab, DImode, SFmode));
add_libcall (libcall_htab,
convert_optab_libfunc (ufix_optab, DImode, SFmode));
+
+ /* Values from double-precision helper functions are returned in core
+ registers if the selected core only supports single-precision
+ arithmetic, even if we are using the hard-float ABI. The same is
+ true for single-precision helpers, but we will never be using the
+ hard-float ABI on a CPU which doesn't support single-precision
+ operations in hardware. */
+ add_libcall (libcall_htab, optab_libfunc (add_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (sdiv_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (smul_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (neg_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (sub_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (eq_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (lt_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (le_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (ge_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (gt_optab, DFmode));
+ add_libcall (libcall_htab, optab_libfunc (unord_optab, DFmode));
+ add_libcall (libcall_htab, convert_optab_libfunc (sext_optab, DFmode,
+ SFmode));
+ add_libcall (libcall_htab, convert_optab_libfunc (trunc_optab, SFmode,
+ DFmode));
}
return libcall && htab_find (libcall_htab, libcall) != NULL;