[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] signed cmpl



One more remark...

> Of course there will be both signed and unsigned integer compare
> instructions (and also min/max/sort). Projected names for the signed
> counterparts are cmpls, cmples, mins, maxs and minmaxs (aka sorts).

Today I noticed that the current instruction set is slightly insufficient:
we cannot perform the `register > constant' or `register >= constant'
operations with a single instruction. On the other hand, `cmpli'
and `cmplei' are widely equivalent, except for `cmpli $0, r2, r1' and
`cmplei $255, r2, r1' which have no corresponding instruction. Therefore,
we should implement a different pair of compare instructions. I guess
the best alternative is `cmpg' and `cmple'. We may also provide all of
them (cmp[lg] and cmp[lg]e) with little additional hardware (and without
latency increasing) - an extra row of MUXes in an uncritical place will
do the trick.

In either case, all four `reg x reg -> reg' instructions will be available
as assembler aliases, whether or not they're implemented in hardware. The
`reg x imm -> reg' instructions can also be mapped to each other if we
don't provide the full set, but the argument ranges will be slightly
different (like 1...256, or -127...128 for signed operations). But
whatever we do, we should provide immediate compare instructions with
both a `less' and a `greater' (-or-equal) condition.

Comments?
-- 
 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/