This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH,ARM][4/n] Add negdi_extend patterns


This patch adds patterns to handle negation of an extended 32-bit value more
efficiently.

For example,

(set (reg:DI r0) (neg:DI (sign_extend:DI (reg:SI r0)))

The compiler currently generates
        mov     r1, r0, asr #31
        rsbs    r0, r0, #0
        rsc     r1, r1, #0
and after the patch it generates:
      rsb     r0, r0, #0
      mov     r1, r0, asr #31

(set (reg:DI r0) (neg:DI (zero_extend:DI (reg:SI r0)))

The compiler currently generates
        mov     r1, #0
        rsbs    r0, r0, #0
        rsc     r1, r1, #0
and after the patch it generates:
      rsbs    r0, r0, #0
      sbc     r1, r1, r1

The following examples are not affected by the patch:

(set (reg:DI r0) (sign_extend:DI (neg:SI (reg:SI r0)))
      rsb       r0, r0, #0
      mov     r1, r0, asr #31

(set (reg:DI r0) (zero_extend:DI (neg:SI (reg:SI r0)))
      rsb     r0, r0, #0
      mov     r1, #0

The patch also adds the appropriate test cases.

gcc/

2013-01-10  Greta Yorsh  <Greta.Yorsh@arm.com>

        * config/arm/arm.md (negdi_extendsidi): New pattern.
        (negdi_zero_extendsidi): Likewise.

gcc/testsuite

2013-01-10  Greta Yorsh  <Greta.Yorsh@arm.com>

        * gcc.target/arm/negdi-1.c: New test.
        * gcc.target/arm/negdi-2.c: Likewise.
        * gcc.target/arm/negdi-3.c: Likewise.
        * gcc.target/arm/negdi-4.c: Likewise.

Attachment: 4-negdi-extend.patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]