iMiddle R1 iEnd R2 i R3 j R4 k R5 Starting address of A R6 S
iMiddle: R1
iEnd: R2
i: R3
j: R4
k: R5 Starting address of A: R6
Starting address of B: R7
Apply if-conversion to the code above and translate to MIPS assembly using predication. Use only the following two predicated instructions:
MOVZ Rd, Rs, Rt
MOVN Rd, Rs, Rt
Solution
MOVE R1,iMiddle
MOVE R2,iEnd
MOVE R3,i
MOVE R4,j
MOVE R5,k
MOVE R6,$A
MOVE R7,$B
ble $R5,$R6 (branch if it is less than)
bgt RD,RS,RT (branch on greater than)
ble Rd,Rs, Rt
