From 2aecbce83e1658c652bb04f7daca124239d05edd Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 20 Apr 2023 19:31:53 -0700 Subject: [PATCH] move fminmax[s] to XO ....0 10000 --- openpower/power_trans_ops.mdwn | 39 +++++++------------ .../power_trans_ops_copy_from_PO59_table.py | 17 ++++---- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/openpower/power_trans_ops.mdwn b/openpower/power_trans_ops.mdwn index a2f51f04c..babf0130f 100644 --- a/openpower/power_trans_ops.mdwn +++ b/openpower/power_trans_ops.mdwn @@ -2,8 +2,8 @@ Power ISA v3.1B opcodes extracted from: -* Power ISA v3.1B Appendix D Table 23 sheet 2 of 4 page 1391 -* Power ISA v3.1B Appendix D Table 25 sheet 2 of 4 page 1399 +* Power ISA v3.1B Appendix D Table 23 sheet 2/3 of 4 page 1391/1392 +* Power ISA v3.1B Appendix D Table 25 sheet 2/3 of 4 page 1399/1400 Parenthesized entries are not part of fptrans. @@ -19,19 +19,24 @@ Parenthesized entries are not part of fptrans. | 10011 | `10011 01100`
fcos(s) (draft) | `10011 01101`
ftan(s) (draft) | `10011 01110`
facos(s) (draft) | `10011 01111`
fatan(s) (draft) | | 10100 | `10100 01100`
frecip(s) (draft) | `10100 01101`
fsinh(s) (draft) | `10100 01110`
fhypot(s) (draft) | `10100 01111`
fasinh(s) (draft) | | 10101 | `10101 01100`
fcosh(s) (draft) | `10101 01101`
ftanh(s) (draft) | `10101 01110`
facosh(s) (draft) | `10101 01111`
fatanh(s) (draft) | -| 10110 | `10110 01100`
fminnum08(s) (draft) | `10110 01101`
fmin19(s) (draft) | `10110 01110`
fminnum19(s) (draft) | `10110 01111`
fminc(s) (draft) | -| 10111 | `10111 01100`
fmaxnum08(s) (draft) | `10111 01101`
fmax19(s) (draft) | `10111 01110`
fmaxnum19(s) (draft) | `10111 01111`
fmaxc(s) (draft) | +| 10110 | `10110 01100`
  | `10110 01101`
  | `10110 01110`
  | `10110 01111`
  | +| 10111 | `10111 01100`
  | `10111 01101`
  | `10111 01110`
  | `10111 01111`
  | | XO LSB half →
XO MSB half ↓ | 01100 | 01101 | 01110 | 01111 | |-----------------------------------------------|----------------------------------------------------|----------------------------------------------------|---------------------------------------------------------|---------------------------------------------------------| -| 11000 | `11000 01100`
fexp2m1(s) (draft) | `11000 01101`
flog2p1(s) (draft) | `11000 01110`
fminmagnum08(s) (draft) | `11000 01111`
fmaxmagnum08(s) (draft) | +| 11000 | `11000 01100`
fexp2m1(s) (draft) | `11000 01101`
flog2p1(s) (draft) | `11000 01110`
  | `11000 01111`
  | | 11001 | `11001 01100`
fexpm1(s) (draft) | `11001 01101`
flogp1(s) (draft) | `11001 01110`
(fctid) | `11001 01111`
(fctidz) | | 11010 | `11010 01100`
fexp10m1(s) (draft)| `11010 01101`
flog10p1(s) (draft)| `11010 01110`
(fcfid(s)) | `11010 01111`
fmod(s) (draft) | -| 11011 | `11011 01100`
fpown(s) (draft) | `11011 01101`
frootn(s) (draft) | `11011 01110`
fminmag19(s) (draft) | `11011 01111`
fmaxmag19(s) (draft) | -| 11100 | `11100 01100`
fexp2(s) (draft) | `11100 01101`
flog2(s) (draft) | `11100 01110`
fminmagnum19(s) (draft) | `11100 01111`
fmaxmagnum19(s) (draft) | +| 11011 | `11011 01100`
fpown(s) (draft) | `11011 01101`
frootn(s) (draft) | `11011 01110`
  | `11011 01111`
  | +| 11100 | `11100 01100`
fexp2(s) (draft) | `11100 01101`
flog2(s) (draft) | `11100 01110`
  | `11100 01111`
  | | 11101 | `11101 01100`
fexp(s) (draft) | `11101 01101`
flog(s) (draft) | `11101 01110`
(fctidu) | `11101 01111`
(fctiduz) | | 11110 | `11110 01100`
fexp10(s) (draft) | `11110 01101`
flog10(s) (draft) | `11110 01110`
(fcfidu(s)) | `11110 01111`
fremainder(s) (draft) | -| 11111 | `11111 01100`
fpowr(s) (draft) | `11111 01101`
fpow(s) (draft) | `11111 01110`
fminmagc(s) (draft) | `11111 01111`
fmaxmagc(s) (draft) | +| 11111 | `11111 01100`
fpowr(s) (draft) | `11111 01101`
fpow(s) (draft) | `11111 01110`
  | `11111 01111`
  | + +| XO LSB half →
