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]

Improve additions involving SP on Thumb-1


Thumb-1 supports a range of up to 1020 for add insns of the form

  add rn, sp, #1020

If the constant is somewhat larger, we can do it with a sequence of two
adds, which is better than the available alternatives:

-       ldr     r4, .L64+12
-       add     r4, r4, sp
+       add     r4, sp, #1020
+       add     r4, r4, #224

or

-       mov     r0, #156
-       lsl     r0, r0, #3
-       add     r0, r0, sp
+       add     r0, sp, #1020
+       add     r0, r0, #228

It's conceivable that we might even prefer a three-insn add sequence
over either of these alternatives, but the following patch doesn't do this.

Regression tested on arm-linux, with one extra timeout (which comes and
goes - it went away vs. baseline for a different set of compiler flags).
 Ok?


Bernd

Attachment: thumb-addsp.diff
Description: Text document


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