1 --- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm 2004-02-27 09:51:05.000000000 -0500
2 +++ gcc-3.4.0/gcc/config/arm/arm.c 2004-04-24 18:16:25.000000000 -0400
4 return_used_this_function = 0;
7 +/* Return the number (counting from 0) of
8 + the least significant set bit in MASK. */
14 +number_of_first_bit_set (mask)
20 + (mask & (1 << bit)) == 0;
28 arm_output_epilogue (rtx sibling)
30 @@ -8753,27 +8773,47 @@
31 saved_regs_mask |= (1 << PC_REGNUM);
34 - /* Load the registers off the stack. If we only have one register
35 - to load use the LDR instruction - it is faster. */
36 - if (saved_regs_mask == (1 << LR_REGNUM))
38 - /* The exception handler ignores the LR, so we do
39 - not really need to load it off the stack. */
41 - asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM);
43 - asm_fprintf (f, "\tldr\t%r, [%r], #4\n", LR_REGNUM, SP_REGNUM);
45 - else if (saved_regs_mask)
46 + if (saved_regs_mask)
48 - if (saved_regs_mask & (1 << SP_REGNUM))
49 - /* Note - write back to the stack register is not enabled
50 - (ie "ldmfd sp!..."). We know that the stack pointer is
51 - in the list of registers and if we add writeback the
52 - instruction becomes UNPREDICTABLE. */
53 - print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask);
54 + /* Load the registers off the stack. If we only have one register
55 + to load use the LDR instruction - it is faster. */
56 + if (bit_count (saved_regs_mask) == 1)
58 + int reg = number_of_first_bit_set (saved_regs_mask);
63 + /* Mustn't use base writeback when loading SP. */
64 + asm_fprintf (f, "\tldr\t%r, [%r]\n", SP_REGNUM, SP_REGNUM);
70 + /* The exception handler ignores the LR, so we do
71 + not really need to load it off the stack. */
72 + asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM);
75 + /* else fall through */
78 + asm_fprintf (f, "\tldr\t%r, [%r], #4\n", reg, SP_REGNUM);
83 - print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask);
85 + if (saved_regs_mask & (1 << SP_REGNUM))
86 + /* Note - write back to the stack register is not enabled
87 + (ie "ldmfd sp!..."). We know that the stack pointer is
88 + in the list of registers and if we add writeback the
89 + instruction becomes UNPREDICTABLE. */
90 + print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask);
92 + print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask);
96 if (current_function_pretend_args_size)
97 @@ -11401,22 +11441,6 @@
101 -/* Return the number (counting from 0) of
102 - the least significant set bit in MASK. */
105 -number_of_first_bit_set (int mask)
110 - (mask & (1 << bit)) == 0;
117 /* Generate code to return from a thumb function.
118 If 'reg_containing_return_addr' is -1, then the return address is
119 actually on the stack, at the stack pointer. */