20 static void rem_kernel(
unsigned long long st0,
unsigned long long *
y,
21 unsigned long long st1,
unsigned long long q,
int n);
23 #define BETTER_THAN_486
33 static int trig_arg(
FPU_REG *st0_ptr,
int even)
66 if ((even && !(q & 1)) || (!even && (q & 1))) {
71 #ifdef BETTER_THAN_486
102 #ifdef BETTER_THAN_486
147 return (q & 3) | even;
151 static void convert_l2reg(
long const *
arg,
int deststnr)
179 static void single_arg_error(
FPU_REG *st0_ptr,
u_char st0_tag)
183 else if (st0_tag ==
TW_NaN)
191 static void single_arg_2_error(
FPU_REG *st0_ptr,
u_char st0_tag)
198 && (st0_ptr->
sigh & 0x80000000);
199 if (isNaN && !(st0_ptr->
sigh & 0x40000000)) {
204 st0_ptr->
sigh |= 0x40000000;
271 single_arg_error(st0_ptr, tag);
285 st_new_ptr = &
st(-1);
299 if ((q = trig_arg(st0_ptr, 0)) == -1) {
305 setsign(st0_ptr, (q & 1) ^ (arg_sign != 0));
344 st_new_ptr = &
st(-1);
351 single_arg_2_error(st0_ptr, st0_tag);
358 register FPU_REG *st1_ptr = st0_ptr;
372 reg_copy(st1_ptr, st_new_ptr);
378 convert_l2reg(&e, 1);
413 }
else if (st0_tag ==
TW_NaN) {
435 static void fdecstp(
void)
441 static void fincstp(
void)
501 single_arg_error(st0_ptr, st0_tag);
546 single_arg_error(st0_ptr, st0_tag);
557 if ((q = trig_arg(st0_ptr, 0)) == -1) {
605 single_arg_error(st0_ptr, tag);
623 0xc90fdaa22168c234LL))) {
630 }
else if ((q = trig_arg(st0_ptr,
FCOS)) != -1) {
675 single_arg_error(st0_ptr, tag);
682 f_cos(st0_ptr, st0_tag);
695 st_new_ptr = &
st(-1);
713 single_arg_2_error(st0_ptr,
TW_NaN);
725 reg_copy(st0_ptr, &arg);
726 if (!fsin(st0_ptr, st0_tag)) {
729 f_cos(&
st(0), st0_tag);
745 static void rem_kernel(
unsigned long long st0,
unsigned long long *
y,
746 unsigned long long st1,
unsigned long long q,
int n)
749 unsigned long long x;
756 asm volatile (
"mull %4; subl %%eax,%0; sbbl %%edx,%1":
"=m"
757 (((
unsigned *)&x)[0]),
"=m"(((
unsigned *)&
x)[1]),
759 :
"2"(((
unsigned *)&st1)[0]),
"m"(((
unsigned *)&q)[0])
762 asm volatile (
"mull %3; subl %%eax,%0":
"=m" (((
unsigned *)&x)[1]),
764 :
"1"(((
unsigned *)&st1)[1]),
"m"(((
unsigned *)&
q)[0])
767 asm volatile (
"mull %3; subl %%eax,%0":
"=m" (((
unsigned *)&x)[1]),
769 :
"1"(((
unsigned *)&st1)[0]),
"m"(((
unsigned *)&
q)[1])
778 static void do_fprem(
FPU_REG *st0_ptr,
u_char st0_tag,
int round)
783 if (!((st0_tag ^
TAG_Valid) | (st1_tag ^ TAG_Valid))) {
785 u_char st0_sign, st1_sign;
791 unsigned short saved_status;
813 u_char sign = st0_sign ^ st1_sign;
831 reg_copy(&st0, &tmp);
836 && (tmp.
sigh & 0xc0000000)) {
839 unsigned long long x;
854 st0_sign = !st0_sign;
881 reg_copy(&st0, &tmp);
883 N = (expdif & 0x0000001f) + 32;
890 sign =
getsign(&tmp) ^ st1_sign;
930 reg_copy(&tmp, st0_ptr);
959 if (((st0_tag == TAG_Valid) && (st1_tag ==
TW_Denormal))
960 || ((st0_tag ==
TW_Denormal) && (st1_tag == TAG_Valid))
969 if (st1_tag == TAG_Valid) {
985 }
else if ((st0_tag == TAG_Valid) || (st0_tag ==
TW_Denormal)) {
989 }
else if (st1_tag !=
TW_NaN) {
1029 if ((st0_tag == TAG_Valid) && (st1_tag == TAG_Valid)) {
1039 if ((st0_ptr->
sigh == 0x80000000)
1040 && (st0_ptr->
sigl == 0)) {
1069 poly_l2(st0_ptr, st1_ptr, sign);
1129 }
else if ((st0_tag ==
TW_NaN) || (st1_tag ==
TW_NaN)) {
1151 else if (((st0_tag == TAG_Valid) || (st0_tag ==
TW_Denormal))
1155 (st0_ptr->
sigh == 0x80000000) &&
1156 (st0_ptr->
sigl == 0)) {
1177 #ifndef PECULIAR_486
1198 if (!((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid))) {
1201 poly_atan(st0_ptr, st0_tag, st1_ptr, st1_tag);
1213 if (((st0_tag == TAG_Valid) && (st1_tag ==
TW_Denormal))
1214 || ((st0_tag ==
TW_Denormal) && (st1_tag == TAG_Valid))
1223 }
else if ((st0_tag ==
TW_NaN) || (st1_tag ==
TW_NaN)) {
1303 do_fprem(st0_ptr, st0_tag,
RC_CHOP);
1308 do_fprem(st0_ptr, st0_tag,
RC_RND);
1318 if (!((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid))) {
1327 if (
poly_l2p1(sign, sign1, &a, &b, st1_ptr))
1339 if (((st0_tag == TAG_Valid) && (st1_tag ==
TW_Denormal))
1340 || ((st0_tag ==
TW_Denormal) && (st1_tag == TAG_Valid))
1379 }
else if ((st0_tag == TAG_Valid) || (st0_tag ==
TW_Denormal)) {
1404 !((st0_ptr->
sigh == 0x80000000) &&
1405 (st0_ptr->
sigl == 0))) {
1428 }
else if (st0_tag ==
TW_NaN) {
1436 #ifndef PECULIAR_486
1488 if (!((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid))) {
1513 reg_copy(st1_ptr, &tmp);
1532 if ((st0_tag == TAG_Valid) || (st0_tag ==
TW_Denormal)) {
1606 }
else if (st0_tag ==
TW_NaN) {
1626 static FUNC_ST0 const trig_table_a[] = {
1627 f2xm1, fyl2x, fptan, fpatan,
1636 static FUNC_ST0 const trig_table_b[] = {
1637 fprem, fyl2xp1, fsqrt_, fsincos, frndint_, fscale, (
FUNC_ST0) fsin, fcos