Remember: You are encouraged to turn in individual problems as soon as possible, rather than turning in the whole assignment on the due date. Please mark each problem with the exercise number from the book.
tmp
at our disposal, we can start by
eliminating sne
, since
sne s, a, bcan be replaced by the sequence of instructions:
seq s, a, b li tmp, 1 sub s, tmp, sor with the sequence of instructions:
sub, s, a, b li tmp, done-label jeqz s, tmp li s, 1 done-label:
Remember, that the instruction you are replacing
could appear anywhere in a larger program, so (for example) your
proposed replacement should not halt
. (See how few auxiliary
registers like tmp
you can get away with.)