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]

Re: [RFC PATCH, i386]: Prefer %ebx in set_got patterns


On Thu, Nov 27, 2014 at 3:19 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> Attached patch helps RA to choose the most appropriate PIC register by
> changing the register preference for set_got patterns. Using this
> patch, there should really be a reason for RA to avoid ABI mandated
> hard PIC reg.
>
> This patch avoids many mov %exx,%ebx in front of the calls, that
> happen with unpatched compiler even with Vladimir's latest RA patch to
> avoid duplicated PIC registers.
>
> As a smoke test, I have checked 32bit libgo.so.6.0.0 library, where now we have:
>
> [uros@omen7 .libs]$ grep thunk.bx aaa | wc -l
> 7693
> [uros@omen7 .libs]$ grep thunk.ax aaa | wc -l
> 10
> [uros@omen7 .libs]$ grep thunk.cx aaa | wc -l
> 4
> [uros@omen7 .libs]$ grep thunk.dx aaa | wc -l
> 8
> [uros@omen7 .libs]$ grep thunk.bp aaa | wc -l
> 497
> [uros@omen7 .libs]$ grep thunk.si aaa | wc -l
> 145
> [uros@omen7 .libs]$ grep thunk.di aaa | wc -l
> 198
>
> 2014-11-27  Uros Bizjak  <ubizjak@gmail.com>
>
>     * config/i386/i386.md (set_got): Use "=b,?r" constraint for operand 0.

EBX is needed only if PLT is used.  If PLT isn't used, we should try
caller saved registers first.

>     (set_got_labelled): Ditto.
>     (set_got_rex64): Ditto.
>     (set_rip_rex64): Ditto.
>     (set_got_offset_rex64): Ditto.

We shouldn't do it for 64-bit.

> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
>
> Thoughts?
>
> Uros



-- 
H.J.


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