From 7109a1d857273a60a67f8ac9ac480831010d811a Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 7 Jul 2022 16:05:59 +0100 Subject: [PATCH] update trigonometric table --- openpower/power_trans_ops.mdwn | 134 +++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 49 deletions(-) diff --git a/openpower/power_trans_ops.mdwn b/openpower/power_trans_ops.mdwn index bae643140..d9d6aa1b1 100644 --- a/openpower/power_trans_ops.mdwn +++ b/openpower/power_trans_ops.mdwn @@ -1,58 +1,94 @@ # DRAFT List of 2-arg opcodes These are A-Form, recommended Major Opcode 63 for full-width -and 59 for half-width (ending in s). Major Opcode 63 has room +and 59 for half-width (ending in s). + +| 0.5|6.10|11.15|16.20| 21.25 | 26.30 |31| name | Form | +| -- | -- | --- | --- | ----- | ----- |--| ---- | ------- | +| NN |FRT | FRA | FRB | /// | xxxxx |Rc| trigonometric | A-Form | + +As shown in Power ISA 3.0C Book III Appendix C Table 28 p1190 +and Table 23 p1181, +Major Opcode 63 has room for 9 A-Form 5-bit XO instructions, 00001, 01001, 01010, 01011, 01101, 10000, 10001, 10011, 11011. -Major Opcode 59 has 00000, 00001, 00100, 00101, 00110, 00111, +Major Opcode 59 has 11 5-bit XO instructions, +00000, 00001, 00100, 00101, 00110, 00111, 10000, 10001, 10011, 10111, 11011. - -| opcode | Description | pseudocode | Extension | -| ------ | ---------------- | ---------------- | ----------- | -| FATAN2 | atan2 arc tangent | rd = atan2(rs2, rs1) | Zarctrignpi | -| FATAN2PI | atan2 arc tangent / pi | rd = atan2(rs2, rs1) / pi | Zarctrigpi | -| FPOW | x power of y | rd = pow(rs1, rs2) | ZftransAdv | -| FPOWN | x power of n (n int) | rd = pow(rs1, rs2) | ZftransAdv | -| FPOWR | x power of y (x +ve) | rd = exp(rs1 log(rs2)) | ZftransAdv | -| FROOTN | x power 1/n (n integer)| rd = pow(rs1, 1/rs2) | ZftransAdv | -| FHYPOT | hypotenuse | rd = sqrt(rs1^2 + rs2^2) | ZftransAdv | +| opcode | Description | Major 63 | Major 59 | +| ------ | ---------------- | ---------------- | ----------- | +| FATAN2 | atan2 arc tangent | 00001 | 00001 | +| FATAN2PI | atan2 arc tangent / pi | 01001 | 00111 | +| FPOW | x power of y | 10000 | 10000 | +| FPOWN | x power of n (n int) | 10001 | 10001 | +| FPOWR | x power of y (x +ve) | 10011 | 10011 | +| FROOTN | x power 1/n (n integer)| 11011 | 11011 | +| FHYPOT | hypotenuse | 10111 | 01101 | -## List of 1-arg transcendental opcodes - -| opcode | Description | pseudocode | Extension | -| ------ | ---------------- | ---------------- | ----------- | -| FRSQRT | Reciprocal Square-root | rd = sqrt(rs1) | Zfrsqrt | -| FCBRT | Cube Root | rd = pow(rs1, 1.0 / 3) | ZftransAdv | -| FRECIP | Reciprocal | rd = 1.0 / rs1 | Zftrans | -| FEXP2 | power-of-2 | rd = pow(2, rs1) | Zftrans | -| FLOG2 | log2 | rd = log(2. rs1) | Zftrans | -| FEXPM1 | exponential minus 1 | rd = pow(e, rs1) - 1.0 | ZftransExt | -| FLOG1P | log plus 1 | rd = log(e, 1 + rs1) | ZftransExt | -| FEXP | exponential | rd = pow(e, rs1) | ZftransExt | -| FLOG | natural log (base e) | rd = log(e, rs1) | ZftransExt | -| FEXP10 | power-of-10 | rd = pow(10, rs1) | ZftransExt | -| FLOG10 | log base 10 | rd = log(10, rs1) | ZftransExt | - -## List of 1-arg trigonometric opcodes +# DRAFT List of 1-arg transcendental opcodes + +These are X-Form, and are identical in Special Register Altered to `fsqrt` + +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 | xxxxx0111x |Rc| transcendental | X-Form | + +Recommended 10-bit XO with the low 5 LSBs 01110 and 01111: + +| opcode | Description | Major 59 and 63 | +| ------ | ---------------- | ---------------- | +| FRSQRT | Reciprocal Square-root | 11110 01110 | +| FCBRT | Cube Root | 11111 01110 | +| FRECIP | Reciprocal | 11110 01111 | +| FEXP2 | power-of-2 | 00011 01110 | +| FLOG2 | log2 | 00011 01111 | +| FEXPM1 | exponential minus 1 | 00101 01110 | +| FLOG1P | log plus 1 | 00110 01110 | +| FEXP | exponential | 00111 01110 | +| FLOG | natural log (base e) | 00111 01111 | +| FEXP10 | power-of-10 | 11011 01110 | +| FLOG10 | log base 10 | 11011 01111 | + +# DRAFT List of 1-arg trigonometric opcodes -| opcode | Description | pseudo-code | Extension | -| ------ | ---------------- | ---------------- | ----------- | -| FSIN | sin (radians) | rd = sin(rs1) | Ztrignpi | -| FCOS | cos (radians) | rd = cos(rs1) | Ztrignpi | -| FTAN | tan (radians) | rd = tan(rs1) | Ztrignpi | -| FASIN | arcsin (radians) | rd = asin(rs1) | Zarctrignpi | -| FACOS | arccos (radians) | rd = acos(rs1) | Zarctrignpi | -| FATAN | arctan (radians) | rd = atan(rs1) | Zarctrignpi | -| FSINPI | sin times pi | rd = sin(pi * rs1) | Ztrigpi | -| FCOSPI | cos times pi | rd = cos(pi * rs1) | Ztrigpi | -| FTANPI | tan times pi | rd = tan(pi * rs1) | Ztrigpi | -| FASINPI | arcsin / pi | rd = asin(rs1) / pi | Zarctrigpi | -| FACOSPI | arccos / pi | rd = acos(rs1) / pi | Zarctrigpi | -| FATANPI | arctan / pi | rd = atan(rs1) / pi | Zarctrigpi | -| FSINH | hyperbolic sin (radians) | rd = sinh(rs1) | Zfhyp | -| FCOSH | hyperbolic cos (radians) | rd = cosh(rs1) | Zfhyp | -| FTANH | hyperbolic tan (radians) | rd = tanh(rs1) | Zfhyp | -| FASINH | inverse hyperbolic sin | rd = asinh(rs1) | Zfhyp | -| FACOSH | inverse hyperbolic cos | rd = acosh(rs1) | Zfhyp | -| FATANH | inverse hyperbolic tan | rd = atanh(rs1) | Zfhyp | +These are X-Form, and are identical in Special Register Altered to `fsqrt` + +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 | xxxxx0111x |Rc| trigonometric | X-Form | + +Recommended 10-bit XO with the low 5 LSBs 01110 and 01111: + +| opcode | Description | Major 59 and 63 | +| ------ | ---------------- | ---------------- | +| FSIN | sin (radians) | 01000 01110 | +| FCOS | cos (radians) | 01001 01110 | +| FTAN | tan (radians) | 01011 01110 | +| FASIN | arcsin (radians) | 01100 01110 | +| FACOS | arccos (radians) | 01101 01110 | +| FATAN | arctan (radians) | 01111 01110 | +| FSINPI | sin times pi | 01000 01111 | +| FCOSPI | cos times pi | 01001 01111 | +| FTANPI | tan times pi | 01011 01111 | +| FASINPI | arcsin / pi | 01100 01111 | +| FACOSPI | arccos / pi | 01101 01111 | +| FATANPI | arctan / pi | 01111 01111 | +| FSINH | hyperbolic sin (radians) | 10000 01110 | +| FCOSH | hyperbolic cos (radians) | 10001 01110 | +| FTANH | hyperbolic tan (radians) | 10011 01110 | +| FASINH | inverse hyperbolic sin | 10000 01111 | +| FACOSH | inverse hyperbolic cos | 10001 01111 | +| FATANH | inverse hyperbolic tan | 10011 01111 | -- 2.30.2