Name: Box: Date:


  1. (22 points) As discussed on pages 140–141 (Section 2.12 "Assembler"), pseudoinstructions are not part of the MIPS instruction set, but often appear in MIPS programs. For each pseudoinstruction in the following table, produce a minimal sequence of actual MIPS instructions to accomplish the same thing.

    You may need to use $at for some of the sequences. In the following tables, BIG refers to a specific number that requires 32 bits to represent and SMALL to a number that can fit in 16 bits. You may need to refer to the most-significant/least-significant half of BIG in your answers. Unless otherwise specified assume all integers are signed.

    Pseudoinstruction What it accomplishes Actual instructions
    move $t0, $t1 $t0 = $t1
    clear $t0 $t0 = 0
    li $t0, SMALL $t0 = SMALL
    li $t1, BIG $t1 =big
    beq $t0, SMALL, L if ($t0 == SMALL) goto L
    beq $t1, BIG, L if ($t1 == big) goto L
Pseudoinstruction What it accomplishes Actual instructions
ble $t3, $t5, L if ($t3 <= $t5) goto L
bgt $t3, $t5, L if ($t3 > $t5) goto L
bge $t3, $t5, L if ($t3 >= $t5) goto L
addi $t1, $t2, BIG $t1 = $t2 + big
lw $t5, BIG($t2) $t5 = Memory at address $t2 + big