# Opcode Tables
## PO=59 XO=10--011--
Power ISA v3.1B opcodes extracted from Power ISA v3.1B Appendix D Table 23 sheet 2 of 4 page 1391
Parenthesized entries are not part of fptrans.
| XO LSB half →
XO MSB half ↓ | 01100 | 01101 | 01110 | 01111 |
|-----------------------------------------------|---------------------------------------------------------------------|--------------------------------------------------------------------|----------------------------------------------------------------------|---------------------------------------------------------------------|
| 10000 | `10000 01100`\linebreak[4]
(ffadds) (draft) | `10000 01101`\linebreak[4]
fsinpis (draft) | `10000 01110`\linebreak[4]
fatan2pis (draft) | `10000 01111`\linebreak[4]
fasinpis (draft) |
| 10001 | `10001 01100`\linebreak[4]
fcospis (draft) | `10001 01101`\linebreak[4]
ftanpis (draft) | `10001 01110`\linebreak[4]
facospis (draft) | `10001 01111`\linebreak[4]
fatanpis (draft) |
| 10010 | `10010 01100`\linebreak[4]
**TBD** (draft) | `10010 01101`\linebreak[4]
fsins (draft) | `10010 01110`\linebreak[4]
fatan2s (draft) | `10010 01111`\linebreak[4]
fasins (draft) |
| 10011 | `10011 01100`\linebreak[4]
fcoss (draft) | `10011 01101`\linebreak[4]
ftans (draft) | `10011 01110`\linebreak[4]
facoss (draft) | `10011 01111`\linebreak[4]
fatans (draft) |
| 10100 | `10100 01100`\linebreak[4]
**TBD** (draft) | `10100 01101`\linebreak[4]
fsinhs (draft) | `10100 01110`\linebreak[4]
fhypots (draft) | `10100 01111`\linebreak[4]
fasinhs (draft) |
| 10101 | `10101 01100`\linebreak[4]
fcoshs (draft) | `10101 01101`\linebreak[4]
ftanhs (draft) | `10101 01110`\linebreak[4]
facoshs (draft) | `10101 01111`\linebreak[4]
fatanhs (draft) |
| 10110 | `10110 01100`\linebreak[4]
**TBD** (draft) | `10110 01101`\linebreak[4]
**TBD** (draft) | `10110 01110`\linebreak[4]
**TBD** (draft) | `10110 01111`\linebreak[4]
**TBD** (draft) |
| 10111 | `10111 01100`\linebreak[4]
**TBD** (draft) | `10111 01101`\linebreak[4]
**TBD** (draft) | `10111 01110`\linebreak[4]
**TBD** (draft) | `10111 01111`\linebreak[4]
**TBD** (draft) |
## PO=63 XO=10--011--
Power ISA v3.1B opcodes extracted from Power ISA v3.1B Appendix D Table 25 sheet 2 of 4 page 1399
| XO LSB half →
XO MSB half ↓ | 01100 | 01101 | 01110 | 01111 |
|-------------------------------------------------|-------|-------|-------|-------|
| 10000 | | | | |
| 10001 | | | | |
| 10010 | | | | |
| 10011 | | | | |
| 10100 | | | | |
| 10101 | | | | |
| 10110 | | | | |
| 10111 | | | | |
# DRAFT List of 2-arg opcodes
FIXME(programmerjake): reallocate and convert to X-FORM
These are X-Form, recommended Major Opcode 63 for full-width
and 59 for half-width (ending in s).
| 0.5|6.10|11.15|16.20| 21..30 |31| name | Form |
| -- | -- | --- | --- | ---------- |--| ---- | ------- |
| NN |FRT | FRA | FRB | 10xxx011xx |Rc| transcendental | X-Form |
As shown in Power ISA 3.1 Book III Appendix D Table 28 p1190
and Table 23 p1368,
Major Opcode 63 has room
for 9 A-Form 5-bit XO instructions,
Major Opcode 59 has 11 5-bit XO instructions,
with some overlap leading to a partially orthogonal
set across full and half width.
| opcode | Description | Major 59 and 63 |
|------------|-----------------------------------------|-----------------|
| fatan2(s) | atan2 arc tangent | 10010 01110 |
| fatan2pi(s)| atan2 arc tangent / π | 10000 01110 |
| fpow(s) | xy | |
| fpown(s) | xn (n ∈ ℤ) | |
| fpowr(s) | xy (x >= 0) | |
| frootn(s) | n√x (n ∈ ℤ) | |
| fhypot(s) | √(x2 + y2) | 10100 01110 |
# DRAFT List of 1-arg transcendental opcodes
FIXME(programmerjake): reallocate
These are X-Form, and are identical in Special Registers Altered to `fsqrt`.
Recommended Major Opcode 63 for full-width and 59 for half-width (ending in s).
Special Registers Altered:
FPRF FR FI FX OX UX XX
VXSNAN VXIMZ VXZDZ
CR1 (if Rc=1)
| 0.5|6.10|11.15|16.20| 21..30 |31| name | Form |
| -- | -- | --- | --- | ---------- |--| ---- | ------- |
| NN |FRT | /// | FRB | 10xxx011xx |Rc| transcendental | X-Form |
Recommended 10-bit XO with the low 5 LSBs 01100:
| opcode | Description | Major 59 and 63 |
|------------|--------------------------|-----------------|
| frsqrt(s) | 1 / √x | |
| fcbrt(s) | ∛x | |
| frecip(s) | 1 / x | |
| fexp2m1(s) | 2x - 1 | |
| flog2p1(s) | log2 (x + 1) | |
| fexp2(s) | 2x | |
| flog2(s) | log2 x | |
| fexpm1(s) | ex - 1 | |
| flogp1(s) | loge (x + 1) | |
| fexp(s) | ex | |
| flog(s) | loge x | |
| fexp10m1(s)| 10x - 1 | |
| flog10p1(s)| log10 (x + 1) | |
| fexp10(s) | 10x | |
| flog10(s) | log10 x | |
# DRAFT List of 1-arg trigonometric opcodes
FIXME(programmerjake): reallocate
These are X-Form, and are identical in Special Registers Altered to `fsqrt`.
Recommended Major Opcode 63 for full-width and 59 for half-width (ending in s)
Special Registers Altered:
FPRF FR FI FX OX UX XX
VXSNAN VXIMZ VXZDZ
CR1 (if Rc=1)
| 0.5|6.10|11.15|16.20| 21..30 |31| name | Form |
| -- | -- | --- | --- | ---------- |--| ---- | ------- |
| NN |FRT | /// | FRB | 10xxx011xx |Rc| trigonometric | X-Form |
Recommended 10-bit XO with the low 5 LSBs 01101 to 01111:
| opcode | Description | Major 59 and 63 |
|-------------|--------------------------|------------------|
| fsin(s) | sin (radians) | 10010 01101 |
| fcos(s) | cos (radians) | 10011 01100 |
| ftan(s) | tan (radians) | 10011 01101 |
| fasin(s) | arcsin (radians) | 10010 01111 |
| facos(s) | arccos (radians) | 10011 01110 |
| fatan(s) | arctan (radians) | 10011 01111 |
| fsinpi(s) | sin(π * x) | 10000 01101 |
| fcospi(s) | cos(π * x) | 10001 01100 |
| ftanpi(s) | tan(π * x) | 10001 01101 |
| fasinpi(s) | arcsin(x) / π | 10000 01111 |
| facospi(s) | arccos(x) / π | 10001 01110 |
| fatanpi(s) | arctan(x) / π | 10001 01111 |
| fsinh(s) | hyperbolic sin | 10100 01101 |
| fcosh(s) | hyperbolic cos | 10101 01100 |
| ftanh(s) | hyperbolic tan | 10101 01101 |
| fasinh(s) | inverse hyperbolic sin | 10100 01111 |
| facosh(s) | inverse hyperbolic cos | 10101 01110 |
| fatanh(s) | inverse hyperbolic tan | 10101 01111 |