Your second mission is to write the code for the divsi3 function. Do this using Compiler Explorer, i.e., write a C function called divsi3 that takes two integer arguments and returns an integer result:
int divsi3(int n, int d) {
return (n / d);
}
int -divsi3(int a, int b) {
//...some code
return (0 /* replace 0 with the value of a / b */);
}
Specifically, you are to:
a) Write the C version of the divsi3 function (implementing a restoring division algorithm), generating RISC-V code using CE. Assume that both n and d are positive.
b) Comment the generated assembly code (using any text editor you wish) completely - this usually means one meaningful comment per line of assembly.
c) Now create a version of divsi3(int a, int b) with two integer arguments, a and b, that handles the cases where n and d are signed (and can be the same or differently signed).
d) Estimate how long your final function will take (in clock cycles) to execute (assuming one clock cycle per instruction) to perform a 32-bit divide.