xref: /OK3568_Linux_fs/kernel/Documentation/arm/nwfpe/todo.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunTODO LIST
2*4882a593Smuzhiyun=========
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun::
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  POW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - power
7*4882a593Smuzhiyun  RPW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse power
8*4882a593Smuzhiyun  POL{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - polar angle (arctan2)
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun  LOG{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base 10
11*4882a593Smuzhiyun  LGN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base e
12*4882a593Smuzhiyun  EXP{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - exponent
13*4882a593Smuzhiyun  SIN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - sine
14*4882a593Smuzhiyun  COS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - cosine
15*4882a593Smuzhiyun  TAN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - tangent
16*4882a593Smuzhiyun  ASN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arcsine
17*4882a593Smuzhiyun  ACS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arccosine
18*4882a593Smuzhiyun  ATN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arctangent
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunThese are not implemented.  They are not currently issued by the compiler,
21*4882a593Smuzhiyunand are handled by routines in libc.  These are not implemented by the FPA11
22*4882a593Smuzhiyunhardware, but are handled by the floating point support code.  They should
23*4882a593Smuzhiyunbe implemented in future versions.
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunThere are a couple of ways to approach the implementation of these.  One
26*4882a593Smuzhiyunmethod would be to use accurate table methods for these routines.  I have
27*4882a593Smuzhiyuna couple of papers by S. Gal from IBM's research labs in Haifa, Israel that
28*4882a593Smuzhiyunseem to promise extreme accuracy (in the order of 99.8%) and reasonable speed.
29*4882a593SmuzhiyunThese methods are used in GLIBC for some of the transcendental functions.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunAnother approach, which I know little about is CORDIC.  This stands for
32*4882a593SmuzhiyunCoordinate Rotation Digital Computer, and is a method of computing
33*4882a593Smuzhiyuntranscendental functions using mostly shifts and adds and a few
34*4882a593Smuzhiyunmultiplications and divisions.  The ARM excels at shifts and adds,
35*4882a593Smuzhiyunso such a method could be promising, but requires more research to
36*4882a593Smuzhiyundetermine if it is feasible.
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunRounding Methods
39*4882a593Smuzhiyun----------------
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunThe IEEE standard defines 4 rounding modes.  Round to nearest is the
42*4882a593Smuzhiyundefault, but rounding to + or - infinity or round to zero are also allowed.
43*4882a593SmuzhiyunMany architectures allow the rounding mode to be specified by modifying bits
44*4882a593Smuzhiyunin a control register.  Not so with the ARM FPA11 architecture.  To change
45*4882a593Smuzhiyunthe rounding mode one must specify it with each instruction.
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunThis has made porting some benchmarks difficult.  It is possible to
48*4882a593Smuzhiyunintroduce such a capability into the emulator.  The FPCR contains
49*4882a593Smuzhiyunbits describing the rounding mode.  The emulator could be altered to
50*4882a593Smuzhiyunexamine a flag, which if set forced it to ignore the rounding mode in
51*4882a593Smuzhiyunthe instruction, and use the mode specified in the bits in the FPCR.
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunThis would require a method of getting/setting the flag, and the bits
54*4882a593Smuzhiyunin the FPCR.  This requires a kernel call in ArmLinux, as WFC/RFC are
55*4882a593Smuzhiyunsupervisor only instructions.  If anyone has any ideas or comments I
56*4882a593Smuzhiyunwould like to hear them.
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunNOTE:
59*4882a593Smuzhiyun pulled out from some docs on ARM floating point, specifically
60*4882a593Smuzhiyun for the Acorn FPE, but not limited to it:
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun The floating point control register (FPCR) may only be present in some
63*4882a593Smuzhiyun implementations: it is there to control the hardware in an implementation-
64*4882a593Smuzhiyun specific manner, for example to disable the floating point system.  The user
65*4882a593Smuzhiyun mode of the ARM is not permitted to use this register (since the right is
66*4882a593Smuzhiyun reserved to alter it between implementations) and the WFC and RFC
67*4882a593Smuzhiyun instructions will trap if tried in user mode.
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun Hence, the answer is yes, you could do this, but then you will run a high
70*4882a593Smuzhiyun risk of becoming isolated if and when hardware FP emulation comes out
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun		-- Russell.
73