This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ARM][PR65768] Keep constants in register when expanding
- From: Kugan <kugan dot vivekanandarajah at linaro dot org>
- To: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Ramana Radhakrishnan <Ramana dot Radhakrishnan at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Wed, 15 Apr 2015 18:28:01 +1000
- Subject: Re: [ARM][PR65768] Keep constants in register when expanding
- Authentication-results: sourceware.org; auth=none
- References: <552E17C7 dot 80800 at linaro dot org> <552E1F88 dot 4000804 at arm dot com>
On 15/04/15 18:21, Kyrill Tkachov wrote:
> Hi Kugan,
>
> On 15/04/15 08:48, Kugan wrote:
>> As mentioned in PR65768, ARM gcc generates suboptimal code for constant
>> Uses in loop. Part of the reason is that ARM back-end is splitting
>> constants during expansion of RTL, making it hard for the RTL
>> optimization passes to optimize it. Zhenqiang posted a patch at
>> https://gcc.gnu.org/ml/gcc-patches/2014-08/msg00325.html to fix this
>>
>> As mentioned in PR65768, I tried with few more test-cases and enhanced
>> it. Regression tested on arm-none-linux-gnu and no new regressions. Is
>> this OK for trunk?
>
> Can you please post the code generated for the testcase
> before and after the patch for the record?
Hi Kyrill,
Before:
maskdata:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
cmp r1, #0
bxle lr
add r1, r0, r1, lsl #2
.L3:
ldr r3, [r1, #-4]!
cmp r1, r0
bic r3, r3, #-16777216
bic r3, r3, #65280
str r3, [r1]
bne .L3
bx lr
After (using the the cprop patch also):
maskdata:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
cmp r1, #0
bxle lr
mov r2, #255
add r1, r0, r1, lsl #2
movt r2, 255
.L3:
ldr r3, [r1, #-4]!
cmp r1, r0
and r3, r3, r2
str r3, [r1]
bne .L3
bx lr
Thanks,
Kugan
>
> Thanks,
> Kyrill
>
>
>>
>> Thanks,
>> Kugan
>>
>>
>> gcc/ChangeLog:
>>
>> 2015-04-15 Kugan Vivekanandarajah <kuganv@linaro.org>
>> Zhenqiang Chen <zhenqiang.chen@linaro.org>
>>
>> PR target/65768
>> * config/arm/arm-protos.h (const_ok_for_split): New definition.
>> * config/arm/arm.c (const_ok_for_split): New function.
>> * config/arm/arm.md (subsi3, andsi3, iorsi3, xorsi3, movsi): Keep
>> some
>> large constants in register instead of splitting them.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2015-04-15 Kugan Vivekanandarajah <kuganv@linaro.org>
>> Zhenqiang Chen <zhenqiang.chen@linaro.org>
>>
>> PR target/65768
>> * gcc.target/arm/maskdata.c: New test.
>