Is the new jump processing really better?

Richard Henderson rth@cygnus.com
Thu May 18 14:51:00 GMT 2000


On Thu, May 18, 2000 at 01:19:32AM -0500, Brad Lucier wrote:
> There have been many recent changes to the code to handle jumps,
> but I'm wondering if it's all for the better.
[...]
> Notice that there's only one executed jump at the end of each arm
> of the simulated if, to the test at the top of the loop.

Notice that this is caused not by new code, but by old code
that I've been meaning to tweek for ages.

We now get

        .prologue 1
        blt $17,$L4
        s8addq $17,0,$2
$L5:
        addq $2,$16,$1
        ldt $f12,0($1)
        cmptlesu $f12,$f31,$f10
        fbeq $f10,$L20
        cmptltsu $f12,$f31,$f10
        lda $4,$LC1
        lda $3,$LC0
        fbeq $f10,$L21
$L13:
        ldt $f11,0($4)
        subl $17,1,$17
        s8addq $17,0,$2
        multsu $f12,$f11,$f10
        stt $f10,0($1)
        bge $17,$L5
$L4:
        ret $31,($26),1
        .align 4
$L21:
        ldt $f10,0($3)
        stt $f10,0($1)
        bge $17,$L5
        ret $31,($26),1
        .align 4
$L20:
        addtsu $f12,$f12,$f10
        subl $17,1,$17
        s8addq $17,0,$2
        stt $f10,0($1)
        bge $17,$L5
        ret $31,($26),1


r~


        * jump.c (jump_optimize_1): Base minimum insn count during
        find_cross_jump on BRANCH_COST.

Index: jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.125
diff -c -p -d -r1.125 jump.c
*** jump.c	2000/05/17 21:02:22	1.125
--- jump.c	2000/05/18 21:41:35
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 612,618 ****
  		  /* TARGET is nonzero if it is ok to cross jump
  		     to code before TARGET.  If so, see if matches.  */
  		  if (x != 0)
! 		    find_cross_jump (insn, x, 2,
  				     &newjpos, &newlpos);
  
  		  if (newjpos != 0)
--- 612,619 ----
  		  /* TARGET is nonzero if it is ok to cross jump
  		     to code before TARGET.  If so, see if matches.  */
  		  if (x != 0)
! 		    find_cross_jump (insn, x,
! 				     (optimize_size ? 1 : BRANCH_COST) + 1,
  				     &newjpos, &newlpos);
  
  		  if (newjpos != 0)
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 649,655 ****
  
  		  /* TARGET is nonzero if it is ok to cross jump
  		     to code before TARGET.  If so, see if matches.  */
! 		  find_cross_jump (insn, JUMP_LABEL (insn), 1,
  				   &newjpos, &newlpos);
  
  		  /* If cannot cross jump to code before the label,
--- 650,657 ----
  
  		  /* TARGET is nonzero if it is ok to cross jump
  		     to code before TARGET.  If so, see if matches.  */
! 		  find_cross_jump (insn, JUMP_LABEL (insn),
! 				   optimize_size ? 1 : BRANCH_COST,
  				   &newjpos, &newlpos);
  
  		  /* If cannot cross jump to code before the label,
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 664,670 ****
  			  && JUMP_LABEL (target) == JUMP_LABEL (insn)
  			  /* Ignore TARGET if it's deleted.  */
  			  && ! INSN_DELETED_P (target))
! 			find_cross_jump (insn, target, 2,
  					 &newjpos, &newlpos);
  
  		  if (newjpos != 0)
--- 666,673 ----
  			  && JUMP_LABEL (target) == JUMP_LABEL (insn)
  			  /* Ignore TARGET if it's deleted.  */
  			  && ! INSN_DELETED_P (target))
! 			find_cross_jump (insn, target,
! 					 (optimize_size ? 1 : BRANCH_COST) + 1,
  					 &newjpos, &newlpos);
  
  		  if (newjpos != 0)
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 695,701 ****
  		    if (target != insn
  			&& ! INSN_DELETED_P (target)
  			&& GET_CODE (PATTERN (target)) == RETURN)
! 		      find_cross_jump (insn, target, 2,
  				       &newjpos, &newlpos);
  
  		  if (newjpos != 0)
--- 698,705 ----
  		    if (target != insn
  			&& ! INSN_DELETED_P (target)
  			&& GET_CODE (PATTERN (target)) == RETURN)
! 		      find_cross_jump (insn, target,
! 				       (optimize_size ? 1 : BRANCH_COST) + 1,
  				       &newjpos, &newlpos);
  
  		  if (newjpos != 0)


More information about the Gcc-patches mailing list