This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][ARM] PR target/68214: Delete IP-reg-clobbering call-through-mem patterns
- From: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- To: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Fri, 4 Dec 2015 09:41:01 +0000
- Subject: Re: [PATCH][ARM] PR target/68214: Delete IP-reg-clobbering call-through-mem patterns
- Authentication-results: sourceware.org; auth=none
- References: <56615C8E dot 8090307 at arm dot com>
On Fri, Dec 4, 2015 at 9:27 AM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
> Hi all,
>
> The wrong-code in this PR occurs for pre-ARMv5 architectures with Thumb
> interworking when trying
> to use a static chain. Our output_call_mem function that outputs the
> assembly for the call explicitly
> clobbers the IP register, which is also used as the static chain register.
>
> Richard suggested offline that we can just remove the *call_mem and
> *call_value_mem patterns as they
> are of no use anymore and just cause us trouble such as this. The midend
> does a good enough job of
> figuring out it has to load the address to which we should branch.
>
> So this patch does that. It's an entirely negative diffstat :)
> For the failing testcase gcc.dg/cwsc1.c the bad code before this patch in
> the main function is:
> mov ip, r4
> ldr r3, .L6
> ldr ip, [r3]
> mov lr, pc
> bx ip
>
> and with this patch it is:
> ldr r3, .L6
> ldr r3, [r3]
> mov ip, r4
> mov lr, pc
> bx r3
>
> As you can see it's correct and no less efficient than before.
>
> Bootstrapped and tested on arm-none-linux-gnueabihf and a test run with
> -mcpu=arm7tdmi didn't show any problems.
>
> Ok for trunk?
>
Ok - thanks.
Ramana
> Thanks,
> Kyrill
>
> 2015-12-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> PR target/68214
> * config/arm/arm.md (*call_mem): Delete pattern.
> (*call_value_mem): Likewise.
> * config/arm/arm.c (output_call_mem): Delete.
> * config/arm/arm-protos.h (output_call_mem): Delete prototype.