Messages in this thread | | | Subject | Re: Structure vs purism ? | Date | Fri, 22 Jan 1999 12:02:37 +0000 (GMT) | From | Malcolm Beattie <> |
| |
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/
| |