This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [Aarch64] Vector Function Application Binary Interface Specification for OpenMP
- From: Richard Sandiford <richard dot sandiford at linaro dot org>
- To: Steve Ellcey <sellcey at cavium dot com>
- Cc: "Richard Earnshaw \(lists\)" <Richard dot Earnshaw at arm dot com>, Francesco Petrogalli <Francesco dot Petrogalli at arm dot com>, James Greenhalgh <James dot Greenhalgh at arm dot com>, "Sekhar\, Ashwin" <Ashwin dot Sekhar at cavium dot com>, gcc <gcc at gcc dot gnu dot org>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, nd <nd at arm dot com>
- Date: Wed, 16 May 2018 22:11:27 +0100
- Subject: Re: [Aarch64] Vector Function Application Binary Interface Specification for OpenMP
- References: <1518212868.14236.47.camel@cavium.com> <32617133-64DC-4F62-B7A0-A6B417C5B14E@arm.com> <1526487700.29509.6.camel@cavium.com> <a8761c95-e4fb-dd92-8988-825c8b34475f@arm.com> <1526491802.29509.19.camel@cavium.com>
Steve Ellcey <sellcey@cavium.com> writes:
> On Wed, 2018-05-16 at 17:30 +0100, Richard Earnshaw (lists) wrote:
>> On 16/05/18 17:21, Steve Ellcey wrote:
>> >
>> > It doesn't look like GCC has any existing mechanism for having different
>> > sets of caller saved/callee saved registers depending on the function
>> > attributes of the calling or called function.
>> >
>> > Changing what registers a callee function saves and restores shouldn't
>> > be too difficult since that can be done when generating the prologue
>> > and epilogue code but changing what registers a caller saves/restores
>> > when doing the call seems trickier. The macro
>> > TARGET_HARD_REGNO_CALL_PART_CLOBBERED doesn't know anything about the
>> > function being called. It returns true/false depending on just the
>> > register number and mode.
>> >
>> > Steve Ellcey
>> > sellcey@cavium.com
>> >
>>
>> Actually, we can. See, for example, the attribute((pcs)) for the ARM
>> port. I think we could probably handle this automagically for the SVE
>> vector calling convention in AArch64.
>>
>> R.
>
> Interesting, it looks like one could use aarch64_emit_call to emit
> extra use_reg / clobber_reg instructions but in this case we want to
> tell the caller that some registers are not being clobbered by the
> callee. The ARM port does not
> define TARGET_HARD_REGNO_CALL_PART_CLOBBERED and that seemed like one
> of the most problamatic issues with Aarch64. Maybe we would have to
> undefine this for aarch64 and use explicit clobbers to say what
> floating point registers / vector registers are clobbered for each
> call? I wonder how that would affect register allocation.
TARGET_HARD_REGNO_CALL_PART_CLOBBERED is the only current way
of saying that an rtl instruction preserves the low part of a
register but clobbers the high part. We would need something like
Alan H's CLOBBER_HIGH patches to do it using explicit clobbers.
Another approach would be to piggy-back on the -fipa-ra infrastructure
and record that vector PCS functions only clobber Q0-Q7. If -fipa-ra
knows that a function doesn't clobber Q8-Q15 then that should override
TARGET_HARD_REGNO_CALL_PART_CLOBBERED. (I'm not sure whether it does
in practice, but it should :-) And if it doesn't that's a bug that's
worth fixing for its own sake.)
Thanks,
Richard