I'm preparing for a university exam, the course talks about Calculator, specifically the MIPS 64, I'll get to the point, an exercise ask me the use the loop unrolling using multidimensional arrays, however, I'm able to handle the exercise as long as exercis ask me to use simple array.
So, I need your help.
Example, the matrix is squared:
for (i=0;i<n; i++)
{ for(y=0;y<n;y++)
{
g[i][y] = g[i][y] + a;
}}
So, I want use an loop unrolling factor equal to 4, so my code becomes:
for (i=0; i<n; i++)
{for (y=0; y+4-1<n; y=y+4)
{ g[i][y]= g[i][y] + a;
g[i][y+1]= g[i][y+1] + a;
g[i][y+2]= g[i][y+2] + a;
g[i][y+3]= g[i][y+3] + a;
}}
Using MIPS 64 Assembly, how can I write my code?
so, for the the following examination test: Z[i]=A[i]*⅀B[i,j] where ⅀ is used to sum all the elements of a row.
My pointers are linked to the last element of array:
A starts from 1000, B starts from 3000 and Z starts from 2000
R3 is used to scroll A and Z, R2 for scrolling B
Code: