added native double round(double) function

This commit is contained in:
Alexander 2019-06-03 21:59:48 +07:00 committed by Christoph Oelckers
parent 5661e39ca7
commit 380398bcd6
6 changed files with 10 additions and 0 deletions

View File

@ -82,6 +82,8 @@ static const FLOP FxFlops[] =
{ NAME_CosH, FLOP_COSH, [](double v) { return g_cosh(v); } }, { NAME_CosH, FLOP_COSH, [](double v) { return g_cosh(v); } },
{ NAME_SinH, FLOP_SINH, [](double v) { return g_sinh(v); } }, { NAME_SinH, FLOP_SINH, [](double v) { return g_sinh(v); } },
{ NAME_TanH, FLOP_TANH, [](double v) { return g_tanh(v); } }, { NAME_TanH, FLOP_TANH, [](double v) { return g_tanh(v); } },
{ NAME_Round, FLOP_ROUND, [](double v) { return round(v); } },
}; };

View File

@ -181,6 +181,8 @@ static const char *const FlopNames[] =
"cosh", "cosh",
"sinh", "sinh",
"tanh", "tanh",
"round",
}; };
static int print_reg(FILE *out, int col, int arg, int mode, int immshift, const VMScriptFunction *func); static int print_reg(FILE *out, int col, int arg, int mode, int immshift, const VMScriptFunction *func);

View File

@ -985,6 +985,7 @@ void JitCompiler::EmitFLOP()
case FLOP_COSH: func = g_cosh; break; case FLOP_COSH: func = g_cosh; break;
case FLOP_SINH: func = g_sinh; break; case FLOP_SINH: func = g_sinh; break;
case FLOP_TANH: func = g_tanh; break; case FLOP_TANH: func = g_tanh; break;
case FLOP_ROUND: func = round; break;
} }
auto result = newResultXmmSd(); auto result = newResultXmmSd();

View File

@ -1741,6 +1741,8 @@ static double DoFLOP(int flop, double v)
case FLOP_COSH: return g_cosh(v); case FLOP_COSH: return g_cosh(v);
case FLOP_SINH: return g_sinh(v); case FLOP_SINH: return g_sinh(v);
case FLOP_TANH: return g_tanh(v); case FLOP_TANH: return g_tanh(v);
case FLOP_ROUND: return round(v);
} }
assert(0); assert(0);
return 0; return 0;

View File

@ -101,6 +101,8 @@ enum
FLOP_COSH, FLOP_COSH,
FLOP_SINH, FLOP_SINH,
FLOP_TANH, FLOP_TANH,
FLOP_ROUND,
}; };
// Cast operations // Cast operations

View File

@ -363,6 +363,7 @@ xx(Tan)
xx(CosH) xx(CosH)
xx(SinH) xx(SinH)
xx(TanH) xx(TanH)
xx(Round)
xx(ATan2) xx(ATan2)
xx(VectorAngle) xx(VectorAngle)
xx(New) xx(New)