This is the mail archive of the gcc@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]

x86_64 merger part 13 - accept *_MODIFY in '<' and '>' constraints


Hi,
This patch makes '<' and '>' constraints to accept autoincrementation
constructed using pre_modify/post_modify operands.
This is needed to allow using of '<' constraints for new push insns.

Mon Mar 12 16:48:52 CET 2001  Jan Hubicka  <jh@suse.cz>

	* recog.c (auto_dec_op_p, auto_inc_op_p): New functions.
	(asm_operand_ok): Use them.
	(constrain_operands): Likewise.
	* regclass.c (record_reg_classes): Likewise.
	* reload.c (find_reloads): Likewise.
	* recog.h (auto_dec_op_p, auto_inc_op_p): Declare.

Index: recog.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/recog.c,v
retrieving revision 1.90
diff -c -3 -p -r1.90 recog.c
*** recog.c	2001/02/18 23:56:34	1.90
--- recog.c	2001/03/12 15:45:36
*************** decode_asm_operands (body, operands, ope
*** 1707,1712 ****
--- 1707,1757 ----
    return template;
  }
  
+ /* Return nonzero, if OP match the '<' constraint.  */
+ int
+ auto_dec_op_p (op)
+      rtx op;
+ {
+   if (GET_CODE (op) != MEM)
+     return 0;
+   op = XEXP (op, 0);
+   if (GET_CODE (op) == PRE_DEC || GET_CODE (op) == POST_DEC)
+     return 1;
+   /* We are looking for pattern (*_modify (x) (plus (x) (const_int -y))) */
+   if (op != PRE_MODIFY && op != POST_MODIFY)
+     return 0;
+   if (XEXP (op, 1) != PLUS)
+     return 0;
+   if (!rtx_equal_p (XEXP (op, 0), XEXP (XEXP (op, 1), 0)))
+     return 0;
+   op = XEXP (XEXP (op, 1), 1);
+   if (GET_CODE (op) != CONST_INT || INTVAL (op) >= 0)
+     return 0;
+   return 1;
+ }
+ /* Return nonzero, if OP match the '>' constraint.  */
+ int
+ auto_inc_op_p (op)
+      rtx op;
+ {
+   if (GET_CODE (op) != MEM)
+     return 0;
+   op = XEXP (op, 0);
+   if (GET_CODE (op) == PRE_INC || GET_CODE (op) == POST_INC)
+     return 1;
+   /* We are looking for pattern (*_modify (x) (plus (x) (const_int -y))) */
+   if (op != PRE_MODIFY && op != POST_MODIFY)
+     return 0;
+   if (XEXP (op, 1) != PLUS)
+     return 0;
+   if (!rtx_equal_p (XEXP (op, 0), XEXP (XEXP (op, 1), 0)))
+     return 0;
+   op = XEXP (XEXP (op, 1), 1);
+   if (GET_CODE (op) != CONST_INT || INTVAL (op) <= 0)
+     return 0;
+   return 1;
+ }
+ 
  /* Check if an asm_operand matches it's constraints. 
     Return > 0 if ok, = 0 if bad, < 0 if inconclusive.  */
  
*************** asm_operand_ok (op, constraint)
*** 1770,1787 ****
  
  	     Match any memory and hope things are resolved after reload.  */
  
! 	  if (GET_CODE (op) == MEM
! 	      && (1
! 		  || GET_CODE (XEXP (op, 0)) == PRE_DEC
!                   || GET_CODE (XEXP (op, 0)) == POST_DEC))
  	    return 1;
  	  break;
  
  	case '>':
! 	  if (GET_CODE (op) == MEM
! 	      && (1
! 		  || GET_CODE (XEXP (op, 0)) == PRE_INC
!                   || GET_CODE (XEXP (op, 0)) == POST_INC))
  	    return 1;
  	  break;
  
--- 1815,1826 ----
  
  	     Match any memory and hope things are resolved after reload.  */
  
! 	  if (auto_dec_op_p (op))
  	    return 1;
  	  break;
  
  	case '>':
! 	  if (auto_inc_op_p (op))
  	    return 1;
  	  break;
  
