Consider the following C statement:
a = (b + d)
+ (b – c) + (c + d)
Which of the following assembly instructions can be used to replicate all or part of this statement in MIPS, without changing or reducing the equation. Assume variables a, b, c, and d are assigned to registers $s0, $s1, $s2 and $s3 respectively.
Choose from the following options:
Group of answer choices
1, 2, 3
1, 3, 5
2, 5, 6
1, 2, 5
2, 3, 4
3, 4, 6
4, 5, 6
None of the above
Given that a = (b + d) + (b – c) + (c + d). Also variables a, b, c, and d are assigned to registers $s0, $s1, $s2 and $s3 respectively.
According to the question, we aren't allowed to change or reduce the equation.
(b-c) can be calculated using add sub $t1, $s1, $s2 and (c+d) can be calculated using add $t0, $s2, $s3.
(b+d) can be calculated using add $t2, $s1, $s3.
Hence the correct answer choice is 3, 4, 6.
If you have any doubt regarding the solution then let me know in comment. If it helps, kindly give an upVote to this answer.
Get Answers For Free
Most questions answered within 1 hours.