add "tan" to intrinsic functions
This commit is contained in:
parent
77f035e2b5
commit
806539a2d6
|
@ -32,6 +32,7 @@ bool isfinite(float f);
|
|||
|
||||
#pragma intrinsic(sin)
|
||||
#pragma intrinsic(cos)
|
||||
#pragma intrinsic(tan)
|
||||
|
||||
#pragma compile("math.c")
|
||||
|
||||
|
|
|
@ -1099,6 +1099,11 @@ ConstexprInterpreter::Value ConstexprInterpreter::EvalCall(Expression* exp, Cons
|
|||
mResult = Value(exp->mLocation, TheFloatTypeDeclaration);
|
||||
mResult.PutFloat(cos(mParams[0].GetFloat()));
|
||||
}
|
||||
else if (!strcmp(iname->mString, "tan"))
|
||||
{
|
||||
mResult = Value(exp->mLocation, TheFloatTypeDeclaration);
|
||||
mResult.PutFloat(tan(mParams[0].GetFloat()));
|
||||
}
|
||||
else
|
||||
mErrors->Error(exp->mLeft->mDecValue->mLocation, EERR_OBJECT_NOT_FOUND, "Unknown intrinsic function", iname);
|
||||
}
|
||||
|
|
|
@ -946,6 +946,8 @@ Expression* Expression::ConstantFold(Errors * errors, LinkerSection * dataSectio
|
|||
d = sin(d);
|
||||
else if (!strcmp(iname->mString, "cos"))
|
||||
d = cos(d);
|
||||
else if (!strcmp(iname->mString, "tan"))
|
||||
d = tan(d);
|
||||
else
|
||||
return this;
|
||||
|
||||
|
|
|
@ -10409,9 +10409,10 @@ bool InterCodeBasicBlock::SimplifyIntegerNumeric(const GrowingInstructionPtrArra
|
|||
|
||||
if (pins->mSrc[0].mTemp < 0 && ins->mSrc[0].mIntConst + pins->mSrc[0].mIntConst >= 0)
|
||||
{
|
||||
int64 offset = ins->mSrc[0].mIntConst + pins->mSrc[0].mIntConst;
|
||||
ins->mSrc[0].Forward(pins->mSrc[1]);
|
||||
pins->mSrc[1].mFinal = false;
|
||||
ins->mSrc[0].mIntConst += pins->mSrc[0].mIntConst;
|
||||
ins->mSrc[0].mIntConst += offset;
|
||||
changed = true;
|
||||
}
|
||||
else if (pins->mSrc[1].mTemp < 0 && pins->mSrc[0].mTemp >= 0 && ins->mSrc[0].mIntConst && (ins->mSrc[0].mIntConst >= 256 || pins->mSrc[0].IsUByte()))
|
||||
|
|
|
@ -3343,6 +3343,9 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
|||
else if (!strcmp(iname->mString, "cos"))
|
||||
{
|
||||
}
|
||||
else if (!strcmp(iname->mString, "tan"))
|
||||
{
|
||||
}
|
||||
else if (!strcmp(iname->mString, "malloc"))
|
||||
{
|
||||
vr = TranslateExpression(procType, proc, block, exp->mRight, destack, breakBlock, continueBlock, inlineMapper);
|
||||
|
|
Loading…
Reference in New Issue