cmov in asm()

Richard Henderson rth@redhat.com
Thu May 22 22:28:00 GMT 2003


Try the following.


r~


	* optabs.c (expand_abs_nojump): Split out from ...
	(expand_abs): ... here.
	* optabs.h (expand_abs_nojump): Declare.
	* ifcvt.c (noce_try_abs): Use it.
	* Makefile.in (ifcvt.o): Depend on optabs.h.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1056
diff -c -p -d -r1.1056 Makefile.in
*** Makefile.in	14 May 2003 15:29:07 -0000	1.1056
--- Makefile.in	22 May 2003 22:08:47 -0000
*************** timevar.o : timevar.c $(CONFIG_H) $(SYST
*** 1770,1778 ****
  regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h $(RECOG_H) function.h \
     resource.h $(OBSTACK_H) flags.h $(TM_P_H)
! ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) toplev.h \
!    flags.h insn-config.h function.h $(RECOG_H) $(BASIC_BLOCK_H) $(EXPR_H) \
!    output.h except.h $(TM_P_H) real.h
  params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) toplev.h
  hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H)
  
--- 1770,1778 ----
  regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h $(RECOG_H) function.h \
     resource.h $(OBSTACK_H) flags.h $(TM_P_H)
! ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
!    $(REGS_H) toplev.h flags.h insn-config.h function.h $(RECOG_H) \
!    $(BASIC_BLOCK_H) $(EXPR_H) output.h except.h $(TM_P_H) real.h optabs.h
  params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) toplev.h
  hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H)
  
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.115
diff -c -p -d -r1.115 ifcvt.c
*** ifcvt.c	14 Apr 2003 21:44:36 -0000	1.115
--- ifcvt.c	22 May 2003 22:08:49 -0000
***************
*** 35,40 ****
--- 35,41 ----
  #include "expr.h"
  #include "real.h"
  #include "output.h"
+ #include "optabs.h"
  #include "toplev.h"
  #include "tm_p.h"
  
*************** noce_try_abs (if_info)
*** 1602,1608 ****
  
    start_sequence ();
  
!   target = expand_simple_unop (GET_MODE (if_info->x), ABS, b, if_info->x, 0);
  
    /* ??? It's a quandry whether cmove would be better here, especially
       for integers.  Perhaps combine will clean things up.  */
--- 1603,1609 ----
  
    start_sequence ();
  
!   target = expand_abs_nojump (GET_MODE (if_info->x), b, if_info->x, 1);
  
    /* ??? It's a quandry whether cmove would be better here, especially
       for integers.  Perhaps combine will clean things up.  */
Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.172
diff -c -p -d -r1.172 optabs.c
*** optabs.c	15 Apr 2003 13:06:58 -0000	1.172
--- optabs.c	22 May 2003 22:08:53 -0000
*************** expand_unop (mode, unoptab, op0, target,
*** 2773,2786 ****
   */
  
  rtx
! expand_abs (mode, op0, target, result_unsignedp, safe)
       enum machine_mode mode;
       rtx op0;
       rtx target;
       int result_unsignedp;
-      int safe;
  {
!   rtx temp, op1;
  
    if (! flag_trapv)
      result_unsignedp = 1;
--- 2773,2785 ----
   */
  
  rtx
! expand_abs_nojump (mode, op0, target, result_unsignedp)
       enum machine_mode mode;
       rtx op0;
       rtx target;
       int result_unsignedp;
  {
!   rtx temp;
  
    if (! flag_trapv)
      result_unsignedp = 1;
*************** expand_abs (mode, op0, target, result_un
*** 2867,2872 ****
--- 2866,2888 ----
        if (temp != 0)
  	return temp;
      }
+ 
+   return NULL_RTX;
+ }
+ 
+ rtx
+ expand_abs (mode, op0, target, result_unsignedp, safe)
+      enum machine_mode mode;
+      rtx op0;
+      rtx target;
+      int result_unsignedp;
+      int safe;
+ {
+   rtx temp, op1;
+ 
+   temp = expand_abs_nojump (mode, op0, target, result_unsignedp);
+   if (temp != 0)
+     return temp;
  
    /* If that does not win, use conditional jump and negate.  */
  
Index: optabs.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.h,v
retrieving revision 1.12
diff -c -p -d -r1.12 optabs.h
*** optabs.h	11 Feb 2003 19:34:08 -0000	1.12
--- optabs.h	22 May 2003 22:08:53 -0000
*************** extern int expand_twoval_binop PARAMS ((
*** 306,311 ****
--- 306,312 ----
  extern rtx expand_unop PARAMS ((enum machine_mode, optab, rtx, rtx, int));
  
  /* Expand the absolute value operation.  */
+ extern rtx expand_abs_nojump PARAMS ((enum machine_mode, rtx, rtx, int));
  extern rtx expand_abs PARAMS ((enum machine_mode, rtx, rtx, int, int));
  
  /* Expand the complex absolute value operation.  */



More information about the Gcc mailing list