2009-08-31 Takaki Makino <t@snowelm.com>

* libm/machine/i386/f_pow.c(_f_pow): Alter ASM so it works with
        newer gcc versions.
        * libm/maachine/i386/f_powf.c(_f_powf): Ditto.
This commit is contained in:
Jeff Johnston 2009-08-31 22:12:41 +00:00
parent dd5b8f6c17
commit a9dd632461
3 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2009-08-31 Takaki Makino <t@snowelm.com>
* libm/machine/i386/f_pow.c(_f_pow): Alter ASM so it works with
newer gcc versions.
* libm/maachine/i386/f_powf.c(_f_powf): Ditto.
2009-08-25 Andy Koppe <andy.koppe@gmail.com> 2009-08-25 Andy Koppe <andy.koppe@gmail.com>
* libc/stdlib/sb_charsets.c (__micro_atoi): Allow five-digit codepage * libc/stdlib/sb_charsets.c (__micro_atoi): Allow five-digit codepage

View File

@ -35,9 +35,9 @@ double _f_pow (double x, double y)
/* calculate x ** y as 2 ** (y log2(x)). On Intel, can only /* calculate x ** y as 2 ** (y log2(x)). On Intel, can only
raise 2 to an integer or a small fraction, thus, we have raise 2 to an integer or a small fraction, thus, we have
to perform two steps 2**integer portion * 2**fraction. */ to perform two steps 2**integer portion * 2**fraction. */
asm ("fldl 8(%%ebp); fyl2x; fld %%st; frndint; fsub %%st,%%st(1);" \ asm ("fyl2x; fld %%st; frndint; fsub %%st,%%st(1);"\
"fxch; fchs; f2xm1; fld1; faddp; fxch; fld1; fscale; fstp %%st(1);"\ "fxch; fchs; f2xm1; fld1; faddp; fxch; fld1; fscale; fstp %%st(1);"\
"fmulp" : "=t" (result) : "0" (y)); "fmulp" : "=t" (result) : "0" (x), "u" (y) : "st(1)" );
return result; return result;
} }
else /* all other strange cases, defer to normal pow() */ else /* all other strange cases, defer to normal pow() */

View File

@ -35,9 +35,9 @@ float _f_powf (float x, float y)
/* calculate x ** y as 2 ** (y log2(x)). On Intel, can only /* calculate x ** y as 2 ** (y log2(x)). On Intel, can only
raise 2 to an integer or a small fraction, thus, we have raise 2 to an integer or a small fraction, thus, we have
to perform two steps 2**integer portion * 2**fraction. */ to perform two steps 2**integer portion * 2**fraction. */
asm ("flds 8(%%ebp); fyl2x; fld %%st; frndint; fsub %%st,%%st(1);" \ asm ("fyl2x; fld %%st; frndint; fsub %%st,%%st(1);"\
"fxch; fchs; f2xm1; fld1; faddp; fxch; fld1; fscale; fstp %%st(1);"\ "fxch; fchs; f2xm1; fld1; faddp; fxch; fld1; fscale; fstp %%st(1);"\
"fmulp" : "=t" (result) : "0" (y)); "fmulp" : "=t" (result) : "0" (x), "u" (y) : "st(1)" );
return result; return result;
} }
else /* all other strange cases, defer to normal pow() */ else /* all other strange cases, defer to normal pow() */