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]

Patch to remove i386 *dbra_ge


This patch removes the i386 *dbra_ge pattern since:

  1) It's incorrect.

  2) I don't see an easy way to make it correct.  The Intel i386 loop
     instruction is defined as:

       dec count; jump if result is not zero

     Merely knowing that operand 1 is not negative doesn't suffice
     since if it is zero the i386 loop instruction will decrement
     it producing -1 which isn't equal to zero thus causing a jump.
     What needs to be known is that the register is positive prior
     to the execution of the instruction and there currently is
     no REG_NOTE defined to convey that.

This patch passes make bootstrap and make check on FreeBSD-3.4 x86.

ChangeLog:

Sat Jun 17 00:27:44 EDT 2000  John Wehle  (john@feith.com)

	* i386.md (*dbra_ge): Remove.

Enjoy!

-- John Wehle
------------------8<------------------------8<------------------------
*** gcc/config/i386/i386.md.ORIGINAL	Thu Jun 15 23:14:07 2000
--- gcc/config/i386/i386.md	Sat Jun 17 00:24:02 2000
***************
*** 7720,7757 ****
  		      (const_int 2)
  		      (const_int 16)))])
  
- (define_insn "*dbra_ge"
-   [(set (pc)
- 	(if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
- 			  (const_int 0))
- 		      (label_ref (match_operand 0 "" ""))
- 		      (pc)))
-    (set (match_operand:SI 2 "register_operand" "=1,*r,*m*r")
- 	(plus:SI (match_dup 1)
- 		 (const_int -1)))
-    (clobber (match_scratch:SI 3 "=X,X,r"))
-    (clobber (reg:CC 17))]
-   "TARGET_USE_LOOP && find_reg_note (insn, REG_NONNEG, 0)"
-   "*
- {
-   if (which_alternative != 0)
-     return \"#\";
-   if (get_attr_length (insn) == 2)
-     return \"loop\\t%l0\";
-   else
-     return \"dec{l}\\t%1\;jne\\t%l0\";
- }"
-   [(set_attr "type" "ibr")
-    (set_attr "ppro_uops" "many")
-    (set (attr "length")
- 	(if_then_else (and (eq_attr "alternative" "0")
- 			   (and (ge (minus (match_dup 0) (pc))
- 			            (const_int -128))
- 			        (lt (minus (match_dup 0) (pc))
- 			            (const_int 124))))
- 		      (const_int 2)
- 		      (const_int 16)))])
- 
  (define_split
    [(set (pc)
  	(if_then_else (ne (match_operand:SI 1 "register_operand" "")
--- 7720,7725 ----
***************
*** 7794,7845 ****
  	      (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
     (set (match_dup 2) (match_dup 3))
     (set (pc) (if_then_else (ne (reg:CCZ 17) (const_int 0))
- 			   (match_dup 0)
- 			   (pc)))]
-   "")
- 
- (define_split
-   [(set (pc)
- 	(if_then_else (ge (match_operand:SI 1 "register_operand" "")
- 			  (const_int 0))
- 		      (match_operand 0 "" "")
- 		      (pc)))
-    (set (match_operand:SI 2 "register_operand" "")
- 	(plus:SI (match_dup 1)
- 		 (const_int -1)))
-    (clobber (match_scratch:SI 3 ""))
-    (clobber (reg:CC 17))]
-   "TARGET_USE_LOOP && reload_completed
-    && ! (REGNO (operands[1]) == 2 && rtx_equal_p (operands[1], operands[2]))"
-   [(set (match_dup 2) (match_dup 1))
-    (parallel [(set (reg:CCNO 17)
- 		   (compare:CCNO (plus:SI (match_dup 2) (const_int -1))
- 				 (const_int 0)))
- 	      (set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))])
-    (set (pc) (if_then_else (lt (reg:CCNO 17) (const_int 0))
- 			   (match_dup 0)
- 			   (pc)))]
-   "")
-   
- (define_split
-   [(set (pc)
- 	(if_then_else (ge (match_operand:SI 1 "register_operand" "")
- 			  (const_int 0))
- 		      (match_operand 0 "" "")
- 		      (pc)))
-    (set (match_operand:SI 2 "memory_operand" "")
- 	(plus:SI (match_dup 1)
- 		 (const_int -1)))
-    (clobber (match_scratch:SI 3 ""))
-    (clobber (reg:CC 17))]
-   "TARGET_USE_LOOP && reload_completed"
-   [(set (match_dup 3) (match_dup 1))
-    (parallel [(set (reg:CCNO 17)
- 		   (compare:CCNO (plus:SI (match_dup 3) (const_int -1))
- 				 (const_int 0)))
- 	      (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
-    (set (match_dup 2) (match_dup 3))
-    (set (pc) (if_then_else (lt (reg:CCNO 17) (const_int 0))
  			   (match_dup 0)
  			   (pc)))]
    "")
--- 7762,7767 ----
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------


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