(no commit message)
[libreriscv.git] / openpower / power_trans_ops.mdwn
1 # Opcode Tables for PO=59/63 XO=1---011--
2
3 Power ISA v3.1B opcodes extracted from:
4
5 * Power ISA v3.1B Appendix D Table 23 sheet 2 of 4 page 1391
6 * Power ISA v3.1B Appendix D Table 25 sheet 2 of 4 page 1399
7
8 Parenthesized entries are not part of fptrans.
9
10 * Entries whose mnemonic ends in `s` are only in PO=59.
11 * Entries whose mnemonic does not end in `s` are only in PO=63.
12 * Entries whose mnemonic ends in `(s)` are in both PO=59 and PO=63.
13
14 | XO LSB half &#x2192;<br> XO MSB half &#x2193; | 01100 | 01101 | 01110 | 01111 |
15 |-----------------------------------------------|------------------------------------------------------|---------------------------------------------------|------------------------------------------------------|----------------------------------------------------|
16 | 10000 | <small>`10000 01100`</small><br>fcbrt(s) (draft) | <small>`10000 01101`</small><br>fsinpi(s) (draft) | <small>`10000 01110`</small><br>fatan2pi(s) (draft) | <small>`10000 01111`</small><br>fasinpi(s) (draft) |
17 | 10001 | <small>`10001 01100`</small><br>fcospi(s) (draft) | <small>`10001 01101`</small><br>ftanpi(s) (draft) | <small>`10001 01110`</small><br>facospi(s) (draft) | <small>`10001 01111`</small><br>fatanpi(s) (draft) |
18 | 10010 | <small>`10010 01100`</small><br>frsqrt(s) (draft) | <small>`10010 01101`</small><br>fsin(s) (draft) | <small>`10010 01110`</small><br>fatan2(s) (draft) | <small>`10010 01111`</small><br>fasin(s) (draft) |
19 | 10011 | <small>`10011 01100`</small><br>fcos(s) (draft) | <small>`10011 01101`</small><br>ftan(s) (draft) | <small>`10011 01110`</small><br>facos(s) (draft) | <small>`10011 01111`</small><br>fatan(s) (draft) |
20 | 10100 | <small>`10100 01100`</small><br>frecip(s) (draft) | <small>`10100 01101`</small><br>fsinh(s) (draft) | <small>`10100 01110`</small><br>fhypot(s) (draft) | <small>`10100 01111`</small><br>fasinh(s) (draft) |
21 | 10101 | <small>`10101 01100`</small><br>fcosh(s) (draft) | <small>`10101 01101`</small><br>ftanh(s) (draft) | <small>`10101 01110`</small><br>facosh(s) (draft) | <small>`10101 01111`</small><br>fatanh(s) (draft) |
22 | 10110 | <small>`10110 01100`</small><br>fminnum08(s) (draft) | <small>`10110 01101`</small><br>fmin19(s) (draft) | <small>`10110 01110`</small><br>fminnum19(s) (draft) | <small>`10110 01111`</small><br>fminc(s) (draft) |
23 | 10111 | <small>`10111 01100`</small><br>fmaxnum08(s) (draft) | <small>`10111 01101`</small><br>fmax19(s) (draft) | <small>`10111 01110`</small><br>fmaxnum19(s) (draft) | <small>`10111 01111`</small><br>fmaxc(s) (draft) |
24
25 | XO LSB half &#x2192;<br> XO MSB half &#x2193; | 01100 | 01101 | 01110 | 01111 |
26 |-----------------------------------------------|----------------------------------------------------|----------------------------------------------------|---------------------------------------------------------|---------------------------------------------------------|
27 | 11000 | <small>`11000 01100`</small><br>fexp2m1(s) (draft) | <small>`11000 01101`</small><br>flog2p1(s) (draft) | <small>`11000 01110`</small><br>fminmagnum08(s) (draft) | <small>`11000 01111`</small><br>fmaxmagnum08(s) (draft) |
28 | 11001 | <small>`11001 01100`</small><br>fexpm1(s) (draft) | <small>`11001 01101`</small><br>flogp1(s) (draft) | <small>`11001 01110`</small><br>(fctid) | <small>`11001 01111`</small><br>(fctidz) |
29 | 11010 | <small>`11010 01100`</small><br>fexp10m1(s) (draft)| <small>`11010 01101`</small><br>flog10p1(s) (draft)| <small>`11010 01110`</small><br>(fcfid(s)) | <small>`11010 01111`</small><br>fmod(s) (draft) |
30 | 11011 | <small>`11011 01100`</small><br>fpown(s) (draft) | <small>`11011 01101`</small><br>frootn(s) (draft) | <small>`11011 01110`</small><br>fminmag19(s) (draft) | <small>`11011 01111`</small><br>fmaxmag19(s) (draft) |
31 | 11100 | <small>`11100 01100`</small><br>fexp2(s) (draft) | <small>`11100 01101`</small><br>flog2(s) (draft) | <small>`11100 01110`</small><br>fminmagnum19(s) (draft) | <small>`11100 01111`</small><br>fmaxmagnum19(s) (draft) |
32 | 11101 | <small>`11101 01100`</small><br>fexp(s) (draft) | <small>`11101 01101`</small><br>flog(s) (draft) | <small>`11101 01110`</small><br>(fctidu) | <small>`11101 01111`</small><br>(fctiduz) |
33 | 11110 | <small>`11110 01100`</small><br>fexp10(s) (draft) | <small>`11110 01101`</small><br>flog10(s) (draft) | <small>`11110 01110`</small><br>(fcfidu(s)) | <small>`11110 01111`</small><br>fremainder(s) (draft) |
34 | 11111 | <small>`11111 01100`</small><br>fpowr(s) (draft) | <small>`11111 01101`</small><br>fpow(s) (draft) | <small>`11111 01110`</small><br>fminmagc(s) (draft) | <small>`11111 01111`</small><br>fmaxmagc(s) (draft) |
35
36 # DRAFT List of 2-arg opcodes
37
38 These are X-Form, recommended Major Opcode 63 for full-width
39 and 59 for half-width (ending in s).
40
41 | 0.5|6.10|11.15|16.20| 21..30 |31| name | Form |
42 | -- | -- | --- | --- | ---------- |--| ---- | ------- |
43 | NN |FRT | FRA | FRB | 1xxxx011xx |Rc| transcendental | X-Form |
44 | NN |FRT | FRA | RB | 1xxxx011xx |Rc| transcendental | X-Form |
45
46 Recommended 10-bit XO assignments:
47
48 | opcode | Description | Major 59 and 63 | bits 16..20 |
49 |-----------------|-----------------------------------------|-----------------|-------------|
50 | fatan2(s) | atan2 arc tangent | 10010 01110 | FRB |
51 | fatan2pi(s) | atan2 arc tangent / &pi; | 10000 01110 | FRB |
52 | fpow(s) | x<sup>y</sup> | 11111 01101 | FRB |
53 | fpown(s) | x<sup>n</sup> (n &in; &#x2124;) | 11011 01100 | RB |
54 | fpowr(s) | x<sup>y</sup> (x >= 0) | 11111 01100 | FRB |
55 | frootn(s) | <sup>n</sup>&#x221A;x (n &in; &#x2124;) | 11011 01101 | RB |
56 | fhypot(s) | &#x221A;(x<sup>2</sup> + y<sup>2</sup>) | 10100 01110 | FRB |
57 | fminnum08(s) | IEEE 754-2008 minNum | 10110 01100 | FRB |
58 | fmaxnum08(s) | IEEE 754-2008 maxNum | 10111 01100 | FRB |
59 | fmin19(s) | IEEE 754-2019 minimum | 10110 01101 | FRB |
60 | fmax19(s) | IEEE 754-2019 maximum | 10111 01101 | FRB |
61 | fminnum19(s) | IEEE 754-2019 minimumNumber | 10110 01110 | FRB |
62 | fmaxnum19(s) | IEEE 754-2019 maximumNumber | 10111 01110 | FRB |
63 | fminc(s) | C ternary-op minimum | 10110 01111 | FRB |
64 | fmaxc(s) | C ternary-op maximum | 10111 01111 | FRB |
65 | fminmagnum08(s) | IEEE 754-2008 minNumMag | 11000 01110 | FRB |
66 | fmaxmagnum08(s) | IEEE 754-2008 maxNumMag | 11000 01111 | FRB |
67 | fminmag19(s) | IEEE 754-2019 minimumMagnitude | 11011 01110 | FRB |
68 | fmaxmag19(s) | IEEE 754-2019 maximumMagnitude | 11011 01111 | FRB |
69 | fminmagnum19(s) | IEEE 754-2019 minimumMagnitudeNumber | 11100 01110 | FRB |
70 | fmaxmagnum19(s) | IEEE 754-2019 maximumMagnitudeNumber | 11100 01111 | FRB |
71 | fminmagc(s) | C ternary-op minimum magnitude | 11111 01110 | FRB |
72 | fmaxmagc(s) | C ternary-op maximum magnitude | 11111 01111 | FRB |
73 | fmod(s) | modulus | 11010 01111 | FRB |
74 | fremainder(s) | IEEE 754 remainder | 11110 01111 | FRB |
75
76 # DRAFT List of 1-arg transcendental opcodes
77
78 These are X-Form, and are mostly identical in Special Registers Altered to
79 `fsqrt` (the exact fp exceptions they can produce differ).
80 Recommended Major Opcode 63 for full-width and 59 for half-width (ending in s).
81
82 Special Registers Altered (FIXME: come up with correct list):
83
84 FPRF FR FI FX OX UX XX
85 VXSNAN VXIMZ VXZDZ
86 CR1 (if Rc=1)
87
88 | 0.5|6.10|11.15|16.20| 21..30 |31| name | Form |
89 | -- | -- | --- | --- | ---------- |--| ---- | ------- |
90 | NN |FRT | /// | FRB | 1xxxx011xx |Rc| transcendental | X-Form |
91
92 Recommended 10-bit XO assignments:
93
94 | opcode | Description | Major 59 and 63 |
95 |------------|--------------------------|-----------------|
96 | frsqrt(s) | 1 / &#x221A;x | 10010 01100 |
97 | fcbrt(s) | &#x221B;x | 10000 01100 |
98 | frecip(s) | 1 / x | 10100 01100 |
99 | fexp2m1(s) | 2<sup>x</sup> - 1 | 11000 01100 |
100 | flog2p1(s) | log<sub>2</sub> (x + 1) | 11000 01101 |
101 | fexp2(s) | 2<sup>x</sup> | 11100 01100 |
102 | flog2(s) | log<sub>2</sub> x | 11100 01101 |
103 | fexpm1(s) | e<sup>x</sup> - 1 | 11001 01100 |
104 | flogp1(s) | log<sub>e</sub> (x + 1) | 11001 01101 |
105 | fexp(s) | e<sup>x</sup> | 11101 01100 |
106 | flog(s) | log<sub>e</sub> x | 11101 01101 |
107 | fexp10m1(s)| 10<sup>x</sup> - 1 | 11010 01100 |
108 | flog10p1(s)| log<sub>10</sub> (x + 1) | 11010 01101 |
109 | fexp10(s) | 10<sup>x</sup> | 11110 01100 |
110 | flog10(s) | log<sub>10</sub> x | 11110 01101 |
111
112 # DRAFT List of 1-arg trigonometric opcodes
113
114 These are X-Form, and are mostly identical in Special Registers Altered to
115 `fsqrt` (the exact fp exceptions they can produce differ).
116 Recommended Major Opcode 63 for full-width and 59 for half-width (ending in s)
117
118 Special Registers Altered:
119
120 FPRF FR FI FX OX UX XX
121 VXSNAN VXIMZ VXZDZ
122 CR1 (if Rc=1)
123
124 | 0.5|6.10|11.15|16.20| 21..30 |31| name | Form |
125 | -- | -- | --- | --- | ---------- |--| ---- | ------- |
126 | NN |FRT | /// | FRB | 1xxxx011xx |Rc| trigonometric | X-Form |
127
128 Recommended 10-bit XO assignments:
129
130 | opcode | Description | Major 59 and 63 |
131 |-------------|--------------------------|------------------|
132 | fsin(s) | sin (radians) | 10010 01101 |
133 | fcos(s) | cos (radians) | 10011 01100 |
134 | ftan(s) | tan (radians) | 10011 01101 |
135 | fasin(s) | arcsin (radians) | 10010 01111 |
136 | facos(s) | arccos (radians) | 10011 01110 |
137 | fatan(s) | arctan (radians) | 10011 01111 |
138 | fsinpi(s) | sin(&pi; * x) | 10000 01101 |
139 | fcospi(s) | cos(&pi; * x) | 10001 01100 |
140 | ftanpi(s) | tan(&pi; * x) | 10001 01101 |
141 | fasinpi(s) | arcsin(x) / &pi; | 10000 01111 |
142 | facospi(s) | arccos(x) / &pi; | 10001 01110 |
143 | fatanpi(s) | arctan(x) / &pi; | 10001 01111 |
144 | fsinh(s) | hyperbolic sin | 10100 01101 |
145 | fcosh(s) | hyperbolic cos | 10101 01100 |
146 | ftanh(s) | hyperbolic tan | 10101 01101 |
147 | fasinh(s) | inverse hyperbolic sin | 10100 01111 |
148 | facosh(s) | inverse hyperbolic cos | 10101 01110 |
149 | fatanh(s) | inverse hyperbolic tan | 10101 01111 |