Merge branch 'ti-sysc-fixes' into fixes
[linux-2.6-microblaze.git] / Documentation / arm / nwfpe / netwinder-fpe.rst
1 =============
2 Current State
3 =============
4
5 The following describes the current state of the NetWinder's floating point
6 emulator.
7
8 In the following nomenclature is used to describe the floating point
9 instructions.  It follows the conventions in the ARM manual.
10
11 ::
12
13   <S|D|E> = <single|double|extended>, no default
14   {P|M|Z} = {round to +infinity,round to -infinity,round to zero},
15             default = round to nearest
16
17 Note: items enclosed in {} are optional.
18
19 Floating Point Coprocessor Data Transfer Instructions (CPDT)
20 ------------------------------------------------------------
21
22 LDF/STF - load and store floating
23
24 <LDF|STF>{cond}<S|D|E> Fd, Rn
25 <LDF|STF>{cond}<S|D|E> Fd, [Rn, #<expression>]{!}
26 <LDF|STF>{cond}<S|D|E> Fd, [Rn], #<expression>
27
28 These instructions are fully implemented.
29
30 LFM/SFM - load and store multiple floating
31
32 Form 1 syntax:
33 <LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn]
34 <LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn, #<expression>]{!}
35 <LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn], #<expression>
36
37 Form 2 syntax:
38 <LFM|SFM>{cond}<FD,EA> Fd, <count>, [Rn]{!}
39
40 These instructions are fully implemented.  They store/load three words
41 for each floating point register into the memory location given in the
42 instruction.  The format in memory is unlikely to be compatible with
43 other implementations, in particular the actual hardware.  Specific
44 mention of this is made in the ARM manuals.
45
46 Floating Point Coprocessor Register Transfer Instructions (CPRT)
47 ----------------------------------------------------------------
48
49 Conversions, read/write status/control register instructions
50
51 FLT{cond}<S,D,E>{P,M,Z} Fn, Rd          Convert integer to floating point
52 FIX{cond}{P,M,Z} Rd, Fn                 Convert floating point to integer
53 WFS{cond} Rd                            Write floating point status register
54 RFS{cond} Rd                            Read floating point status register
55 WFC{cond} Rd                            Write floating point control register
56 RFC{cond} Rd                            Read floating point control register
57
58 FLT/FIX are fully implemented.
59
60 RFS/WFS are fully implemented.
61
62 RFC/WFC are fully implemented.  RFC/WFC are supervisor only instructions, and
63 presently check the CPU mode, and do an invalid instruction trap if not called
64 from supervisor mode.
65
66 Compare instructions
67
68 CMF{cond} Fn, Fm        Compare floating
69 CMFE{cond} Fn, Fm       Compare floating with exception
70 CNF{cond} Fn, Fm        Compare negated floating
71 CNFE{cond} Fn, Fm       Compare negated floating with exception
72
73 These are fully implemented.
74
75 Floating Point Coprocessor Data Instructions (CPDT)
76 ---------------------------------------------------
77
78 Dyadic operations:
79
80 ADF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - add
81 SUF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - subtract
82 RSF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse subtract
83 MUF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - multiply
84 DVF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - divide
85 RDV{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse divide
86
87 These are fully implemented.
88
89 FML{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast multiply
90 FDV{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast divide
91 FRD{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast reverse divide
92
93 These are fully implemented as well.  They use the same algorithm as the
94 non-fast versions.  Hence, in this implementation their performance is
95 equivalent to the MUF/DVF/RDV instructions.  This is acceptable according
96 to the ARM manual.  The manual notes these are defined only for single
97 operands, on the actual FPA11 hardware they do not work for double or
98 extended precision operands.  The emulator currently does not check
99 the requested permissions conditions, and performs the requested operation.
100
101 RMF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - IEEE remainder
102
103 This is fully implemented.
104
105 Monadic operations:
106
107 MVF{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - move
108 MNF{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - move negated
109
110 These are fully implemented.
111
112 ABS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - absolute value
113 SQT{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - square root
114 RND{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - round
115
116 These are fully implemented.
117
118 URD{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - unnormalized round
119 NRM{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - normalize
120
121 These are implemented.  URD is implemented using the same code as the RND
122 instruction.  Since URD cannot return a unnormalized number, NRM becomes
123 a NOP.
124
125 Library calls:
126
127 POW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - power
128 RPW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse power
129 POL{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - polar angle (arctan2)
130
131 LOG{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base 10
132 LGN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base e
133 EXP{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - exponent
134 SIN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - sine
135 COS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - cosine
136 TAN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - tangent
137 ASN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arcsine
138 ACS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arccosine
139 ATN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arctangent
140
141 These are not implemented.  They are not currently issued by the compiler,
142 and are handled by routines in libc.  These are not implemented by the FPA11
143 hardware, but are handled by the floating point support code.  They should
144 be implemented in future versions.
145
146 Signalling:
147
148 Signals are implemented.  However current ELF kernels produced by Rebel.com
149 have a bug in them that prevents the module from generating a SIGFPE.  This
150 is caused by a failure to alias fp_current to the kernel variable
151 current_set[0] correctly.
152
153 The kernel provided with this distribution (vmlinux-nwfpe-0.93) contains
154 a fix for this problem and also incorporates the current version of the
155 emulator directly.  It is possible to run with no floating point module
156 loaded with this kernel.  It is provided as a demonstration of the
157 technology and for those who want to do floating point work that depends
158 on signals.  It is not strictly necessary to use the module.
159
160 A module (either the one provided by Russell King, or the one in this
161 distribution) can be loaded to replace the functionality of the emulator
162 built into the kernel.