This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[csl-arm] Thumb-2 PIC code size tweak
- From: Paul Brook <paul at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 13 Jul 2006 16:41:02 +0100
- Subject: [csl-arm] Thumb-2 PIC code size tweak
The patch below uses the "adr" instruction instead of "addw" for PIC register
setup. This allows the assembler to choose the short form of this instruction
where appropriate.
Tested with cross to arm-none-eabi.
Applied to branches/csl/sourcerygxx-4_1.
Paul
2006-07-13 Paul Brook <paul@codesourcery.com>
gcc/
* config/arm/thumb2.md (pic_load_dot_plus_four): Use adr instead of
addw.
Index: gcc/config/arm/thumb2.md
===================================================================
--- gcc/config/arm/thumb2.md (revision 115355)
+++ gcc/config/arm/thumb2.md (working copy)
@@ -266,7 +266,11 @@ (define_insn "pic_load_dot_plus_four"
assemble_align(BITS_PER_WORD);
(*targetm.asm_out.internal_label) (asm_out_file, \"LPIC\",
INTVAL (operands[1]));
- return \"addw\\t%0, %|pc, #0\";
+ /* We use adr because some buggy gas assemble add r8, pc, #0
+ to add.w r8, pc, #0, not addw r8, pc, #0. */
+ asm_fprintf (asm_out_file, \"\\tadr\\t%r, %LLPIC%d + 4\\n\",
+ REGNO(operands[0]), (int)INTVAL (operands[1]));
+ return \"\";
"
[(set_attr "length" "6")]
)