How to implement branches?

Andrew Pinski pinskia@physics.uc.edu
Wed May 14 14:10:00 GMT 2003


It is close but rs6000 (PowerPC) has a compare instruction, not an 
`equal to' instruction.
I think the way to have (set (reg 12) (eq (reg 10) (reg 11)) be `equal 
r10, r11, r12' and then have
(set (pc) (if_then_else (eq (reg 12) (const_int 1)) (label_reg (label)) 
(pc))) be `branch_if_true r12, label'
and  (set (pc) (if_then_else (eq (reg 12) (const_int 0)) (label_reg 
(label)) (pc))) be `branch_if_false r12, label'


Thanks,
Andrew Pinski

On Wednesday, May 14, 2003, at 09:59 US/Eastern, Andreas Schwab wrote:

> "Fred Cook" <fcook377@hotmail.com> writes:
>
> |> Hi,
> |>
> |> My target architecture implements conditional branches like this:
> |>
> |>         equal r10, r11, r12             /* r12 = (r10 == r11) */
> |>         branch_if_true r12, label
> |>
> |> Now I am looking for hits to implement this my gcc port. Also
> |> references to ports where branches are clearly implemented and
> |> branches are similar to the branches of my architecture are
> |> welcome.
>
> I think the PowerPC architecture is similar.
>
> Andreas.
>
> -- 
> Andreas Schwab, SuSE Labs, schwab@suse.de
> SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
> Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>
>



More information about the Gcc mailing list