PATCH: Pad short functions for Atom
H.J. Lu
hjl.tools@gmail.com
Fri Sep 17 08:48:00 GMT 2010
On Thu, Sep 16, 2010 at 2:05 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Sep 16, 2010 at 01:55:24PM -0700, H.J. Lu wrote:
>> @@ -8024,6 +8027,11 @@ ix86_code_end (void)
>>
>> xops[0] = gen_rtx_REG (Pmode, regno);
>> xops[1] = gen_rtx_MEM (Pmode, stack_pointer_rtx);
>> + /* Pad stack IP move with 4 instructions. 2 NOPs count as 1
>> + instruction. */
>> + if (TARGET_PAD_SHORT_FUNCTION)
>> + output_asm_insn ("nop; nop; nop; nop; nop; nop; nop; nop",
>> + xops);
>> output_asm_insn ("mov%z0\t{%1, %0|%0, %1}", xops);
>> output_asm_insn ("ret", xops);
>> final_end_function ();
>
> Doesn't the movl %esp, %ebx before ret count as one (or half) insn,
> thus wouldn't it be enough to have just 6 or 7 nops instead of 8?
>
It is
__i686.get_pc_thunk.bx:
movl (%esp), %ebx <<=== Take return address
ret
Return address won't be ready in 4 cycles.
--
H.J.
More information about the Gcc-patches
mailing list