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

2013-01-04 Thread Jakub Jelinek
On Fri, Jan 04, 2013 at 10:39:05PM +0100, Leif Ekblad wrote: I just tried the patch, but it seems to produce some problems for me. The other patch which used a 64-bit specific register (r15) instead of rbx was easier to adapt to. The problem for me is that syscalls might clobber higher-half of

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

2013-01-04 Thread Leif Ekblad
hjl.to...@gmail.com Sent: Friday, January 04, 2013 10:42 PM Subject: Re: [RFC PATCH, i386]: Use %r15 for REAL_PIC_OFFSET_TABLE_REGNUM on x86_64 On Fri, Jan 04, 2013 at 10:39:05PM +0100, Leif Ekblad wrote: I just tried the patch, but it seems to produce some problems for me. The other patch which

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

2012-12-30 Thread Uros Bizjak
On Fri, Dec 28, 2012 at 9:27 PM, Richard Henderson r...@redhat.com wrote: On 12/27/2012 12:08 AM, Uros Bizjak wrote: The alternative approach is changing cpuid definition in cpuid.h (as in attached patch) to preserve %rbx, but we can't detect various code model settings there. Since the change

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

2012-12-28 Thread Richard Henderson
On 12/27/2012 12:08 AM, Uros Bizjak wrote: The alternative approach is changing cpuid definition in cpuid.h (as in attached patch) to preserve %rbx, but we can't detect various code model settings there. Since the change depends on the definition of __PIC__, we unnecessary preserve %rbx also

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

2012-12-27 Thread Uros Bizjak
On Wed, Dec 26, 2012 at 9:16 PM, Andi Kleen a...@firstfloor.org wrote: Can you please post a real-world example, where using %r15 would break existing code? I used to run into problems like this when porting code to gcc from icc or VC. A lot of hyper optimized inline assembler snippets wants

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

2012-12-27 Thread Uros Bizjak
On Thu, Dec 27, 2012 at 9:08 AM, Uros Bizjak ubiz...@gmail.com wrote: On Wed, Dec 26, 2012 at 9:16 PM, Andi Kleen a...@firstfloor.org wrote: Can you please post a real-world example, where using %r15 would break existing code? I used to run into problems like this when porting code to gcc

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

2012-12-27 Thread Florian Weimer
* Uros Bizjak: +#elif defined(__x86_64__) +#define __cpuid(level, a, b, c, d) \ + __asm__ (xchg{q}\t{%%}rbx, %q1\n\t \ +cpuid\n\t \ +xchg{q}\t{%%}rbx, %q1\n\t \ +: =a (a), =r

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

2012-12-27 Thread Uros Bizjak
On Thu, Dec 27, 2012 at 10:10 AM, Florian Weimer f...@deneb.enyo.de wrote: * Uros Bizjak: +#elif defined(__x86_64__) +#define __cpuid(level, a, b, c, d) \ + __asm__ (xchg{q}\t{%%}rbx, %q1\n\t \ +cpuid\n\t \ +

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

2012-12-26 Thread Uros Bizjak
On Tue, Dec 25, 2012 at 8:27 PM, Mike Frysinger vap...@gentoo.org wrote: In the case of cpuid, the code is hardly performance sensitive, and probably runs only at startup. An alternative solution for the broken code here is to move the result from rbx to another register, and to

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

2012-12-26 Thread Andi Kleen
Can you please post a real-world example, where using %r15 would break existing code? I used to run into problems like this when porting code to gcc from icc or VC. A lot of hyper optimized inline assembler snippets wants to use all registers and icc/VC support that. With gcc usually had to add

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

2012-12-25 Thread Uros Bizjak
On Tue, Dec 25, 2012 at 6:54 AM, Mike Frysinger vap...@gentoo.org wrote: On Monday 24 December 2012 17:26:47 Leif Ekblad wrote: In the case of cpuid, the code is hardly performance sensitive, and probably runs only at startup. An alternative solution for the broken code here is to move the

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

2012-12-25 Thread Mike Frysinger
On Tuesday 25 December 2012 14:12:09 Uros Bizjak wrote: On Tue, Dec 25, 2012 at 6:54 AM, Mike Frysinger vap...@gentoo.org wrote: On Monday 24 December 2012 17:26:47 Leif Ekblad wrote: In the case of cpuid, the code is hardly performance sensitive, and probably runs only at startup. An

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

2012-12-24 Thread Uros Bizjak
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

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

2012-12-24 Thread Andi Kleen
Uros Bizjak ubiz...@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

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

2012-12-24 Thread Leif Ekblad
10:32 PM Subject: Re: [RFC PATCH, i386]: Use %r15 for REAL_PIC_OFFSET_TABLE_REGNUM on x86_64 Uros Bizjak ubiz...@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

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

2012-12-24 Thread Mike Frysinger
On Monday 24 December 2012 17:26:47 Leif Ekblad wrote: In the case of cpuid, the code is hardly performance sensitive, and probably runs only at startup. An alternative solution for the broken code here is to move the result from rbx to another register, and to save/restore rbx. Currently,