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]

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


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.

Probably, we can also enhance ix86_select_alt_pic_regnum for x86_64,
but this is 4.9 material.

2012-12-24  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.md (R14_REG, R15_REG): New constants.
	* config/i386/i386.h (REAL_PIC_OFFSET_TABLE_REGNUM): Use R15_REG
	for 64bit targets.

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55712

Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Uros.

Attachment: p.diff.txt
Description: Text document


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