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]

flow patch for condexec


hi folks.

We are working on a target whose conditional execution condition codes
are not reversible, so flow is getting confused in ior_reg_cond()
because sometimes "X == reverse_condition (Y)" is true erroneously.

For example:

(condexec (eq CC99 0) blah)
(condexec (ne CC99 0) blah)

In this particular target, both insns can fail to execute because CC99
can have an undefined value.  Currently, flow does not know about this, and
may wrongly kill a register.

The patch below introduces a new target macro that fixes the problem.

I've been talking to rth about this for a few days now.

ok to install?

I assume this shouldn't go into the gcc3 branch even though it fixes a
problem-- since I doubt there are currently any other targets that 
have this type of condition codes for the condexec stuff.

aldy

2001-02-20  Aldy Hernandez  <aldyh@redhat.com>

        * tm.texi (REVERSE_CONDEXEC_PREDICATES_P): new macro documentation.

        * flow.c (ior_reg_cond): use REVERSE_CONDEXEC_PREDICATES_P macro.
        (REVERSE_CONDEXEC_PREDICATES_P): define macro.
        
Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.374
diff -c -p -r1.374 flow.c
*** flow.c	2001/02/04 22:43:59	1.374
--- flow.c	2001/02/21 04:31:16
*************** Boston, MA 02111-1307, USA.  */
*** 168,173 ****
--- 168,179 ----
  #define EPILOGUE_USES(REGNO)  0
  #endif
  
+ #ifdef HAVE_conditional_execution
+ #ifndef REVERSE_CONDEXEC_PREDICATES_P
+ #define REVERSE_CONDEXEC_PREDICATES_P(x, y) ((x) == reverse_condition (y))
+ #endif
+ #endif
+ 
  /* The obstack on which the flow graph components are allocated.  */
  
  struct obstack flow_obstack;
*************** ior_reg_cond (old, x, add)
*** 5124,5130 ****
    if (GET_RTX_CLASS (GET_CODE (old)) == '<')
      {
        if (GET_RTX_CLASS (GET_CODE (x)) == '<'
! 	  && GET_CODE (x) == reverse_condition (GET_CODE (old))
  	  && REGNO (XEXP (x, 0)) == REGNO (XEXP (old, 0)))
  	return const1_rtx;
        if (GET_CODE (x) == GET_CODE (old)
--- 5130,5136 ----
    if (GET_RTX_CLASS (GET_CODE (old)) == '<')
      {
        if (GET_RTX_CLASS (GET_CODE (x)) == '<'
! 	  && REVERSE_CONDEXEC_PREDICATES_P (GET_CODE (x), GET_CODE (old))
  	  && REGNO (XEXP (x, 0)) == REGNO (XEXP (old, 0)))
  	return const1_rtx;
        if (GET_CODE (x) == GET_CODE (old)
Index: tm.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tm.texi,v
retrieving revision 1.171
diff -c -p -r1.171 tm.texi
*** tm.texi	2001/02/07 18:58:05	1.171
--- tm.texi	2001/02/21 04:32:04
*************** like:
*** 4880,4885 ****
--- 4880,4896 ----
      : reverse_condition_maybe_unordered (CODE))
  @end smallexample
  
+ @findex REVERSE_CONDEXEC_PREDICATES_P
+ @item REVERSE_CONDEXEC_PREDICATES_P (@var{code1}, @var{code2})
+ A C expression that returns true if the conditional execution predicate
+ @var{code1} is the inverse of @var{code2} and vice versa.  Define this to
+ return 0 if the target has conditional execution predicates that cannot be
+ reversed safely.  If none, is specified this macro expands to:
+ 
+ @smallexample
+ #define REVERSE_CONDEXEC_PREDICATES_P (x, y) ((x) == reverse_condition (y))
+ @end smallexample
+ 
  @end table
  
  @node Costs


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