XO MSB half ↓ | 10000 | 10001 | 10010 | 10011 | +|-----------------------------------------------|----------------------------------------------------|----------------------------------------|-------------------------------------------|----------------------------------------| +| ////0 | `....0 10000`
fminmax(s) (draft) | `////0 10001`
  | `////0 10010`
(fdiv(s)) | `////0 10011`
  | +| ////1 | `////1 10000`
  | `////1 10001`
  | `////1 10010`
(fdiv(s)) | `////1 10011`
  | # DRAFT List of 2-arg opcodes @@ -42,6 +47,7 @@ and 59 for half-width (ending in s). | -- | -- | --- | --- | ---------- |--| ---- | ------- | | NN |FRT | FRA | FRB | 1xxxx011xx |Rc| transcendental | X-Form | | NN |FRT | FRA | RB | 1xxxx011xx |Rc| transcendental | X-Form | +| NN |FRT | FRA | FRB | xxxxx10000 |Rc| transcendental | X-Form | Recommended 10-bit XO assignments: @@ -54,22 +60,7 @@ Recommended 10-bit XO assignments: | fpowr(s) | xy (x >= 0) | 11111 01100 | FRB | | frootn(s) | n√x (n ∈ ℤ) | 11011 01101 | RB | | fhypot(s) | √(x2 + y2) | 10100 01110 | FRB | -| fminnum08(s) | IEEE 754-2008 minNum | 10110 01100 | FRB | -| fmaxnum08(s) | IEEE 754-2008 maxNum | 10111 01100 | FRB | -| fmin19(s) | IEEE 754-2019 minimum | 10110 01101 | FRB | -| fmax19(s) | IEEE 754-2019 maximum | 10111 01101 | FRB | -| fminnum19(s) | IEEE 754-2019 minimumNumber | 10110 01110 | FRB | -| fmaxnum19(s) | IEEE 754-2019 maximumNumber | 10111 01110 | FRB | -| fminc(s) | C ternary-op minimum | 10110 01111 | FRB | -| fmaxc(s) | C ternary-op maximum | 10111 01111 | FRB | -| fminmagnum08(s) | IEEE 754-2008 minNumMag | 11000 01110 | FRB | -| fmaxmagnum08(s) | IEEE 754-2008 maxNumMag | 11000 01111 | FRB | -| fminmag19(s) | IEEE 754-2019 minimumMagnitude | 11011 01110 | FRB | -| fmaxmag19(s) | IEEE 754-2019 maximumMagnitude | 11011 01111 | FRB | -| fminmagnum19(s) | IEEE 754-2019 minimumMagnitudeNumber | 11100 01110 | FRB | -| fmaxmagnum19(s) | IEEE 754-2019 maximumMagnitudeNumber | 11100 01111 | FRB | -| fminmagc(s) | C ternary-op minimum magnitude | 11111 01110 | FRB | -| fmaxmagc(s) | C ternary-op maximum magnitude | 11111 01111 | FRB | +| fminmax(s) | min/max | ....0 10000 | FRB | | fmod(s) | modulus | 11010 01111 | FRB | | fremainder(s) | IEEE 754 remainder | 11110 01111 | FRB | diff --git a/openpower/power_trans_ops_copy_from_PO59_table.py b/openpower/power_trans_ops_copy_from_PO59_table.py index f3a25c1a8..e41166c1c 100644 --- a/openpower/power_trans_ops_copy_from_PO59_table.py +++ b/openpower/power_trans_ops_copy_from_PO59_table.py @@ -87,22 +87,23 @@ def process(lr): row = line_parts[1].strip() if row.startswith('`') and row.endswith('`'): row = row[1:-1].strip() - assert row.lstrip(" 01") == "", (f"invalid table line header-cell " - f"contents -- must be a " - f"binary string: {row}") + assert row.lstrip(" 01/.") == "", ( + f"invalid table line header-cell contents -- must be a " + f"binary string: {row}") for i, column in zip(columns_range, columns): cell = line_parts[i] if cell.strip() == "": continue match = re.fullmatch( - r" * *` *(?P[01][01 ]*[01]) *` *" + r" * *` *(?P[01./][01 ./]*[01./]) *` *" r" *
*(?P[a-zA-Z0-9_.][a-zA-Z0-9_.()]*)?" - r"(?(mnemonic)|(?:\([a-zA-Z0-9_.()]+\)|\*\*TBD\*\*|))" + r"(?(mnemonic)|(?:\([a-zA-Z0-9_.()]+\)|" + r"\*\*TBD\*\*| |))" r"(?: *\(draft\))? *", cell) assert match is not None, f"invalid table cell: {cell!r}" xo, mnemonic = match.group("xo", "mnemonic") - shrunk_xo = xo.replace(" ", "") - expected_xo = (row + column).replace(" ", "") + shrunk_xo = xo.replace(" ", "").replace('.', '/') + expected_xo = (row + column).replace(" ", "").replace('.', '/') assert shrunk_xo == expected_xo, \ f"incorrect XO: found {shrunk_xo} expected {expected_xo}" if mnemonic is None: @@ -138,7 +139,7 @@ def process(lr): yield line line, lineno = lr.read() - for _ in range(2): + for _ in range(3): yield from parse_single_mnemonic_to_opcode_map() def skip_table(): -- 2.30.2