Fix for conditional execution (armlinux bootstrap problems)

Jan Hubicka jh@suse.cz
Tue Mar 13 02:00:00 GMT 2001


Hi
This patch attempts to fix the latent problem in ifcvt.c - on the ARM Linux
the conditional execution may be based on floating point conditions - then
our reversing code is wrong, as can be shown on any conditional execution
based on unordered compare builtin (or with my recently reversed patch :( )
in the armlinux bootstrap.

This patch don't fix the whole problem - once conditional execution is
constructed, still it is misshandled by flow.c that attempts to do the
reversals as well. Richard: How to proceed?

OK for head/branch?

Honza

Tue Mar 13 10:57:02 CET 2001  Jan Hubicka  <jh@suse.cz>
	ifcvt.c (cond_exec_get_condition): Use reversed_comparison_code.
	(cond_exec_process_if_block): Likewise.
	(dead_or_predicable): Likewise.
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ifcvt.c,v
retrieving revision 1.42
diff -c -3 -p -r1.42 ifcvt.c
*** ifcvt.c	2001/03/07 19:29:36	1.42
--- ifcvt.c	2001/03/13 09:56:50
*************** cond_exec_get_condition (jump)
*** 286,294 ****
       reverse the condition.  */
    if (GET_CODE (XEXP (test_if, 2)) == LABEL_REF
        && XEXP (XEXP (test_if, 2), 0) == JUMP_LABEL (jump))
!     cond = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond)),
! 			   GET_MODE (cond), XEXP (cond, 0),
! 			   XEXP (cond, 1));
  
    return cond;
  }
--- 286,299 ----
       reverse the condition.  */
    if (GET_CODE (XEXP (test_if, 2)) == LABEL_REF
        && XEXP (XEXP (test_if, 2), 0) == JUMP_LABEL (jump))
!     {
!       enum rtx_code reversed = reversed_comparison_code (cond, jump);
!       if (reversed == UNKNOWN)
! 	return NULL_RTX;
!       cond = gen_rtx_fmt_ee (reversed,
! 			     GET_MODE (cond), XEXP (cond, 0),
! 			     XEXP (cond, 1));
!     }
  
    return cond;
  }
*************** cond_exec_process_if_block (test_bb, the
*** 316,321 ****
--- 321,327 ----
    rtx true_prob_val;		/* probability of else block */
    rtx false_prob_val;		/* probability of then block */
    int n_insns;
+   enum rtx_code reversed_code;
  
    /* Find the conditional jump to the ELSE or JOIN part, and isolate
       the test.  */
*************** cond_exec_process_if_block (test_bb, the
*** 377,383 ****
       the conditionally executed code.  */
    
    true_expr = test_expr;
!   false_expr = gen_rtx_fmt_ee (reverse_condition (GET_CODE (true_expr)),
  			       GET_MODE (true_expr), XEXP (true_expr, 0),
  			       XEXP (true_expr, 1));
  
--- 383,392 ----
       the conditionally executed code.  */
    
    true_expr = test_expr;
!   reversed_code = reversed_comparison_code (true_expr, test_bb->end);
!   if (reversed_code == UNKNOWN)
!     return FALSE;
!   false_expr = gen_rtx_fmt_ee (reversed_code,
  			       GET_MODE (true_expr), XEXP (true_expr, 0),
  			       XEXP (true_expr, 1));
  
*************** dead_or_predicable (test_bb, merge_bb, o
*** 2238,2244 ****
  
        if (reversep)
  	{
! 	  cond = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond)),
  			         GET_MODE (cond), XEXP (cond, 0),
  			         XEXP (cond, 1));
  	  if (prob_val)
--- 2247,2256 ----
  
        if (reversep)
  	{
! 	  enum rtx_code reversed_code = reversed_comparison_code (cond, jump);
! 	  if (reversed_code == UNKNOWN)
! 	    goto cancel;
! 	  cond = gen_rtx_fmt_ee (reversed_code,
  			         GET_MODE (cond), XEXP (cond, 0),
  			         XEXP (cond, 1));
  	  if (prob_val)



More information about the Gcc-patches mailing list