This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][ARM] Implementation of VFP hard float ABI


Hi,

This patch implements VFP hard float, i.e. the -mfloat-abi=hard
-mfpu=vfp configuration, as specified according to section 6 of the ARM
AAPCS. This provides floating point parameter passing and value
returning in VFP registers for ARM, including vector type support for
NEON.

Our main support here is for AAPCS.
The ATPCS conventions for VFP seems to be identical (AAPCS seems to only
expand on specifications for vector types), so nothing was done in
particular for ATPCS. However such VFP ATPCS compatibility was not
tested with any other compiler, so correct me if I'm wrong. I can't seem
to find any standard for APCS + VFP, so assuming it's a void, whatever
AAPCS conventions that fall through will simply be used.

We have built complete toolchains with this patch. It has been testsuite
checked, and ABI conformance checked with ARM's compiler tools (except
for any GCC language features that RVCT 3.1 does not currently support)
under ARM EABI Linux (using QEMU), so the core argument passing/return
code should be fairly complete and working. I'm hoping others more
familiar with their respective ARM environments could also check it out
(if I overlooked some configuration assumption or anything else).

(I believe I'll need to have the copyright assignments and employer
disclaimer completed before this patch gets accepted. Can anyone help me
on that? Thanks.)


Regards,
Chung-Lin Tang - Marvell Taiwan


--
Notes:
* As this configuration will not be compatible with existing libraries,
it is advisable to simply rebuild the entire toolchain to try out this
patch. What we did was configure the GCC build with --with-float=hard
--with-fpu=vfp. I have not yet worked on any multilib configuration
support in this patch; how it should be organized to be convenient to
use I believe others will be more knowledgeable.


* gcc.dg/builtin-apply2.c does not pass anymore with this patch applied
:P
The case seems similar to a recent AVR issue on this same testcase that
appeared in this list, basically calling conventions differing between
variadic/non-variadic functions.

The AAPCS specifies that the VFP hard ABI only applies to non-variadic
functions, and variadic functions fall back to the base calling
convention standard. Effectively, with any FP arguments involved, the
ABIs for variadic/non-variadic functions diverge to different
conventions. So as exercised in the builtin-apply2.c testcase, using the
__builtin_apply set of features to do FP argument marshalling between
calling/called functions that are one variadic and one not, simply does
not work.


--

2008-06-30  Chung-Lin Tang  <ctang@marvell.com>

	* config/arm/arm-protos.h (arm_function_arg_advance): New
function prototype.
	* config/arm/arm.c (arm_override_options): Remove VFP hard float
blocker.
	(arm_vfp_aapcs_handled_p): New function.
	(arm_vfp_aapcs_handled_mode_p): New function.
	(arm_vfp_allocate_args): New function.
	(arm_vfp_gen_aggregate_parallel): New function.
	(arm_function_value): Remove ATTRIBUTE_UNUSED from fntype
argument. VFP hard float support.
	(arm_apply_result_size): VFP hard float support.
	(arm_return_in_memory): Remove ATTRIBUTE_UNUSED from fntype
argument. VFP hard float support.
	(arm_init_cumulative_args): VFP hard float support.
	(arm_function_arg): VFP hard float support.
	(arm_function_arg_advance): New function.
	(arm_arg_partial_bytes): VFP hard float support.
	* config/arm/arm.h (LIBCALL_VALUE): VFP hard float support.
Modify to call ARM_MODE_RETURN_REG.
	(ARM_MODE_RETURN_REG): New macro, subsumes much of original
LIBCALL_VALUE.
	(FUNCTION_VALUE_REGNO): VFP hard float support.
	(CUMULATIVE_ARGS): New fields vfp_aapcs_on and vfp_regset.
	(FUNCTION_ARG_ADVANCE): Modify to call
arm_function_arg_advance().
	(FUNCTION_ARG_REGNO_P): VFP hard float support.
	* config/arm/ieee754-sf.S (aeabi_l2d, aeabi_ul2d): long long
conversion support for VFP hard float.
	* config/arm/ieee754-df.S (aeabi_l2f, aeabi_ul2f): Likewise.

Attachment: vfp-hard-float.patch
Description: vfp-hard-float.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]