Commit Graph

107 Commits

Author SHA1 Message Date
mrg
4773cc203b avoid a GCC warning with this:
+#if defined(__GNUC__) && (__GNUC__ >= 5) && defined(__OPTIMIZE__)
+       x.fp_sign = 0;
+#endif

(ridiculous, but seems better than disabling the warning entirely.)
2016-03-23 05:25:51 +00:00
isaki
f4c31ffb3e For the extended precision, the MSB of the mantissa is an integer
part, and this bit must be ignored at Infinity.
found by tests/lib/libc/stdlib/t_strtod.c::strtold_inf.
2015-02-05 12:23:27 +00:00
isaki
cbb3de29ae Fix typo in comment. pointed out by Y.Sugahara. 2015-02-05 12:22:06 +00:00
isaki
9050bf24ca FLOGNP1(-0.0) is -0.0, not +0.0. Found by XM6i. 2014-01-04 13:23:22 +00:00
isaki
2b1afc88b6 indent fix in a comment. 2014-01-01 05:23:40 +00:00
isaki
3eedc36da9 Fix a sign when a source or destination is either (plus/minus)zero
or (plus/minus)infinity.  Found by XM6i.
2014-01-01 05:22:22 +00:00
martin
0fad0c7d31 Comment unused stuff (for documentation purposes) 2013-10-25 21:32:45 +00:00
isaki
0d986a3507 FATANH(-0) is -0, not +0.
This bug was introduced by the mistake of my test program.
Last week, I talked about the probelm (my FATANH(-0) returns +0 ?)
by NetBSD seminar at Open Source Conference 2013 Hiroshima,
and tsutsui@ confirmed that returns -0.
2013-10-11 03:37:08 +00:00
isaki
f01440c2cd Revise the algorithm after Step3.
almost written by Y.Sugahara and minor modify by me.
This works for all input of FMOD/FREM and of course solves PR/47810.
2013-05-11 12:52:42 +00:00
isaki
388a353677 R := X even if L < 0 in Step2, according to algorithm of the comment.
This solves many cases of |X| < |Y|.
2013-05-05 13:25:20 +00:00
isaki
283cf893ef Rename modrem -> is_mod for a readability. 2013-05-05 13:17:15 +00:00
isaki
77f57d5580 M68010 -> __mc68010__, pointed out by tsutsui@ 2013-04-21 02:50:48 +00:00
isaki
2cb1fdf4a5 Rewrite around BFFFO inline asm.
o Prepare C version of BFFFO (from XM6i).
  It is helpful in running FPE on other platforms (for example, for a
  test).  It is also helpful in porting to non-m68k 3rd party :)
o A BFFFO is supported on 68020 or later (though I'm not sure whether
  sun2/68010 uses this FPE correctly or not).
2013-04-20 09:32:28 +00:00
isaki
70153dd489 Support sinh(-0.0) and tanh(-0.0). 2013-04-20 07:33:05 +00:00
isaki
0cee51ef54 Support sin(-0.0). 2013-04-20 07:32:45 +00:00
isaki
adcd4b71b5 Clean up some useless codes. 2013-04-20 05:27:05 +00:00
isaki
1db93fc92a Support tan(-0.0). 2013-04-20 05:09:41 +00:00
isaki
956d42b4aa Fix typo in comment. 2013-04-20 04:55:44 +00:00
isaki
026814fd27 Terminate a loop in EXT_FRACBITS(64bits) instead of FP_NMANT(83bits).
I don't know why the mantissa of the accumulator is 83bits, but 64bits
or more are not affected.
2013-04-20 04:54:22 +00:00
isaki
5d5a7da8b2 Break a loop off to avoid a long loop even if the precision is not enough. 2013-04-20 04:38:51 +00:00
isaki
c5ad1dc3ef Update a list of implement/unimplement functions. 2013-04-20 03:26:11 +00:00
isaki
ea6e6f37fa Implement exponential and power functions.
o FETOX   .. exp(x)
o FETOXM1 .. exp(x) - 1
o FTENTOX .. 10^x
o FTWOTOX .. 2^x
At last all mathematics functions of FPE were implemented.
Thanks to Yosuke Sugahara.
2013-04-20 03:06:19 +00:00
isaki
0f49abface s/tayler/taylor/. pointed out by christos@ 2013-04-20 01:48:20 +00:00
isaki
397d02332b Implement a hyperbolic arctangent (FATANH). 2013-04-19 14:05:12 +00:00
isaki
b9e60bfea4 Implement inverse trigonometric functions (i.e., FACOS, FASIN, FATAN
instructions).
o arccos is calculated using arcsin.
o arcsin is calculated using arctan.
o arctan is calculated by the CORDIC.
2013-04-19 13:57:52 +00:00
isaki
b64bbce367 Introduce the CORDIC algorithm.
o sine and cosine (e.g., FSIN, FCOS and FSINCOS instructions) is now
  calculated in the CORDIC instead of Taylor expansion.
