From: Luke Kenneth Casson Leighton Date: Thu, 7 Jul 2022 15:34:30 +0000 (+0100) Subject: fix transcendental pseudo-code, update table names X-Git-Tag: opf_rfc_ls005_v1~1290 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ffea6f8a0289ef0fbd64750c1d297810ffdc12d8;p=libreriscv.git fix transcendental pseudo-code, update table names --- diff --git a/openpower/power_trans_ops.mdwn b/openpower/power_trans_ops.mdwn index d9d6aa1b1..489c13186 100644 --- a/openpower/power_trans_ops.mdwn +++ b/openpower/power_trans_ops.mdwn @@ -18,17 +18,18 @@ Major Opcode 59 has 11 5-bit XO instructions, | 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 | +| fatan2(s) | atan2 arc tangent | 00001 | 00001 | +| fatan2pi(s)|atan2 arc tangent / pi | 01001 | 00111 | +| fpow(s) | x power of y | 10000 | 10000 | +| fpown(s) | x power of n (n int) | 10001 | 10001 | +| fpowr(s) | x power of y (x +ve) | 10011 | 10011 | +| frootn(s) | x power 1/n (n integer)| 11011 | 11011 | +| fhypot(s) | hypotenuse | 10111 | 01101 | # DRAFT List of 1-arg transcendental opcodes -These are X-Form, and are identical in Special Register Altered to `fsqrt` +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: @@ -44,22 +45,22 @@ 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 | +| frsqrt(s)| Reciprocal Square-root | 11110 01110 | +| fcbrt(s) | Cube Root | 11111 01110 | +| frecip(s)| Reciprocal | 11110 01111 | +| fexp2(s) | power-of-2 | 00011 01110 | +| flog2(s) | log2 | 00011 01111 | +| fexpm1(s)| exponential minus 1 | 00101 01110 | +| flog1p(s)| log plus 1 | 00110 01110 | +| fexp(s) | exponential | 00111 01110 | +| flog(s) | natural log (base e) | 00111 01111 | +| fexp10(s)| power-of-10 | 11011 01110 | +| flog10(s)| log base 10 | 11011 01111 | # DRAFT List of 1-arg trigonometric opcodes -These are X-Form, and are identical in Special Register Altered to `fsqrt` - +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 @@ -74,21 +75,21 @@ 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 | +| fsin(s) | sin (radians) | 01000 01110 | +| fcos(s) | cos (radians) | 01001 01110 | +| ftan(s) | tan (radians) | 01011 01110 | +| fasin(s) | arcsin (radians) | 01100 01110 | +| facos(s) | arccos (radians) | 01101 01110 | +| fatan(s) | arctan (radians) | 01111 01110 | +| fsinpi(s) | sin times pi | 01000 01111 | +| fcospi(s) | cos times pi | 01001 01111 | +| ftanpi(s) | tan times pi | 01011 01111 | +| fasinpi(s) | arcsin / pi | 01100 01111 | +| facospi(s) | arccos / pi | 01101 01111 | +| fatanpi(s) | arctan / pi | 01111 01111 | +| fsinh(s) | hyperbolic sin (radians) | 10000 01110 | +| fcosh(s) | hyperbolic cos (radians) | 10001 01110 | +| ftanh(s) | hyperbolic tan (radians) | 10011 01110 | +| fasinh(s) | inverse hyperbolic sin | 10000 01111 | +| facosh(s) | inverse hyperbolic cos | 10001 01111 | +| fatanh(s) | inverse hyperbolic tan | 10011 01111 | diff --git a/openpower/transcendentals.mdwn b/openpower/transcendentals.mdwn index 5e4da4276..53d61ced4 100644 --- a/openpower/transcendentals.mdwn +++ b/openpower/transcendentals.mdwn @@ -424,9 +424,8 @@ suitable code block. FATANPI example pseudo-code: - lui t0, 0x3F800 // upper bits of f32 1.0 - fmv.x.s ft0, t0 - fatan2pi.s rd, rs1, ft0 + fmvis ft0, 0x3F800 // upper bits of f32 1.0 (BF16) + fatan2pis FRT, FRA, ft0 Hyperbolic function example (obviates need for Zfhyp except for high-performance or correctly-rounding):