x86/x64: Drop internal x87 math functions. Use libm functions.

This commit is contained in:
Mike Pall
2014-12-08 02:02:34 +01:00
parent e03df1e339
commit ad03eba715
7 changed files with 115 additions and 456 deletions

View File

@@ -17,14 +17,25 @@
#if LJ_TARGET_X86 && __ELF__ && __PIC__
/* Wrapper functions to deal with the ELF/x86 PIC disaster. */
LJ_FUNCA double lj_wrap_log(double x) { return log(x); }
LJ_FUNCA double lj_wrap_log10(double x) { return log10(x); }
LJ_FUNCA double lj_wrap_exp(double x) { return exp(x); }
LJ_FUNCA double lj_wrap_sin(double x) { return sin(x); }
LJ_FUNCA double lj_wrap_cos(double x) { return cos(x); }
LJ_FUNCA double lj_wrap_tan(double x) { return tan(x); }
LJ_FUNCA double lj_wrap_asin(double x) { return asin(x); }
LJ_FUNCA double lj_wrap_acos(double x) { return acos(x); }
LJ_FUNCA double lj_wrap_atan(double x) { return atan(x); }
LJ_FUNCA double lj_wrap_sinh(double x) { return sinh(x); }
LJ_FUNCA double lj_wrap_cosh(double x) { return cosh(x); }
LJ_FUNCA double lj_wrap_tanh(double x) { return tanh(x); }
LJ_FUNCA double lj_wrap_atan2(double x, double y) { return atan2(x, y); }
LJ_FUNCA double lj_wrap_pow(double x, double y) { return pow(x, y); }
LJ_FUNCA double lj_wrap_fmod(double x, double y) { return fmod(x, y); }
#endif
/* -- Helper functions for generated machine code ------------------------- */
#if !LJ_TARGET_X86ORX64
double lj_vm_foldarith(double x, double y, int op)
{
switch (op) {
@@ -45,7 +56,6 @@ double lj_vm_foldarith(double x, double y, int op)
default: return x;
}
}
#endif
#if LJ_HASJIT
@@ -109,6 +119,7 @@ double lj_vm_powi(double x, int32_t k)
else
return 1.0 / lj_vm_powui(x, (uint32_t)-k);
}
#endif
/* Computes fpm(x) for extended math functions. */
double lj_vm_foldfpm(double x, int fpm)
@@ -130,7 +141,6 @@ double lj_vm_foldfpm(double x, int fpm)
}
return 0;
}
#endif
#if LJ_HASFFI
int lj_vm_errno(void)