This is the mail archive of the
mailing list for the GCC project.
Re: Does GCC generate LDRD/STRD (Register) forms?
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: "Bin.Cheng" <amker dot cheng at gmail dot com>
- Cc: "Anmol Paralkar (anmparal)" <anmparal at cisco dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Erik Varga <erik dot varga256 at gmail dot com>
- Date: Tue, 7 Jul 2015 21:58:00 +0900
- Subject: Re: Does GCC generate LDRD/STRD (Register) forms?
- Authentication-results: sourceware.org; auth=none
- References: <D1C09E0B dot 6720%anmparal at cisco dot com> <CAHFci29bPX+qEOXaH=dR7nhA6DdP3DUG-b_+NWTvpuFCMCVpEg at mail dot gmail dot com>
On 07 Jul 2015, at 13:52, Bin.Cheng <firstname.lastname@example.org> wrote:
> On Tue, Jul 7, 2015 at 10:05 AM, Anmol Paralkar (anmparal)
> <email@example.com> wrote:
>> Does GCC generate LDRD/STRD (Register) forms [A8.8.74/A8.8.211 per ARMv7-A
>> & ARMv7-R ARM]?
>> Based on various attempts to write code to get GCC to generate a sample
>> form, and subsequently inspecting the code I see in
>> config/arm/arm.c/output_move_double () & arm.md [GCC 4.9.2], I think that
>> these register based forms of LDRD/STRD are
>> not generated, but I thought it might be a good idea to ask on the list,
>> just in case.
> Register based LDRD is harder than immediate version. ARM doesn't
> support [base + reg + offset] addressing mode, so address computation
> of the second memory reference is scattered both in and out of memory
> reference. To identify such opportunities, one needs to trace
> registers in address expression the memory access instruction and does
> some kind of value computation and re-association.
Basically, this is what we're trying to do with AMS. For each mem access it tries to trace the reg values and figure out the effective address expression. For now we've limited it to the form 'base_reg + index_reg*scale + const_displacement'. Then we try to see how to fit the address expressions to the available address modes.
It's still work in progress but already shows some improvements.
A classic SH4 example:
float fun (float* x)
return x + x + x + x;
If I understand correctly, ARM's LDRD/STRD are similar to SH's FPU 2x32 pair loads/stores. It needs the mem access insns of adjacent addresses to be adjacent in the insn stream. We'll try to do some mem access reordering in AMS, mainly to improve post/pre inc/dec address mode utilization. Afterwards, adjacent mem accesses can be fused together in a separate RTL pass or AMS sub-pass to avoid re-discovering mem access sequence information, which AMS already has.