From: Luke Kenneth Casson Leighton Date: Thu, 12 Sep 2019 03:36:39 +0000 (+0100) Subject: add FPOWN and FPOWR X-Git-Tag: convert-csv-opcode-to-binary~4091 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bbb2e655d9b795b4fd062311dbb4898298c3bb6d;p=libreriscv.git add FPOWN and FPOWR --- diff --git a/rv_major_opcode_1010011.mdwn b/rv_major_opcode_1010011.mdwn index 5a5cb4fcb..1e445a523 100644 --- a/rv_major_opcode_1010011.mdwn +++ b/rv_major_opcode_1010011.mdwn @@ -63,8 +63,8 @@ funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 01110 | xx | rs2 | rs1 | rm | rd | 1010011 | **FATAN2PI.xx**| 01111 | xx | rs2 | rs1 | rm | rd | 1010011 | **FPOW.xx** | 10000 | xx | rs2 | rs1 | yyy | rd | 1010011 | **FROOTN.xx** | -10001 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -10010 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +10001 | xx | rs2 | rs1 | yyy | rd | 1010011 | **FPOWN.xx** | +10010 | xx | rs2 | rs1 | yyy | rd | 1010011 | **FPOWR.xx** | 10011 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | 10100 | xx | rs2 | rs1 | yyy | rd | 1010011 | tb=10100 | 10101 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | @@ -262,13 +262,15 @@ Proposed for ZftransAdv - FPOW: "FP rs1 to the power of rs2" Proposed for ZftransAdv - FPROOTN: "FP rs1 to the power of (1/rs2)". rs1 is FP, rs2 is **integer**. -## funct5 = 10000 - unused +## funct5 = 10000 - **FPOWN** -Brownfield encodings available. +Proposed for ZftransAdv - FPOW: "FP rs1 to the power of rs2" +rs1 is FP, rs2 is **integer**. -## funct5 = 10001 - unused +## funct5 = 10001 - **FPOW** -Brownfield encodings available. +Proposed for ZftransAdv - FPOWN: "FP rs1 to the power of rs2, rs1 +ve" +rs1 and rs2 are FP, rs1 must be +ve. Equivalent to "exp(rs2 * log(rs1))" ## funct5 = 10010 - unused diff --git a/ztrans_proposal.mdwn b/ztrans_proposal.mdwn index 7610755be..996fd203a 100644 --- a/ztrans_proposal.mdwn +++ b/ztrans_proposal.mdwn @@ -363,7 +363,7 @@ FATANH | atanh | NONE | NONE | NONE | atanh | FATAN2 | atan2 | NONE | NONE | NONE | atan2 | FATAN2PI | atan2pi | NONE | NONE | NONE | atan2pi | FRSQRT | rsqrt | half\_rsqrt | native\_rsqrt | NONE | rSqrt | -FCBRT | cbrt | NONE | NONE | NONE | NONE (4) | +FCBRT | cbrt | NONE | NONE | NONE | NONE (2) | FEXP2 | exp2 | half\_exp2 | native\_exp2 | NONE | exp2 | FLOG2 | log2 | half\_log2 | native\_log2 | NONE | log2 | FEXPM1 | expm1 | NONE | NONE | NONE | expm1 | @@ -373,16 +373,16 @@ FLOG | log | half\_log | native\_log | NONE | log | FEXP10 | exp10 | half\_exp10 | native\_exp10 | NONE | exp10 | FLOG10 | log10 | half\_log10 | native\_log10 | NONE | log10 | FPOW | pow | NONE | NONE | NONE | pow | +FPOWN | pown | NONE | NONE | NONE | pown | +FPOWR | powr | NONE | NONE | NONE | powr | FROOTN | rootn | NONE | NONE | NONE | rootn | FHYPOT | hypot | NONE | NONE | NONE | hypot | -FRECIP | NONE | half\_recip | native\_recip | NONE | NONE (5) | +FRECIP | NONE | half\_recip | native\_recip | NONE | NONE (3) | NONE | NONE | NONE | NONE | NONE | compound | NONE | NONE | NONE | NONE | NONE | exp2m1 | NONE | NONE | NONE | NONE | NONE | exp10m1 | NONE | NONE | NONE | NONE | NONE | log2p1 | NONE | NONE | NONE | NONE | NONE | log10p1 | -NONE | NONE | NONE | NONE | NONE | pown (2) | -NONE | NONE | NONE | NONE | NONE | powr (3) | """]] Note (1) FSINCOS is macro-op fused (see below). @@ -391,9 +391,9 @@ Note (2) IEEE754-2019 pown(x, n) - n is an integer Note (3) IEEE754-2019 powr(x, y) is defined as "exp(y log (x))" -Note (4) synthesised in IEEE754-2019 as "pown(x, 3)" +Note (2) synthesised in IEEE754-2019 as "pown(x, 3)" -Note (5) synthesised in IEEE754-2019 using "1.0 / x" +Note (3) synthesised in IEEE754-2019 using "1.0 / x" ## List of 2-arg opcodes @@ -402,6 +402,8 @@ 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 | """]] @@ -435,7 +437,6 @@ 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 | @@ -556,7 +557,7 @@ HPC and high-end GPUs are likely markets for these. ### ZftransAdv -CBRT, POW, ROOTN +CBRT, POW, POWN, POWR, ROOTN These are simply much more complex to implement in hardware, and typically will only be put into HPC applications.