lkml.org 
[lkml]   [1999]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Structure vs purism ?
Date
From
Thomas E. Dodd /CSDC writes:
> Stefan Monnier wrote:
> > MIPS and Alpha don't have `flags'. But I still agree that it's most of the
> > time cheaper to check against 0 than against any other value.
>
> Then how do you get a beq or bne instruction?
> There must be a status register that knows if
> the last operation resulted in 0.

Not for Alpha. The conditional branch instructions take an explicit
source register and a label.
beq s_reg, label
bne s_reg, label
and so on. Those and blt, ble, bgt, bge do the obvious (in)equality and
comparisons; blbc (resp blbs) branch if low bit is set (resp clear).
Similarly, you can do conditional register moves based on testing a
source register and there's a family of relational instructions
(cmpeq, cmplt etc.) which compare two registers and set a third
register to 1 or 0. With the jump instructions, you can even make a
hint to the branch prediction logic as to what to do.

--Malcolm

--
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Unix Systems Programmer
Oxford University Computing Services

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.042 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site