Question: 1 5 . The following MIPS assembly code is for a function with the signature int f ( char * a , char * b

15. The following MIPS assembly code is for a function with the signature
int f(char* a, char* b);
00000000 :
0: lb v1,0(a0)
4: lb v0,0(a1)
8: addiu a0, a0,1
c: subu v0, v1, v010: bnez v0,20
14: addiu a1, a1,1
18: bnez v1,0
1c: nop
20: jr ra
24: nop
The lb (load byte) instruction loads a single byte from memory at the address specified by the sum of the register and the immediate offset. For example, lb v1,0(a0) loads the byte at the memory address stored in a0 into register v1.
(a) Explain briefly what this function does.
(b) Give one optimization that can be performed on the assembly code. (Hints: Branch prediction-based prefetching)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!