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

@@ -478,24 +478,6 @@ long long __ashldi3(long long a, int b)
#endif
}
#ifndef _WIN32
void __tcc_fpinit(void)
{
unsigned c = 0x137F;
__asm__ __volatile__ ("fldcw %0" : : "m" (c));
}
#endif
long long __tcc_cvt_ftol(long double x)
{
unsigned c0, c1;
long long ret;
__asm__ __volatile__ ("fnstcw %0" : "=m" (c0));
c1 = c0 | 0x0C00;
__asm__ __volatile__ ("fldcw %0" : : "m" (c1));
__asm__ __volatile__ ("fistpll %0" : "=m" (ret));
__asm__ __volatile__ ("fldcw %0" : : "m" (c0));
return ret;
}
#endif /* !__x86_64__ */
/* XXX: fix tcc's code generator to do this instead */
@@ -616,6 +598,27 @@ unsigned long long __fixunsxfdi (long double a1)
return 0;
}
long long __fixsfdi (float a1)
{
long long ret; int s;
ret = __fixunssfdi((s = a1 >= 0) ? a1 : -a1);
return s ? ret : -ret;
}
long long __fixdfdi (double a1)
{
long long ret; int s;
ret = __fixunsdfdi((s = a1 >= 0) ? a1 : -a1);
return s ? ret : -ret;
}
long long __fixxfdi (long double a1)
{
long long ret; int s;
ret = __fixunsxfdi((s = a1 >= 0) ? a1 : -a1);
return s ? ret : -ret;
}
#if defined(__x86_64__) && !defined(_WIN64)
#ifndef __TINYC__