On Sun, Dec 30, 2012 at 8:08 PM, Uros Bizjak <ubiz...@gmail.com> wrote: > 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 depends on the definition of >>> __PIC__, we unnecessary preserve %rbx also for -mcmodel=small. >> >> Certainly we can. We also control the preprocessor defines. >> All that's needed is that we create one for the code model. > > Something like attached? > > I have also included all suggestions (earlyclobber and operand prefix > on temporary register). > > 2012-12-30 Uros Bizjak <ubiz...@gmail.com> > > PR target/55712 > * config/i386/i386-c.c (ix86_target_macros_internal): Depending on > selected code model, define __code_mode_small__, > __code_model_medium__, > __code_model_large__, __code_model_32__ or __code_model_kernel__. > * config/i386/cpuid.h (__cpuid, __cpuid_count) [__i386__]: Prefix > xchg temporary register with %k. Declare temporary register as > early clobbered. > [__x86_64__]: For medium and large code models, preserve %rbx > register. > > Tested on x86_64-pc-linux-gnu {,-m32}.
I have committed the patch to mainline SVN. The patch will be backported to 4.7 branch after a couple of days. Uros.