*************** constrain_operands (strict)
*** 2574,2589 ****
  		break;
  
  	      case '<':
! 		if (GET_CODE (op) == MEM
! 		    && (GET_CODE (XEXP (op, 0)) == PRE_DEC
! 			|| GET_CODE (XEXP (op, 0)) == POST_DEC))
  		  win = 1;
  		break;
  
  	      case '>':
! 		if (GET_CODE (op) == MEM
! 		    && (GET_CODE (XEXP (op, 0)) == PRE_INC
! 			|| GET_CODE (XEXP (op, 0)) == POST_INC))
  		  win = 1;
  		break;
  
--- 2613,2624 ----
  		break;
  
  	      case '<':
! 		if (auto_dec_op_p (op))
  		  win = 1;
  		break;
  
  	      case '>':
! 		if (auto_inc_op_p (op))
  		  win = 1;
  		break;
  
Index: recog.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/recog.h,v
retrieving revision 1.38
diff -c -3 -p -r1.38 recog.h
*** recog.h	2001/02/18 23:56:34	1.38
--- recog.h	2001/03/12 15:45:36
*************** extern int offsettable_memref_p		PARAMS 
*** 117,122 ****
--- 117,124 ----
  extern int offsettable_nonstrict_memref_p	PARAMS ((rtx));
  extern int offsettable_address_p	PARAMS ((int, enum machine_mode, rtx));
  extern int mode_dependent_address_p	PARAMS ((rtx));
+ extern int auto_inc_op_p		PARAMS ((rtx));
+ extern int auto_dec_op_p		PARAMS ((rtx));
  
  extern int recog			PARAMS ((rtx, rtx, int *));
  extern void add_clobbers		PARAMS ((rtx, int));
Index: regclass.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/regclass.c,v
retrieving revision 1.117
diff -c -3 -p -r1.117 regclass.c
*** regclass.c	2001/03/02 21:41:36	1.117
--- regclass.c	2001/03/12 15:45:39
*************** record_reg_classes (n_alts, n_ops, ops, 
*** 1538,1553 ****
  		break;
  
  	      case '<':
! 		if (GET_CODE (op) == MEM
! 		    && (GET_CODE (XEXP (op, 0)) == PRE_DEC
! 			|| GET_CODE (XEXP (op, 0)) == POST_DEC))
  		  win = 1;
  		break;
  
  	      case '>':
! 		if (GET_CODE (op) == MEM
! 		    && (GET_CODE (XEXP (op, 0)) == PRE_INC
! 			|| GET_CODE (XEXP (op, 0)) == POST_INC))
  		  win = 1;
  		break;
  
--- 1538,1549 ----
  		break;
  
  	      case '<':
! 		if (auto_dec_op_p (op))
  		  win = 1;
  		break;
  
  	      case '>':
! 		if (auto_inc_op_p (op))
  		  win = 1;
  		break;
  
Index: reload.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload.c,v
retrieving revision 1.142
diff -c -3 -p -r1.142 reload.c
*** reload.c	2001/01/24 23:50:56	1.142
--- reload.c	2001/03/12 15:45:47
*************** find_reloads (insn, replace, ind_levels,
*** 2993,3010 ****
  		break;
  
  	      case '<':
! 		if (GET_CODE (operand) == MEM
! 		    && ! address_reloaded[i]
! 		    && (GET_CODE (XEXP (operand, 0)) == PRE_DEC
! 			|| GET_CODE (XEXP (operand, 0)) == POST_DEC))
  		  win = 1;
  		break;
  
  	      case '>':
! 		if (GET_CODE (operand) == MEM
! 		    && ! address_reloaded[i]
! 		    && (GET_CODE (XEXP (operand, 0)) == PRE_INC
! 			|| GET_CODE (XEXP (operand, 0)) == POST_INC))
  		  win = 1;
  		break;
  
--- 2993,3004 ----
  		break;
  
  	      case '<':
! 		if (auto_dec_op_p (operand) && ! address_reloaded[i])
  		  win = 1;
  		break;
  
  	      case '>':
! 		if (auto_inc_op_p (operand) && ! address_reloaded[i])
  		  win = 1;
  		break;
  


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