Gcc 3.1 performance regressions with respect to 2.95.3

David Edelsohn dje@watson.ibm.com
Tue Apr 23 13:30:00 GMT 2002


	What a surprise!  Someone open-coded a no-conflict block in
optabs.c:expand_binop() with a bare CLOBBER as icing on the cake!

David

	* optabs.c (expand_binop): Use sequence and emit_no_conflict_block
	instead of open-coding.

Index: optabs.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/optabs.c,v
retrieving revision 1.129
diff -c -p -r1.129 optabs.c
*** optabs.c	31 Mar 2002 09:52:35 -0000	1.129
--- optabs.c	23 Apr 2002 20:19:16 -0000
*************** expand_binop (mode, binoptab, op0, op1, 
*** 1192,1200 ****
      {
        int i;
        optab otheroptab = binoptab == add_optab ? sub_optab : add_optab;
!       unsigned int nwords = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
        rtx carry_in = NULL_RTX, carry_out = NULL_RTX;
!       rtx xop0, xop1;
  
        /* We can handle either a 1 or -1 value for the carry.  If STORE_FLAG
  	 value is one of those, use it.  Otherwise, use 1 since it is the
--- 1192,1200 ----
      {
        int i;
        optab otheroptab = binoptab == add_optab ? sub_optab : add_optab;
!       int nwords = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
        rtx carry_in = NULL_RTX, carry_out = NULL_RTX;
!       rtx xop0, xop1, insns, equiv_value;
  
        /* We can handle either a 1 or -1 value for the carry.  If STORE_FLAG
  	 value is one of those, use it.  Otherwise, use 1 since it is the
*************** expand_binop (mode, binoptab, op0, op1, 
*** 1213,1221 ****
  	  || target == xop0 || target == xop1)
  	target = gen_reg_rtx (mode);
  
!       /* Indicate for flow that the entire target reg is being set.  */
!       if (GET_CODE (target) == REG)
! 	emit_insn (gen_rtx_CLOBBER (VOIDmode, target));
  
        /* Do the actual arithmetic.  */
        for (i = 0; i < nwords; i++)
--- 1213,1219 ----
  	  || target == xop0 || target == xop1)
  	target = gen_reg_rtx (mode);
  
!       start_sequence ();
  
        /* Do the actual arithmetic.  */
        for (i = 0; i < nwords; i++)
*************** expand_binop (mode, binoptab, op0, op1, 
*** 1275,1300 ****
  	    }
  
  	  carry_in = carry_out;
! 	}	
  
        if (i == GET_MODE_BITSIZE (mode) / BITS_PER_WORD)
  	{
! 	  if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
! 	    {
! 	      rtx temp = emit_move_insn (target, target);
! 
! 	      set_unique_reg_note (temp,
! 	      			   REG_EQUAL,
! 				   gen_rtx_fmt_ee (binoptab->code, mode,
! 						   copy_rtx (xop0),
! 						   copy_rtx (xop1)));
! 	    }
  
  	  return target;
  	}
- 
-       else
- 	delete_insns_since (last);
      }
  
    /* If we want to multiply two two-word values and have normal and widening
--- 1273,1295 ----
  	    }
  
  	  carry_in = carry_out;
! 	}
! 
!       insns = get_insns ();
!       end_sequence ();
  
        if (i == GET_MODE_BITSIZE (mode) / BITS_PER_WORD)
  	{
! 	  if (binoptab->code != UNKNOWN)
! 	    equiv_value
! 	      = gen_rtx_fmt_ee (binoptab->code, mode,
! 				copy_rtx (op0), copy_rtx (op1));
! 	  else
! 	    equiv_value = 0;
  
+ 	  emit_no_conflict_block (insns, target, op0, op1, equiv_value);
  	  return target;
  	}
      }
  
    /* If we want to multiply two two-word values and have normal and widening



More information about the Gcc-patches mailing list