So I am trying to convert some C into mips and I am running into a problem. So here is the C and the mips. My question is a few things, 1, all the times I have done a comparasin, > < == in the past there has been an else, in this their is none. So what would my offset be? and secondly how does one return func and set the paramaters like in the C. Thanks for any help
int f(int a, int b, int c, ind d)
{
if (a+b > c+d)
return func(a + b, c + d);
return func(a + b, c + d);
}
The code for C function func is already compiled in another module.
Here is the mips I have so far
//int a,b,c,d will be $a0, $a1, $a2, $a3
f:
addi $sp, $sp, -4
sw $s0, 0($sp)
add $t0, $a0, $a1
add $t1, $a2, $a3
slt $t2, $t1, $t0
bgtz $t2, offset
lw $s0, 0($sp)
addi $sp, $sp, 4
jr $ra