[RFC PATCH, i386]: Use %r15 for REAL_PIC_OFFSET_TABLE_REGNUM on x86_64

Andi Kleen andi@firstfloor.org
Mon Dec 24 21:32:00 GMT 2012


Uros Bizjak <ubizjak@gmail.com> writes:

> Hello!
>
> Currently, we use %rbx as REAL_PIC_OFFSET_TABLE_REGNUM on x86_64.
> Since this register gets marked as fixed reg in
> ix86_conditional_register_usage, we get into troubles with insns that
> use %rbx (cmpxchg, cpuid). According to x86_64 psABI, we are free to
> use any register, so attached patch changes %rbx with %r15 (also
> following the example in the psABI). This patch has no implications on
> small code model (that doesn't use REAL_PIC_OFFSET_TABLE_REGNUM
> anyway), but on medium and large code model fixes usage of cpuid.h
> (please see PR 55712 [1]) and avoids a pair of xchgs around cmpxchg or
> cpuid instructions.

So everyone who worked around this and use r15 now broke.

It would be probably better to just teach the register allocator
to spill those registers as needed, to handle some asm() statement.
Not sure how hard that would be.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only



More information about the Gcc-patches mailing list