i386, m88k, and rs6000 (possibly others) dbra confusion

John Wehle john@feith.com
Thu Jun 15 23:01:00 GMT 2000


i386.md has:

(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\";
}"

A couple of points of interest:

  1) REG_NONNEG means that operand 1 is always nonnegative in which
     case the branch will * always * be taken.

  2) loop is documented by Intel as:

     DEC count; jump short if count <> 0

     which doesn't match the define_insn.

I can prepare a patch for the i386, however I'm not fluent
with the other machine descriptions (m88k and rs6000) which
also look suspect.

-- John
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



More information about the Gcc mailing list