Some programming languages allow twos complement integer arithmetic on variables declared byte and half, whereas MIPS only

Question:

Some programming languages allow two’s complement integer arithmetic on variables declared byte and half, whereas MIPS only has integer arithmetic operations on full words. As we recall from Chapter 2, MIPS does have data transfer operations for bytes and halfwords. What MIPS instructions should be generated for byte and halfword arithmetic operations?

1. Load with 1bu, 1hu; arithmetic with add, sub, mult, div; then store using sb, sh.

2. Load with 1b, 1h; arithmetic with add, sub, mult, div; then store using sb, sh.

3. Load with 1b, 1h; arithmetic with add, sub, mult, div, using AND to mask result to 8 or 16 bits after each operation; then store using sb, sh.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: