56#pragma function(abs,labs,div,ldiv)
87 if (!update_sw)
return -
NAN;
88 return (
x -
x) / (
x -
x);
91#define SET_X87_CW(MASK) \
93 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") \
95 "movw (%esp), %ax\n\t" \
96 "movw %ax, 2(%esp)\n\t" \
97 "testw $" #MASK ", %ax\n\t" \
99 "andw $~" #MASK ", %ax\n\t" \
100 "movw %ax, 2(%esp)\n\t" \
101 "fldcw 2(%esp)\n\t" \
104#define RESET_X87_CW \
105 "movw (%esp), %ax\n\t" \
106 "cmpw %ax, 2(%esp)\n\t" \
108 "fstpl 8(%esp)\n\t" \
113 "addl $4, %esp\n\t" \
114 __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
150 ERR(
"Unhandled math error!\n");
179int CDECL _get_FMA3_enable(
void)
198#if !defined(__i386__) || _MSVCR_VER>=120
220 int e =
u.i >> 23 & 0xff;
242 return (
u.i & 0x7fffffff) < 0x7f800000;
251 return (
u.i & 0x7fffffff) > 0x7f800000;
286 asm(
"fsqrt s0,s0; ret" );
288#elif defined __aarch64__
289float CDECL asm_sqrtf(
float);
292float CDECL asm_sqrtf(
float);
294#elif defined __x86_64__
295float CDECL asm_sqrtf(
float);
336double CDECL x87_asin(
double);
355 unsigned int x87_cw, sse2_cw;
357 unsigned int ix = hx & 0x7fffffff;
364 __control87_2(0, 0, &x87_cw, &sse2_cw);
428 asm(
"fsqrt d0,d0; ret" );
430#elif defined __aarch64__
431double CDECL asm_sqrt(
double);
434double CDECL asm_sqrt(
double);
436#elif defined __x86_64__
437double CDECL asm_sqrt(
double);
439#elif defined __i386__
440double CDECL asm_sqrt(
double);
468 *(
UINT64*)&
x |= 0x0008000000000000ULL;
475#if (defined(__GNUC__) || defined(__clang__)) && defined(__i386__)
477#define CREATE_FPU_FUNC1(name, call) \
478 __ASM_GLOBAL_FUNC(name, \
480 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") \
481 __ASM_CFI(".cfi_rel_offset %ebp,0\n\t") \
482 "movl %esp, %ebp\n\t" \
483 __ASM_CFI(".cfi_def_cfa_register %ebp\n\t") \
484 "subl $68, %esp\n\t"
\
487 "movl $1, %ecx\n\t"
\
491 "and $0x4500, %ax\n\t" \
492 "cmp $0x4100, %ax\n\t" \
494 "fstpl (%esp,%ecx,8)\n\t" \
499 "movl %ecx, -4(%ebp)\n\t" \
500 "call " __ASM_NAME( #call ) "\n\t" \
501 "movl -4(%ebp), %ecx\n\t" \
505 "fldl (%esp,%ecx,8)\n\t" \
506 "cmpl $0, %ecx\n\t" \
509 __ASM_CFI(".cfi_def_cfa %esp,4\n\t") \
510 __ASM_CFI(".cfi_same_value %ebp\n\t") \
513#define CREATE_FPU_FUNC2(name, call) \
514 __ASM_GLOBAL_FUNC(name, \
516 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") \
517 __ASM_CFI(".cfi_rel_offset %ebp,0\n\t") \
518 "movl %esp, %ebp\n\t" \
519 __ASM_CFI(".cfi_def_cfa_register %ebp\n\t") \
520 "subl $68, %esp\n\t"
\
521 "fstpl 8(%esp)\n\t" \
525 "movl $2, %ecx\n\t"
\
529 "and $0x4500, %ax\n\t" \
530 "cmp $0x4100, %ax\n\t" \
532 "fstpl (%esp,%ecx,8)\n\t" \
537 "movl %ecx, -4(%ebp)\n\t" \
538 "call " __ASM_NAME( #call ) "\n\t" \
539 "movl -4(%ebp), %ecx\n\t" \
540 "fstpl 8(%esp)\n\t"
\
543 "fldl (%esp,%ecx,8)\n\t" \
544 "cmpl $1, %ecx\n\t" \
547 __ASM_CFI(".cfi_def_cfa %esp,4\n\t") \
548 __ASM_CFI(".cfi_same_value %ebp\n\t") \
570 __ASM_CFI(
".cfi_adjust_cfa_offset 4\n\t")
572 "movl %esp, %ebp\n\t"
573 __ASM_CFI(
".cfi_def_cfa_register %ebp\n\t")
576 "mov (%esp), %ax\n\t"
578 "mov %ax, 2(%esp)\n\t"
582 "movl 4(%esp), %eax\n\t"
583 "movl 8(%esp), %edx\n\t"
598 int e =
u.i >> 52 & 0x7ff;
674 return n >= 0 ?
n : -
n;
682 return n >= 0 ?
n : -
n;
691 return n >= 0 ?
n : -
n;
701 return n >= 0 ?
n : -
n;
709#pragma function(_abs64)
713 return n >= 0 ?
n : -
n;
716#if defined(__i386__) || defined(__x86_64__)
718#define get_mxcsr() _mm_getcsr()
719#define set_mxcsr(val) _mm_setcsr(val)
721static unsigned int get_mxcsr(
void)
725 extern NTSTATUS (*__os_arm64x_get_x64_information)(
ULONG,
void*,
void*);
726 __os_arm64x_get_x64_information( 0, &
ret,
NULL );
728 __asm__ __volatile__(
"stmxcsr %0" :
"=m" (
ret) );
733static void set_mxcsr(
unsigned int val )
737 __os_arm64x_set_x64_information( 0,
val,
NULL );
739 __asm__ __volatile__(
"ldmxcsr %0" : :
"m" (
val) );
747static void _setfp_sse(
unsigned int *cw,
unsigned int cw_mask,
748 unsigned int *sw,
unsigned int sw_mask )
750#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
751 unsigned int old_fpword, fpword = get_mxcsr();
769 *sw = (
flags & ~sw_mask) | (*sw & sw_mask);
770 TRACE(
"sse2 update sw %08x to %08x\n",
flags, *sw);
790 switch (fpword & 0x6000)
796 switch (fpword & 0x8040)
803 *cw = (
flags & ~cw_mask) | (*cw & cw_mask);
804 TRACE(
"sse2 update cw %08x to %08x\n",
flags, *cw);
815 case _RC_UP: fpword |= 0x4000;
break;
816 case _RC_DOWN: fpword |= 0x2000;
break;
826 if (fpword != old_fpword && !sw)
828 TRACE(
"sse2 clear status word\n");
833 if (fpword != old_fpword) set_mxcsr( fpword );
835 FIXME(
"not implemented\n");
842static void _setfp(
unsigned int *cw,
unsigned int cw_mask,
843 unsigned int *sw,
unsigned int sw_mask )
845#if (defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)) && defined(__i386__)
846 unsigned long oldcw = 0, newcw = 0;
847 unsigned long oldsw = 0, newsw = 0;
856 __asm { fstsw newsw }
858 __asm__ __volatile__(
"fstsw %0" :
"=m" (newsw) );
870 *sw = (
flags & ~sw_mask) | (*sw & sw_mask);
871 TRACE(
"x86 update sw %08x to %08x\n",
flags, *sw);
885 __asm { fstcw newcw }
887 __asm__ __volatile__(
"fstcw %0" :
"=m" (newcw) );
898 switch (newcw & 0xc00)
904 switch (newcw & 0x300)
912 *cw = (
flags & ~cw_mask) | (*cw & cw_mask);
913 TRACE(
"x86 update cw %08x to %08x\n",
flags, *cw);
924 case _RC_UP: newcw |= 0x800;
break;
925 case _RC_DOWN: newcw |= 0x400;
break;
929 case _PC_64: newcw |= 0x300;
break;
930 case _PC_53: newcw |= 0x200;
break;
931 case _PC_24: newcw |= 0x0;
break;
936 if (oldsw != newsw && (newsw & 0x3f))
945 DWORD instruction_pointer;
956 __asm { fnstenv fenv }
958 __asm__ __volatile__(
"fnstenv %0" :
"=m" (fenv) );
960 fenv.control_word = newcw;
961 fenv.status_word = newsw;
963 __asm { fldenv fenv }
965 __asm__ __volatile__(
"fldenv %0" : :
"m" (fenv) :
"st",
"st(1)",
966 "st(2)",
"st(3)",
"st(4)",
"st(5)",
"st(6)",
"st(7)" );
975 __asm__ __volatile__(
"fnclex" );
979 __asm { fldcw newcw }
981 __asm__ __volatile__(
"fldcw %0" : :
"m" (newcw) );
983#elif defined(__x86_64__)
984 _setfp_sse(cw, cw_mask, sw, sw_mask);
985#elif defined(__aarch64__)
986 ULONG_PTR old_fpsr = 0, fpsr = 0, old_fpcr = 0, fpcr = 0;
994 __asm__ __volatile__(
"mrs %0, fpsr" :
"=r" (fpsr) );
1005 *sw = (
flags & ~sw_mask) | (*sw & sw_mask);
1006 TRACE(
"aarch64 update sw %08x to %08x\n",
flags, *sw);
1019 __asm__ __volatile__(
"mrs %0, fpcr" :
"=r" (fpcr) );
1029 switch (fpcr & 0xc00000)
1036 *cw = (
flags & ~cw_mask) | (*cw & cw_mask);
1037 TRACE(
"aarch64 update cw %08x to %08x\n",
flags, *cw);
1038 fpcr &= ~0xc09f00ul;
1047 case _RC_CHOP: fpcr |= 0xc00000;
break;
1048 case _RC_UP: fpcr |= 0x400000;
break;
1049 case _RC_DOWN: fpcr |= 0x800000;
break;
1054 if (old_fpcr != fpcr && ~(old_fpcr >> 8) & fpsr & 0x9f != fpsr & 0x9f)
1057 __asm__ __volatile__(
"msr fpcr, %0" ::
"r" (
mask) );
1060 if (old_fpsr != fpsr)
1061 __asm__ __volatile__(
"msr fpsr, %0" ::
"r" (fpsr) );
1062 if (old_fpcr != fpcr)
1063 __asm__ __volatile__(
"msr fpcr, %0" ::
"r" (fpcr) );
1064#elif defined(__arm__)
1065 DWORD old_fpscr, fpscr;
1068 __asm__ __volatile__(
"vmrs %0, fpscr" :
"=r" (fpscr) );
1084 *sw = (
flags & ~sw_mask) | (*sw & sw_mask);
1085 TRACE(
"arm update sw %08x to %08x\n",
flags, *sw);
1105 switch (fpscr & 0xc00000)
1112 *cw = (
flags & ~cw_mask) | (*cw & cw_mask);
1113 TRACE(
"arm update cw %08x to %08x\n",
flags, *cw);
1114 fpscr &= ~0xc09f00ul;
1123 case _RC_CHOP: fpscr |= 0xc00000;
break;
1124 case _RC_UP: fpscr |= 0x400000;
break;
1125 case _RC_DOWN: fpscr |= 0x800000;
break;
1129 if (old_fpscr != fpscr)
1130 __asm__ __volatile__(
"vmsr fpscr, %0" ::
"r" (fpscr) );
1132 FIXME(
"not implemented\n");
1141#if defined(__i386__)
1142void CDECL _statusfp2(
unsigned int *x86_sw,
unsigned int *sse2_sw )
1146 if (!sse2_sw)
return;
1148 _setfp_sse(
NULL, 0, sse2_sw, 0);
1158 unsigned int flags = 0;
1159#if defined(__i386__)
1160 unsigned int x86_sw, sse2_sw;
1162 _statusfp2( &x86_sw, &sse2_sw );
1164 flags = x86_sw | sse2_sw;
1176 unsigned int flags = 0;
1181 unsigned int sse_sw = 0;
1240int CDECL __control87_2(
unsigned int newval,
unsigned int mask,
1241 unsigned int *x86_cw,
unsigned int *sse2_cw )
1249 if (!sse2_cw)
return 1;
1254 _setfp_sse(sse2_cw,
mask,
NULL, 0);
1267 unsigned int flags = 0;
1268#if defined(__i386__) && (_MSVCR_VER == 0 || _MSVCR_VER >= 80)
1269 unsigned int sse2_cw;
1271 __control87_2( newval,
mask, &
flags, &sse2_cw );
1320#if _MSVCR_VER >= 140 && (defined(__i386__) || defined(__x86_64__))
1323 FENV_X_INVALID = 0x00100010,
1324 FENV_X_DENORMAL = 0x00200020,
1325 FENV_X_ZERODIVIDE = 0x00080008,
1326 FENV_X_OVERFLOW = 0x00040004,
1327 FENV_X_UNDERFLOW = 0x00020002,
1328 FENV_X_INEXACT = 0x00010001,
1329 FENV_X_AFFINE = 0x00004000,
1330 FENV_X_UP = 0x00800200,
1331 FENV_X_DOWN = 0x00400100,
1332 FENV_X_24 = 0x00002000,
1333 FENV_X_53 = 0x00001000,
1334 FENV_Y_INVALID = 0x10000010,
1335 FENV_Y_DENORMAL = 0x20000020,
1336 FENV_Y_ZERODIVIDE = 0x08000008,
1337 FENV_Y_OVERFLOW = 0x04000004,
1338 FENV_Y_UNDERFLOW = 0x02000002,
1339 FENV_Y_INEXACT = 0x01000001,
1340 FENV_Y_UP = 0x80000200,
1341 FENV_Y_DOWN = 0x40000100,
1342 FENV_Y_FLUSH = 0x00000400,
1343 FENV_Y_FLUSH_SAVE = 0x00000800
1378 if(
x ||
y)
FIXME(
"unsupported flags: %x, %x\n",
x,
y);
1386 if ((enc & FENV_X_INVALID) == FENV_X_INVALID) *
x |=
_EM_INVALID;
1387 if ((enc & FENV_X_DENORMAL) == FENV_X_DENORMAL) *
x |=
_EM_DENORMAL;
1388 if ((enc & FENV_X_ZERODIVIDE) == FENV_X_ZERODIVIDE) *
x |=
_EM_ZERODIVIDE;
1389 if ((enc & FENV_X_OVERFLOW) == FENV_X_OVERFLOW) *
x |=
_EM_OVERFLOW;
1390 if ((enc & FENV_X_UNDERFLOW) == FENV_X_UNDERFLOW) *
x |=
_EM_UNDERFLOW;
1391 if ((enc & FENV_X_INEXACT) == FENV_X_INEXACT) *
x |=
_EM_INEXACT;
1392 if ((enc & FENV_X_AFFINE) == FENV_X_AFFINE) *
x |=
_IC_AFFINE;
1393 if ((enc & FENV_X_UP) == FENV_X_UP) *
x |=
_RC_UP;
1394 if ((enc & FENV_X_DOWN) == FENV_X_DOWN) *
x |=
_RC_DOWN;
1395 if ((enc & FENV_X_24) == FENV_X_24) *
x |=
_PC_24;
1396 if ((enc & FENV_X_53) == FENV_X_53) *
x |=
_PC_53;
1398 if ((enc & FENV_Y_INVALID) == FENV_Y_INVALID) *
y |=
_EM_INVALID;
1399 if ((enc & FENV_Y_DENORMAL) == FENV_Y_DENORMAL) *
y |=
_EM_DENORMAL;
1400 if ((enc & FENV_Y_ZERODIVIDE) == FENV_Y_ZERODIVIDE) *
y |=
_EM_ZERODIVIDE;
1401 if ((enc & FENV_Y_OVERFLOW) == FENV_Y_OVERFLOW) *
y |=
_EM_OVERFLOW;
1402 if ((enc & FENV_Y_UNDERFLOW) == FENV_Y_UNDERFLOW) *
y |=
_EM_UNDERFLOW;
1403 if ((enc & FENV_Y_INEXACT) == FENV_Y_INEXACT) *
y |=
_EM_INEXACT;
1404 if ((enc & FENV_Y_UP) == FENV_Y_UP) *
y |=
_RC_UP;
1405 if ((enc & FENV_Y_DOWN) == FENV_Y_DOWN) *
y |=
_RC_DOWN;
1406 if ((enc & FENV_Y_FLUSH) == FENV_Y_FLUSH) *
y |=
_DN_FLUSH;
1411 WARN(
"can't decode: %lx\n", enc);
1416#elif _MSVCR_VER >= 120
1420 y = (
y & ~_EM_DENORMAL) | 0x20;
1441#if _MSVCR_VER>=140 && defined(__i386__)
1442 unsigned int x87,
sse;
1443 __control87_2(0, 0, &x87, &
sse);
1445 _statusfp2(&x87, &
sse);
1447#elif _MSVCR_VER>=140
1465 set._Fe_ctl =
env->_Fe_ctl;
1466 set._Fe_stat |=
env->_Fe_stat;
1490 env._Fe_stat &= ~fenv_encode(excepts, excepts);
1526#if _MSVCR_VER>=140 && defined(__i386__)
1527 unsigned int x87,
sse;
1528 _statusfp2(&x87, &
sse);
1585 return (
u.i & ~0ull >> 1) < 0x7ffull << 52;
1593#if (defined(__GNUC__) || defined(__clang__)) && defined(__i386__)
1594 const unsigned int x86_cw = 0x27f;
1595 __asm__ __volatile__(
"fninit; fldcw %0" : :
"m" (x86_cw) );
1598 unsigned int cw =
_MCW_EM, sw = 0;
1599 _setfp_sse(&cw, ~0, &sw, ~0);
1602 unsigned int cw =
_MCW_EM, sw = 0;
1603 _setfp(&cw, ~0, &sw, ~0);
1623 unsigned int x87_cw, cw, x87_stat,
stat;
1628 if (!
env->_Fe_ctl && !
env->_Fe_stat) {
1633 if (!fenv_decode(
env->_Fe_ctl, &x87_cw, &cw))
1635 if (!fenv_decode(
env->_Fe_stat, &x87_stat, &
stat))
1638#if _MSVCR_VER >= 140
1663 return (
u.i & ~0ull >> 1) > 0x7ffull << 52;
1671double CDECL MSVCRT_rint(
double x)
1692 BOOL update_cw, update_sw;
1693 unsigned int cw, sw;
1704 if (update_cw || update_sw)
1721 BOOL update_cw, update_sw;
1722 unsigned int cw, sw;
1733 if (update_cw || update_sw)
1756 if (!
data->efcvt_buffer)
1761 if( prec < 1) prec = 2;
1764 if (
data->efcvt_buffer[0] ==
'-') {
1773 data->efcvt_buffer[ prec] =
'\0';
1778 if(
data->efcvt_buffer[0] ==
'0')
1782 if(
data->efcvt_buffer[ 0] >=
'5')
1784 data->efcvt_buffer[ 0] =
'\0';
1786 TRACE(
"out=\"%s\"\n",
data->efcvt_buffer);
1787 return data->efcvt_buffer;
1806 if( prec < 1) prec = 2;
1843 int stop, dec1, dec2;
1844 char *ptr1, *ptr2, *
first;
1846 char decimal_separator =
get_locinfo()->lconv->decimal_point[0];
1848 if (!
data->efcvt_buffer)
1853 ptr2 =
data->efcvt_buffer;
1865 if (number < 1.0 && number > 0.0) {
1867 if (-dec2 <=
ndigits) dec2 = 0;
1876 while (*ptr1 ==
'0') ptr1++;
1877 while (*ptr1 !=
'\0' && *ptr1 != decimal_separator) {
1879 if ((ptr1 -
buf) < stop) {
1890 while (*ptr1 ==
'0') {
1895 while (*ptr1 !=
'\0') {
1914 *
decpt = dec2 ? dec2 : dec1;
1923 int stop, dec1, dec2;
1924 char *ptr1, *ptr2, *
first;
1926 char decimal_separator =
get_locinfo()->lconv->decimal_point[0];
1948 if (number < 1.0 && number > 0.0) {
1950 if (-dec2 <=
ndigits) dec2 = 0;
1959 while (*ptr1 ==
'0') ptr1++;
1960 while (*ptr1 !=
'\0' && *ptr1 != decimal_separator) {
1962 if ((ptr1 -
buf) < stop) {
1976 while (*ptr1 ==
'0') {
1985 while (*ptr1 !=
'\0') {
2001 *
decpt = dec2 ? dec2 : dec1;
2036 if( digits<0 || digits>=
size) {
2071 ret.div.quot =
num / denom;
2072 ret.div.rem =
num % denom;
2105 ret.ldiv.quot =
num / denom;
2106 ret.ldiv.rem =
num % denom;
2147int MSVCRT__adjust_fdiv = 0;
2158 TRACE(
"(): stub\n");
2170 TRACE(
"(): stub\n");
2182 TRACE(
"(): stub\n");
2194 TRACE(
"(): stub\n");
2208 TRACE(
"(): stub\n");
2220 TRACE(
"(): stub\n");
2232 TRACE(
"(): stub\n");
2244 TRACE(
"(): stub\n");
2256 TRACE(
"(): stub\n");
2270 TRACE(
"(): stub\n");
2284 TRACE(
"(): stub\n");
2298 TRACE(
"(): stub\n");
2312 TRACE(
"(): stub\n");
2326 TRACE(
"(): stub\n");
2340 TRACE(
"(): stub\n");
2354 TRACE(
"(): stub\n");
2369 TRACE(
"(): stub\n");
2379 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2381 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2390 __asm__ __volatile__(
"movd %%xmm0,%0" :
"=g" (
f) );
2392 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f) );
2401 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2403 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2412 __asm__ __volatile__(
"movd %%xmm0,%0" :
"=g" (
f) );
2414 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f) );
2423 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2425 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2434 __asm__ __volatile__(
"movq %%xmm0,%0; movq %%xmm1,%1 " :
"=m" (d1),
"=m" (d2) );
2435 d1 =
atan2( d1, d2 );
2436 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (d1) );
2445 __asm__ __volatile__(
"movd %%xmm0,%0" :
"=g" (
f) );
2447 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f) );
2456 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2458 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2467 __asm__ __volatile__(
"movd %%xmm0,%0" :
"=g" (
f) );
2469 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f) );
2478 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2480 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2489 __asm__ __volatile__(
"movd %%xmm0,%0" :
"=g" (
f) );
2491 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f) );
2500 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2502 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2511 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2513 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2522 __asm__ __volatile__(
"movd %%xmm0,%0" :
"=g" (
f) );
2524 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f) );
2533 __asm__ __volatile__(
"movd %%xmm0,%0" :
"=g" (
f) );
2535 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f) );
2544 __asm__ __volatile__(
"movq %%xmm0,%0; movq %%xmm1,%1 " :
"=m" (d1),
"=m" (d2) );
2546 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (d1) );
2555 __asm__ __volatile__(
"movd %%xmm0,%0; movd %%xmm1,%1" :
"=g" (
f1),
"=g" (
f2) );
2557 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f1) );
2566 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2568 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2577 __asm__ __volatile__(
"movd %%xmm0,%0" :
"=g" (
f) );
2579 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f) );
2588 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2590 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2599 __asm__ __volatile__(
"movd %%xmm0,%0" :
"=g" (
f) );
2601 __asm__ __volatile__(
"movd %0,%%xmm0" : :
"g" (
f) );
2607void __cdecl __libm_sse2_sqrt_precise(
void)
2612 __asm__ __volatile__(
"movq %%xmm0,%0" :
"=m" (
d) );
2613 __control87_2(0, 0,
NULL, &cw);
2617 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2623 __asm__ __volatile__(
"movq %0,%%xmm0" : :
"m" (
d) );
2626 __asm__ __volatile__(
"sqrtsd %xmm0, %xmm0" );
2674 || (
d >= 0 &&
d != (
double)(
unsigned __int64)
d)) {
2690 || (
f >= 0 &&
f != (
float)(
unsigned __int64)
f)) {
2779 return (
u.i >> 16) & 0x8000;
2788 return (
u.i >> 48) & 0x8000;
2799 if(
x ==
y)
return 2;
2800 return x <
y ? 1 : 4;
2814double CDECL MSVCRT_acosh(
double x)
2828float CDECL MSVCRT_acoshf(
float x)
2842double CDECL MSVCRT_atanh(
double x)
2856float CDECL MSVCRT_atanhf(
float x)
2889#if _MSVCR_VER == 120
2894double CDECL MSVCRT_remainder(
double x,
double y)
2905float CDECL MSVCRT_remainderf(
float x,
float y)
2927 unsigned int fpword = 0;
2931 TRACE(
"(%lx %x %lf %lf %lx %p)\n", fpe,
op,
arg,
res, cw, unk);
2934 cw = ((cw >> 7) & 0x3f) | ((cw >> 3) & 0xc00);
2940 if ((fpe == 0x1 && (cw & 0x8)) || (fpe==0x11 && (cw & 0x28))) {
2948 }
else if (fpe & 0x2) {
2949 if ((fpe == 0x2 && (cw & 0x10)) || (fpe==0x12 && (cw & 0x30))) {
2956 }
else if (fpe & 0x4) {
2957 if ((fpe == 0x4 && (cw & 0x4)) || (fpe==0x14 && (cw & 0x24))) {
2963 }
else if (fpe & 0x8) {
2964 if (fpe == 0x8 && (cw & 0x1)) {
2969 }
else if (fpe & 0x10) {
2970 if (fpe == 0x10 && (cw & 0x20)) {
2992 case 0x800: fpword |=
_RC_UP;
break;
2993 case 0x400: fpword |=
_RC_DOWN;
break;
2997 case 0x0: fpword |=
_PC_24;
break;
2998 case 0x200: fpword |=
_PC_53;
break;
2999 case 0x300: fpword |=
_PC_64;
break;
unsigned long long UINT64
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
double CDECL _CIsinh(void)
double CDECL _CIatan(void)
double CDECL _CIatan2(void)
double CDECL _CIasin(void)
double CDECL _CIfmod(void)
double CDECL _CItanh(void)
double CDECL _CIcosh(void)
double CDECL _CIacos(void)
double CDECL _CIlog10(void)
double CDECL _CIexp(void)
double CDECL _CItan(void)
double CDECL _CIcos(void)
double CDECL _CIlog(void)
double CDECL _CIpow(void)
double CDECL _CIsin(void)
double CDECL _CIsqrt(void)
_Check_return_ _ACRTIMP int __cdecl _fdsign(_In_ float _X)
_Check_return_ _ACRTIMP int __cdecl _dpcomp(_In_ double _X, _In_ double _Y)
_Check_return_ _ACRTIMP int __cdecl _fdpcomp(_In_ float _X, _In_ float _Y)
_Check_return_ _ACRTIMP int __cdecl _dsign(_In_ double _X)
static LPCWSTR LPCWSTR LPCWSTR env
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
BOOL WINAPI IsProcessorFeaturePresent(IN DWORD ProcessorFeature)
unsigned long __msvcrt_ulong
_ACRTIMP int __cdecl fesetenv(const fenv_t *)
_ACRTIMP int __cdecl fesetexceptflag(const fexcept_t *, int)
_ACRTIMP int __cdecl fegetround(void)
_ACRTIMP int __cdecl fegetenv(fenv_t *)
_ACRTIMP int __cdecl fegetexceptflag(fexcept_t *, int)
_ACRTIMP int __cdecl feclearexcept(int)
_ACRTIMP int __cdecl fesetround(int)
_ACRTIMP int __cdecl fetestexcept(int)
_ACRTIMP int __cdecl feholdexcept(fenv_t *)
#define _DN_SAVE_OPERANDS_FLUSH_RESULTS
_ACRTIMP int __cdecl __fpe_flt_rounds(void)
#define _DN_FLUSH_OPERANDS_SAVE_RESULTS
_ACRTIMP float __cdecl asinf(float)
_ACRTIMP float __cdecl atanf(float)
_ACRTIMP __int64 __cdecl llrint(double)
_ACRTIMP float __cdecl powf(float, float)
_ACRTIMP double __cdecl scalbn(double, int)
_ACRTIMP double __cdecl cosh(double)
_ACRTIMP double __cdecl sqrt(double)
_ACRTIMP double __cdecl sinh(double)
_ACRTIMP double __cdecl fabs(double)
_ACRTIMP double __cdecl tanh(double)
_ACRTIMP float __cdecl acosf(float)
_ACRTIMP double __cdecl atan(double)
_ACRTIMP __msvcrt_long __cdecl lrint(double)
_ACRTIMP __int64 __cdecl llrintf(float)
_ACRTIMP float __cdecl rintf(float)
_ACRTIMP __msvcrt_long __cdecl lround(double)
_ACRTIMP double __cdecl sin(double)
_ACRTIMP __int64 __cdecl llroundf(float)
_ACRTIMP float __cdecl cosf(float)
_ACRTIMP float __cdecl nearbyintf(float)
_ACRTIMP float __cdecl sinf(float)
_ACRTIMP short __cdecl _fdtest(float *)
_ACRTIMP __int64 __cdecl llround(double)
_ACRTIMP float __cdecl remainderf(float, float)
_ACRTIMP double __cdecl tan(double)
_ACRTIMP double __cdecl fmod(double, double)
_ACRTIMP float __cdecl logf(float)
_ACRTIMP float __cdecl tanhf(float)
_ACRTIMP double __cdecl remainder(double, double)
_ACRTIMP float __cdecl log10f(float)
_ACRTIMP short __cdecl _dtest(double *)
_ACRTIMP double __cdecl asin(double)
_ACRTIMP double __cdecl nearbyint(double)
_ACRTIMP float __cdecl roundf(float)
_ACRTIMP float __cdecl tanf(float)
_ACRTIMP float __cdecl atanhf(float)
_ACRTIMP double __cdecl cos(double)
_ACRTIMP __msvcrt_long __cdecl lroundf(float)
_ACRTIMP double __cdecl atan2(double, double)
_ACRTIMP __msvcrt_long __cdecl lrintf(float)
_ACRTIMP double __cdecl acos(double)
_ACRTIMP float __cdecl expf(float)
_ACRTIMP double __cdecl rint(double)
_ACRTIMP float __cdecl acoshf(float)
_ACRTIMP int __cdecl _scprintf(const char *,...) __WINE_CRT_PRINTF_ATTR(1
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf(const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
_ACRTIMP lldiv_t __cdecl lldiv(__int64, __int64)
_ACRTIMP __int64 __cdecl llabs(__int64)
int(CDECL * MSVCRT_matherr_func)(struct _exception *)
int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask)
char *CDECL _gcvt(double number, int ndigit, char *buff)
unsigned __int64 CDECL MSVCRT__rotr64(unsigned __int64 num, int shift)
__msvcrt_ulong CDECL MSVCRT__lrotr(__msvcrt_ulong num, int shift)
__msvcrt_ulong CDECL MSVCRT__lrotl(__msvcrt_ulong num, int shift)
static BOOL sqrtf_validate(float *x)
void CDECL _set_controlfp(unsigned int newval, unsigned int mask)
unsigned int CDECL _statusfp(void)
float CDECL _chgsignf(float num)
void CDECL __setusermatherr(MSVCRT_matherr_func func)
double CDECL MSVCRT_asin(double x)
int CDECL _fpclassf(float num)
short CDECL _fdclass(float x)
int CDECL _matherr(struct _exception *e)
double CDECL MSVCRT_atan(double x)
double CDECL MSVCRT_tanh(double x)
int CDECL _finitef(float num)
int *CDECL __fpecode(void)
double CDECL MSVCRT_exp(double x)
double CDECL _scalb(double num, __msvcrt_long power)
double CDECL _chgsign(double num)
unsigned int CDECL _clearfp(void)
static MSVCRT_matherr_func MSVCRT_default_matherr_func
static void _setfp(unsigned int *cw, unsigned int cw_mask, unsigned int *sw, unsigned int sw_mask)
div_t CDECL div(int num, int denom)
static BOOL sqrt_validate(double *x, BOOL update_sw)
int CDECL _finite(double num)
int CDECL _isnanf(float num)
void CDECL _fpreset(void)
int CDECL _isnan(double num)
double CDECL _cabs(struct _complex num)
float CDECL MSVCRT_atanf(float x)
unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask)
__int64 CDECL _abs64(__int64 n)
static double ret_nan(BOOL update_sw)
ldiv_t CDECL ldiv(__msvcrt_long num, __msvcrt_long denom)
unsigned int CDECL _control87(unsigned int newval, unsigned int mask)
int CDECL _ecvt_s(char *buffer, size_t length, double number, int ndigits, int *decpt, int *sign)
char *CDECL _ecvt(double number, int ndigits, int *decpt, int *sign)
unsigned int CDECL MSVCRT__rotr(unsigned int num, int shift)
unsigned __int64 CDECL MSVCRT__rotl64(unsigned __int64 num, int shift)
double CDECL MSVCRT_sqrt(double x)
float CDECL MSVCRT_tanhf(float x)
char *CDECL _fcvt(double number, int ndigits, int *decpt, int *sign)
short CDECL _dclass(double x)
unsigned int CDECL MSVCRT__rotl(unsigned int num, int shift)
double CDECL ldexp(double num, int exp)
__msvcrt_long CDECL labs(__msvcrt_long n)
int CDECL _gcvt_s(char *buff, size_t size, double number, int digits)
int CDECL _fcvt_s(char *outbuffer, size_t size, double number, int ndigits, int *decpt, int *sign)
double math_error(int type, const char *name, double arg1, double arg2, double retval)
float CDECL MSVCRT_sqrtf(float x)
int CDECL _fpclass(double num)
float CDECL _scalbf(float num, __msvcrt_long power)
int CDECL _set_SSE2_enable(int flag)
thread_data_t *CDECL msvcrt_get_thread_data(void)
#define MSVCRT_CHECK_PMT(x)
#define MSVCRT_CHECK_PMT_ERR(x, err)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
static unsigned char buff[32768]
void __stdcall _adj_fdivr_m32(unsigned int arg)
void __stdcall _adj_fdiv_m32i(int arg)
void __stdcall _adj_fdiv_m32(unsigned int arg)
void __stdcall _adj_fdivr_m16i(short arg)
void __stdcall _adj_fdivr_m64(unsigned __int64 arg)
void __stdcall _adj_fdivr_m32i(int arg)
void __stdcall _adj_fdiv_m16i(short arg)
void __stdcall _adj_fdiv_m64(unsigned __int64 arg)
int __cdecl _set_FMA3_enable(int flag)
double pow(double x, double y)
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei GLenum type
GLint GLint GLint GLint GLint GLint y
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLuint GLuint GLuint GLuint arg1
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
static const int digits[]
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_cosf(__m128 Xmm0)
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_log10f(__m128 Xmm0)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_atan(__m128d Xmm0)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_acos(__m128d Xmm0)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_asin(__m128d Xmm0)
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_asinf(__m128 Xmm0)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_cos(__m128d Xmm0)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_pow(__m128d Xmm0, __m128d Xmm1)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_tan(__m128d Xmm0)
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_atanf(__m128 Xmm0)
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_sinf(__m128 Xmm0)
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_expf(__m128 Xmm0)
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_logf(__m128 Xmm0)
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_powf(__m128 Xmm0, __m128 Xmm1)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_atan2(__m128d Xmm0, __m128d Xmm1)
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_acosf(__m128 Xmm0)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_exp(__m128d Xmm0)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_log(__m128d Xmm0)
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_tanf(__m128 Xmm0)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_log10(__m128d Xmm0)
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_sin(__m128d Xmm0)
#define EXCEPTION_FLT_UNDERFLOW
#define EXCEPTION_FLT_OVERFLOW
#define EXCEPTION_FLT_INEXACT_RESULT
#define EXCEPTION_FLT_INVALID_OPERATION
#define EXCEPTION_FLT_DIVIDE_BY_ZERO
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
static unsigned int number
void msvcrt_init_math(void)
static size_t double int ndigits
static size_t double int int * decpt
static unsigned long fenv_encode(unsigned int e)
#define __ASM_GLOBAL_FUNC(name, code)
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
int __cdecl feraiseexcept(int excepts)
int __cdecl feupdateenv(const fenv_t *)
intmax_t __cdecl imaxabs(intmax_t j)
_ACRTIMP _Dcomplex __cdecl _Cbuild(_In_ double _Re, _In_ double _Im)
#define PF_XMMI64_INSTRUCTIONS_AVAILABLE
#define __ATTRIBUTE_SSE__