i386: use __fixdfdi instead of __tcc_cvt_ftol

Variants __fixsfdi/__fixxfdi are not needed for now because
the value is converted to double always.

Also:
- remove __tcc_fpinit for unix as it seems redundant by the
  __setfpucw call in the startup code
- avoid reference to s->runtime_main in cross compilers
- configure: fix --with-libgcc help
- tcctok.h: cleanup
This commit is contained in:
grischka
2014-01-06 19:07:08 +01:00
parent 8efaa71190
commit 4ad186c5ef
6 changed files with 98 additions and 94 deletions

View File

@ -581,14 +581,6 @@ ST_FUNC void gfunc_prolog(CType *func_type)
func_bound_offset = lbounds_section->data_offset;
}
#endif
#ifndef CONFIG_USE_LIBGCC
#ifndef TCC_TARGET_PE
if (0 == strcmp(funcname, "main"))
gen_static_call(TOK___tcc_fpinit);
#endif
#endif
}
/* generate function epilog */
@ -988,16 +980,20 @@ ST_FUNC void gen_cvt_itof(int t)
}
/* convert fp to int 't' type */
/* XXX: handle long long case */
ST_FUNC void gen_cvt_ftoi(int t)
{
gv(RC_FLOAT);
save_reg(TREG_EAX);
save_reg(TREG_EDX);
gen_static_call(TOK___tcc_cvt_ftol);
vtop->r = TREG_EAX; /* mark reg as used */
if (t == VT_LLONG)
vtop->r2 = TREG_EDX;
int bt = vtop->type.t & VT_BTYPE;
if (bt == VT_FLOAT)
vpush_global_sym(&func_old_type, TOK___fixsfdi);
else if (bt == VT_LDOUBLE)
vpush_global_sym(&func_old_type, TOK___fixxfdi);
else
vpush_global_sym(&func_old_type, TOK___fixdfdi);
vswap();
gfunc_call(1);
vpushi(0);
vtop->r = REG_IRET;
vtop->r2 = REG_LRET;
}
/* convert from one floating point type to another */