#include #include #include "do_jit.h" int main() { struct ejit_operand operands[2] = { EJIT_OPERAND_FPR(0, EJIT_TYPE(double)) }; struct ejit_func *f = ejit_create_func(EJIT_TYPE(int64_t), 1, operands); ejit_truncr_d_64(f, EJIT_GPR(0), EJIT_FPR(0)); ejit_retr(f, EJIT_GPR(0)); ejit_select_compile_func(f, 1, 1, EJIT_TYPE(int64_t), do_jit); assert(erf1(f, EJIT_ARG(0.0, double)) == 0); assert(erf1(f, EJIT_ARG(-0.0, double)) == 0); assert(erf1(f, EJIT_ARG(0.5, double)) == 0); assert(erf1(f, EJIT_ARG(-0.5, double)) == 0); assert(erf1(f, EJIT_ARG(1.5, double)) == 1); assert(erf1(f, EJIT_ARG(-1.5, double)) == -1); assert(erf1(f, EJIT_ARG(2.5, double)) == 2); assert(erf1(f, EJIT_ARG(-2.5, double)) == -2); ejit_destroy_func(f); }