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]

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


>	The patterns are correct.  The branch will NOT always be taken
>because the loop counter will reach zero.  Zero is not negative, so the
>reg_note is correct.  I am not sure where you are getting confused.

rs6000.md has:

(define_insn "*ctrsi_internal3"
  [(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*q*c*l")
	(plus:SI (match_dup 1)
		 (const_int -1)))
   (clobber (match_scratch:CC 3 "=X,&x,&X"))
   (clobber (match_scratch:SI 4 "=X,X,r"))]
  "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"

If operand 1 is always nonnegative then:

  (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
      (const_int 0))

will always be true in which case the branch will always be taken.
The RTL indicates that the branch is taken even if the loop counter
is zero.

-- John
-------------------------------------------------------------------------
|   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]