PATCH [5/n] X32: Fix x32 trampoline

Richard Henderson rth@redhat.com
Sat Jul 9 22:59:00 GMT 2011


On 07/09/2011 02:41 PM, H.J. Lu wrote:
> Hi,
> 
> X32 uses movl instead of movabs for trampoline.  OK for trunk?
> 
> Thanks.
> 
> H.J.
> ---
> 2011-07-09  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* config/i386/i386.c (ix86_trampoline_init): Use movl instead
> 	of movabs for x32.
> 
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 04cb07d..c852719 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -22721,13 +23030,14 @@ ix86_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
>      }
>    else
>      {
> -      int offset = 0;
> +      int offset = 0, size;
>  
>        /* Load the function address to r11.  Try to load address using
>  	 the shorter movl instead of movabs.  We may want to support
>  	 movq for kernel mode, but kernel does not use trampolines at
>  	 the moment.  */
> -      if (x86_64_zext_immediate_operand (fnaddr, VOIDmode))
> +      if (TARGET_X32
> +	  || x86_64_zext_immediate_operand (fnaddr, VOIDmode))

Is this change actually necessary?  I would think that the 
predicate has already been adjusted...

> -      emit_move_insn (mem, gen_int_mode (0xba49, HImode));
> +      /* Use the shorter movl instead of movabs for x32.  */
> +      if (TARGET_X32)
> +	{
> +	  size = 6;
> +	  emit_move_insn (mem, gen_int_mode (0xba41, HImode));

Have I forgotten x86 encoding?  I thought movl imm,reg was 5 bytes...


r~



More information about the Gcc-patches mailing list