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]

Re: x86_64 gen_align fix


> We could fall through without returning anything.  Probably
> only shows up for real with cross compilers, since no real
> version of the x86_64 assembler doesn't support max skip.
> 
> 
> --- 14279,14298 ----
>      (set_attr "modrm" "0")
>      (set_attr "ppro_uops" "one")])
>   
> ! ;; Align to 16-byte boundary, max skip in op0.  Used to avoid
> ! ;; branch prediction penalty for the third jump in a 16-byte
> ! ;; block on K8.
>   
>   (define_insn "align"
>     [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_ALIGN)]
>     ""
>   {
> ! #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
> !   ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file, 4, INTVAL (operands[0]));
> ! #else
> !   ASM_OUTPUT_ALIGN (asm_out_file, 4);
>   #endif
> +   return "";

Uhm, this is actually wrong.  We don't want to output normal alignment
as it is too costy for this minor optimization.  You also introduced an
warning when P2align is available.  I am testing the attached patch
to fix that.

Thu Jun  5 11:32:26 CEST 2003  Jan Hubicka  <jh@suse.cz>

	* i386.md (align): Fix warning; clarify what to do when no p2align
	is available.

Index: i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.465
diff -c -3 -p -r1.465 i386.md
*** i386.md	5 Jun 2003 00:23:21 -0000	1.465
--- i386.md	5 Jun 2003 09:32:10 -0000
***************
*** 14289,14297 ****
    ""
  {
  #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
!   ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file, 4, INTVAL (operands[0]));
  #else
!   ASM_OUTPUT_ALIGN (asm_out_file, 4);
  #endif
    return "";
  }
--- 14289,14300 ----
    ""
  {
  #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
!   ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file, 4, (int)INTVAL (operands[0]));
  #else
!   /* It is tempting to use ASM_OUTPUT_ALIGN here, but we don't want to do that.
!      The align insn is used to avoid 3 jump instructions in the row to improve
!      branch prediction and the benefits hardly outweight the cost of extra 8
!      nops on the average inserted by full alignment pseudo operation.  */
  #endif
    return "";
  }


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