This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: generating compare and branch instructions
tir, 09.11.2004 kl. 01.23 skrev Hans-Peter Nilsson:
> On Mon, 8 Nov 2004, Øyvind Harboe wrote:
> > I'm trying to figure out how to tell GCC in the machine description
> > file how to:
> >
> > - use any register for the result of the cmpsi instruction
>
> Most ports where any register suffices for the result, saves the
> operands in the compare pattern and emit both the compare and
> the branch at the branch description. This solves the problem
> of emitting a compare insn that matches the branch insn. See
> for example the "cmpdi" and "beq" patterns in the MMIX port; the
> compare insn is later matched against e.g. "*cmpcc" and the
> branch against "*bCC" (BTW, looks like a naming inconsistency
> but each name has a valid reason). Doesn't the manual mention
> this method?
After studying the MMIX port, there is only one thing that puzzles me.
I've read the documentation of "match_dup" and I can't understand what
"match_dup 1" referes to in the .md code below.
(define_expand "beq"
[(set (pc)
(if_then_else (eq (match_dup 1) (const_int 0))
(label_ref (match_operand 0 "" ""))
(pc)))]
> You want to do it this way rather than use cbranch if you also
> need to schedule insns in your port.
>
> brgds, H-P
--
Øyvind Harboe
http://www.zylin.com