[PATCH,ARM] Improve extendsidi without neon

Greta Yorsh greta.yorsh@arm.com
Fri Feb 22 13:54:00 GMT 2013

This patch improves code generated for extension from SI to DI mode for core
registers when neon is not enabled.

Currently, if neon is enabled, extendsidi for core registers benefits from
the patch described here (r194558 from 17 Dec 2012):

Before r194558, the compiler used to split extendsidi before register
allocation (at split1 pass), which resulted in some cases in an extra
register being used and an extra register move. After r194558, if neon is
enabled, extendsidi is split after reload, generating better code.
Unfortunately, when neon is not enabled, the splitter is still triggered
before reload.

For example, 

$ cat negdi-1.c

signed long long extendsidi_negsi (signed int x)
  return -x;

$ arm-none-eabi-gcc negdi-1.c -S -O2 -o- -mfpu=vfpv4

        rsb     r3, r0, #0      @ 6     *arm_negsi2     [length = 4]
        mov     r0, r3  @ 19    *arm_movsi_vfp/1        [length = 4]
        mov     r1, r3, asr #31 @ 20    *arm_shiftsi3   [length = 4]
        bx      lr      @ 25    *arm_return     [length = 12]

$ arm-none-eabi-gcc negdi-1.c -S -O2 -o- -mfpu=neon

        rsb     r0, r0, #0      @ 6     *arm_negsi2     [length = 4]
        mov     r1, r0, asr #31 @ 20    *arm_shiftsi3   [length = 4]
        bx      lr      @ 23    *arm_return     [length = 12]

This patch changes the condition of splitters for extendsidi to trigger only
after reload.

In addition, this patch fixes a bug in zero_extend<mode>di2 and
extend<mode>di2 patterns. One of the alternatives in these patterns has a
constraint 'w' which is not valid when neon is disabled, but the patterns
don't have attributes to guard these alternatives by neon availability. This
might cause an ICE when neon is not available. Currently, it seems that the
patterns are only matched by RTL insns that are generated by splitters with
conditions on neon being enabled. However, it may be a latent bug. In any
case, the change in conditions of these splitters made by this patch
triggers the bug and causes an ICE. 

No regression on qemu for arm-none-eabi cortex-a15 arm/thumb neon/vfpv4

Bootstrap successful on Cortex-A15.

I haven't added a test case because tests that scan assembly for 'mov' are
very unstable.

Ok for trunk?


2013-02-21  Greta Yorsh  <Greta.Yorsh@arm.com>

        * config/arm/arm.md (split for extendsidi): Update condition.
        (zero_extend<mode>di2,extend<mode>di2): Add an alternative.
        * config/arm/iterators.md (qhs_extenddi_cstr): Likewise.
        (qhs_zextenddi_cstr): Likewise.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: extendsidi-split-cond.v2.patch.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130222/d285c202/attachment.txt>

More information about the Gcc-patches mailing list