mirror of
https://github.com/TinyCC/tinycc.git
synced 2025-11-16 12:34:45 +00:00
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:
@@ -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__
|
||||
|
||||
Reference in New Issue
Block a user