Question: The following code transposes the elements of an MX Marray, where is a constant defined by #define 2 void transpose (long A [M] [M])

The following code transposes the elements of an MX Marray, where is 

The following code transposes the elements of an MX Marray, where is a constant defined by #define 2 void transpose (long A [M] [M]) { long i, j; 3 for (i=0; i < M; i++) 4 for (j = 0; j < i; j++) { 5 long t = A[i][j]; 6 A[i][j] = A[j] [i]; 7 A [j] [i] = t; 8 } 9} When compiled with optimization level -01, gcc generates the following code for the inner loop of the function: 1 .L6: 2 movq (%rdx), %rcx 3 movq (%rax), %rsi 4 movq %rsi, (%rdx) 5 movq %rcx, (%rax) 6 addq $8, %rdx 7 addq $120, %rax 8 cmpq %rdi, %rax 9 jne .L6

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!