int function (float X, float Y, float Z, int result)
{
result = (X*Y)+ Z;
}
I tried using https://godbolt.org/ but it doesnt support rv64i
int function (float X, float Y, float Z, int result)
{
result = (X*Y)+ Z;
}
I tried using https://godbolt.org/ but it doesnt support rv64i
Your code is broken, but just assume that it was written as:
float function (float X, float Y, float Z)
{
return (X*Y) + Z;
}
Also, assume that you have a floating point unit, i.e. that you are using a rv64if
or rv64id
device. Then the following assembly code would do the job:
function:
fmul.s ft0, fa0, fa1
fadd.s fa0, ft0, fa2
ret
Unfortunately, the device you are using rv64i
doesn't have a floating-point unit. A normal C compiler would provide a number of subroutines to perform various floating-point operations, the best way to check what they are named is to compile the program.
If you plan to write the subroutines yourself you are in for a mammoth task, as it probably take an experienced assembly programmer weeks if not months to do that.