Reputation: 58
I'm trying to make a simple function that adds to floats passed as arguments in MIPS. Previously I did a simple code to add ints:
move v0,a0
add v0,v0,a1
j ra
Copying it I did something alike for floats
l.d $f0,0($a0)
l.d $f2,0($a1)
add.d $f0,$f0,$f2
j ra
Which results in a compiling error:
Error: illegal operands `l.d'
Which I'm guessing is because of how I'm trying to get the arguments from a0. How am I suppossed to receive double floating point arguments, adding them and returning them.
Thanks in advance
Upvotes: 1
Views: 1052
Reputation: 58
I saw my mistake. Had to pass them by reference and respect the ABI :) Thanks
Upvotes: 1
Reputation: 62048
Try ldc1
instead of l.d
. l.d
is most likely a macro and for some reason it's not defined/available.
Upvotes: 1