o tangent (FTAN) is not touched from a viewpoint of the code size.
o The CORDIC is applicable for hyperbolic functions (e.g., FSINH,
  FCOSH, FTANH instructions), but I didn't use it because its working
  range is poor.
o The CORDIC is also usable for inverse trigonometric functions,
  I will commit it at next phase.
o The code size becomes a bit big.  I cannot evaluate speed on m68k
  for some reasons, but in test on i386 the CORDIC is approximately
  100 times faster in sin/cos.
2013-04-19 13:31:11 +00:00
isaki
cf9a88b6c4 Improve how to use cmp/sub. 2013-04-18 13:40:25 +00:00
isaki
a85a92a0e3 Introduce FPU_CONST_* constants to avoid a magic number. 2013-04-11 13:27:11 +00:00
isaki
c74e131596 quad_t -> uint64_t 2013-04-01 13:59:21 +00:00
isaki
f53c2e8d4b u_int -> uint32_t 2013-03-26 11:30:20 +00:00
isaki
528dcaf553 Fix a wrong "raw" comparison in step3.2.
It should solve a PR kern/47692.
2013-03-26 10:57:13 +00:00
isaki
d183ccf62e Use the #error directive. 2013-03-23 12:08:47 +00:00
isaki
db5a3d6915 Remove about updating fpsr. It was introduced by me but obviously
duplicated with fpu_emul_arith().
2013-03-23 12:06:24 +00:00
isaki
f63adb5419 Fix fpu_ftox().
Update not only exponential but also mantissa when an integer part
becomes 2 by rounding up.  Without this fix, the extended precision
value becomes 0.0 because mantissa (including explicit integer bit)
is all-zero.
2013-03-22 13:46:38 +00:00
isaki
1cd7b13dd0 const-ify. 2013-03-19 09:28:39 +00:00
isaki
81e778a36f Remove 'register'. 2013-03-19 09:17:17 +00:00
isaki
9cdd524924 Rewrite fpu_int().
Especially, remove the special treatment when |x| < 1
because it forgets to consider FPCR round mode.
See PR/46627 for the detail.  Thanks Y.Sugahara for advice.
2012-06-25 04:52:23 +00:00
tsutsui
d2a6937ff8 - remove variable names from function declarations
- some KNF
2011-10-15 15:34:06 +00:00
tsutsui
33298caa65 Update implemented/unimplemented FP functions. 2011-10-15 15:24:28 +00:00
tsutsui
e01bad8769 Add hyperboric and trigonometric functions to m68k FPE, written by isaki@.
With these emulations (~4KB text) xeyes on XM6i works better.
Discussed with isaki@ at OSC 2011 Hiroshima.
2011-10-15 15:14:29 +00:00
tsutsui
bed098ded9 Use static inline structure assignment for CPYFPN(). From isaki@.
Tested on XM6i.
2011-10-09 01:34:19 +00:00
isaki
1e5cdc09c0 fix indent again.
- "Second level indents are four spaces." pointed out by tsutsui@
- fold long line.
2011-07-18 14:11:27 +00:00
isaki
5dbbcf1470 fix indent. no functional changes. 2011-07-18 07:44:30 +00:00
tsutsui
1831386b4e - consistently use #ifdef DEBUG_FPE and #ifdef DIAGNOSTIC
- use DPRINTF() style debug printfs
- use __func__ to print function names
2011-05-25 15:47:19 +00:00
tsutsui
248f85bd79 KNF. No binary change. 2011-05-25 15:17:21 +00:00
tsutsui
a197c7a73f - use DPRINTF() style debug printfs
- use __func__ to print function names
- consistently use #ifdef DEBUG_FPE
- add some missing debug messages including \n in error paths
2011-05-23 15:40:34 +00:00
tsutsui
9e59c87c59 KNF, mostly indent. No binary change. 2011-05-23 14:52:31 +00:00
tsutsui
599eb3007d Fix botch in rev 1.28 that causes wrong results of fcmp and ftst in FPE.
fpu_upd_fpsr() should be called even in discard_result case if an emulated
instruction gets proper result without signal.

Fixes weird behavior of awk(1) seen on /etc/rc.d/postfix on XM6i and
TME emulating sun3 without 68881.

Should be pulled up to all netbsd-4 and netbsd-5 branches.
2011-05-14 16:17:55 +00:00
mrg
bd01b4a30e fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h.  FPSP meantioned
in the PR has already been fixed, and i could not find any more.

i built these kernels to ensure i did not break their builds:

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
2010-06-06 04:50:05 +00:00
dsl
82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00