Re: Structure vs purism ?

Henrik Olsen (henrik@iaeste.dk)
Fri, 22 Jan 1999 18:45:04 +0100 (CET)


On Fri, 22 Jan 1999, Thomas E. Dodd /CSDC wrote:
> Stefan Monnier wrote:
> > I think a lot of the goto's could be removed as soon as there is a decent
> > possibility to tell the compiler to optimize for a certain case. This was
> > discussed on the egcs lists some time ago IIRC.
> >
> > > compare against a final value because on most/many/(all?) processors
> > > the flags change automatically when decrementing to zero or decrementing
> > > to a negative number.
> >
> > 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.
>
> The architecture coure I too was based on the MIPS.
> We had a 0 bit from the ALU that could be checked.
Simplest version is to make a true beq instruction to be something like
beq <op1> <op2> <label>
ie. branch if the operands are equal, some architectures even allows for
additional hints for helping branch prediction

The beq you're talking about isn't a Branch if EQual at all, it's really a
branch if zero-flag set, aliased for the normal use.

-- 
Henrik Olsen,  Dawn Solutions I/S
URL=http://www.iaeste.dk/~henrik/
Get the rest there.

- 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/