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.
Step by Step Answer:
Computer Organization And Design MIPS Edition The Hardware/Software Interface
ISBN: 9780128201091
6th Edition
Authors: David A. Patterson, John L. Hennessy