This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: i386, m88k, and rs6000 (possibly others) dbra confusion
- To: rth at cygnus dot com
- Subject: Re: i386, m88k, and rs6000 (possibly others) dbra confusion
- From: John Wehle <john at feith dot com>
- Date: Fri, 16 Jun 2000 16:50:25 -0400 (EDT)
- Cc: gcc at gcc dot gnu dot org
>On Fri, Jun 16, 2000 at 02:01:27AM -0400, John Wehle wrote:
>> (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)))
>[...]
>> 1) REG_NONNEG means that operand 1 is always nonnegative in which
>> case the branch will * always * be taken.
>
> Well, no, it means that operand 1 will always be nonnegative
> within the loop. Not globally.
Of course. I wasn't attempting to imply that it was globally true,
only that it was true when the insn in question is encountered.
>> 2) loop is documented by Intel as:
>>
>> DEC count; jump short if count <> 0
>>
>> which doesn't match the define_insn.
>
> How would you write it? Duplicate the subtraction in the test?
That's how it's done in some of the other machine descriptions.
> I suppose that would make things more pedanticly correct, though
> I don't see an urgent need to change it.
It may confuse some optimizers. For example if operand 1 is known
to equal one prior to dbra_ge then the RTL states that the jump
will be taken when it really isn't.
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------