Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MIPS - expand SLE pseudoinstruction

729 views
Skip to first unread message

RishiD

unread,
Dec 7, 2006, 5:40:35 PM12/7/06
to
Hi,

Doing some final preparation for my computer architecture class.
Wondering if anyone knew what the expansion of the sle $t1, $s0, $s1
instruction would be? # if $s0 <= $s1 then $t1 = 1 else $t1 = 0

Thanks for the help,

RishiD

kuk...@pobox.sk

unread,
Jan 18, 2017, 12:51:35 AM1/18/17
to
Hello,

Probably way too late to reply, but I was actually looking for it and this post come near top in google (and I didn't find it).

So I finally got about 20h later (after I got curious) to MARS simulator, to see how it does it (was driving me crazy), and it turned out I had total mind blackout :/.

slt is (x < y)

sle is (x <= y) <=> !(x > y) <=> !(y < x)

Doh! I mean... I was even "so sge is 'slt (y < x)', I see, but how do they the sle?". Blind leads blind...

So it gets compiled as:

sle $4, $5, $6 =
slt $4, $6, $5 ; r = y < x
ori $1, $0, 1 ; $at = 1
subu $4, $1, $4 ; r = $at - r = not(y < x)

Which leaves me wondering, why not:

sle $4, $5, $6 =
slt $4, $6, $5 ; r = y < x
xori $4, $4, 1 ; r = not(y < x)

? is xori somehow bad? (I don't know anything about MIPS CPU, I just by accident did help with some assembly to somebody else, and the "sle"-being-only-pseudo-instruction made me curious, how one can do it simply)

And for completeness:

seq (x == y) is treated a bit sideways, it does: r = |x - y| < 1
subu r, x, y
ori $at, $zero, 1
sltu r, r, $at

sne (x != y) is: r = 0 < |x - y|
subu r, x, y
sltu r, $zero, r

Ped7g
0 new messages