[Top] [All Lists]


Subject: help
From: Hai Huang <>
Date: Wed, 4 Oct 2000 18:54:14 -0700 (MST)
hi, MIPS gurus. :) i encounter a problem on MIPS in my computer
architecture course. it requires to use 3 MIPS instructions to implement
absolute value. 

abs $t2, $t3

$t3 is a number, if $t3<0, then $t2 is $t3's 2's complement, otherwise,
$t2=$t3. i can do it in four instructions.

    add $t2, zero, $t3
    slt $at, $t3, zero
    beq $at, zero, OUT
    sub $t2, zero, $t2

but i don't know how to use three. this problem borthers me for several
days. could you help me? thanks a lot. :)


Hai Huang
Arizona State University                 Phone: (480) 449-9490 (H)
Computer Science & Engineering Department
Tempe, AZ 85287                          email:

<Prev in Thread] Current Thread [Next in Thread>