From: Jacob Lifshay Date: Fri, 9 Sep 2022 08:18:24 +0000 (-0700) Subject: add min/max/minmag/maxmag/fmod/remainder ops X-Git-Tag: opf_rfc_ls005_v1~561 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e363081ee0142d6948d5b6c66523d833d0a7711;p=libreriscv.git add min/max/minmag/maxmag/fmod/remainder ops --- diff --git a/openpower/transcendentals.mdwn b/openpower/transcendentals.mdwn index 2648ea63d..77ca0698f 100644 --- a/openpower/transcendentals.mdwn +++ b/openpower/transcendentals.mdwn @@ -178,6 +178,24 @@ compound, exp2m1, exp10m1, log2p1, log10p1, pown (integer power) and powr. |fexp10m1 |NONE |NONE |NONE |exp10m1 |NONE | |flog2p1 |NONE |NONE |NONE |log2p1 |NONE | |flog10p1 |NONE |NONE |NONE |log10p1 |NONE | +|fminnum08 |fmin |fmin |NONE |minNum |xsmindp (5) | +|fmaxnum08 |fmax |fmax |NONE |maxNum |xsmaxdp (5) | +|fmin19 |fmin |fmin |NONE |minimum |NONE | +|fmax19 |fmax |fmax |NONE |maximum |NONE | +|fminnum19 |fmin |fmin |NONE |minimumNumber |vminfp (6), xsminjdp (5)| +|fmaxnum19 |fmax |fmax |NONE |maximumNumber |vmaxfp (6), xsmaxjdp (5)| +|fminc |fmin |fmin |NONE |NONE |xsmincdp (5) | +|fmaxc |fmax |fmax |NONE |NONE |xsmaxcdp (5) | +|fminmagnum08|minmag |minmag |NONE |minNumMag |NONE | +|fmaxmagnum08|maxmag |maxmag |NONE |maxNumMag |NONE | +|fminmag19 |minmag |minmag |NONE |minimumMagnitude |NONE | +|fmaxmag19 |maxmag |maxmag |NONE |maximumMagnitude |NONE | +|fminmagnum19|minmag |minmag |NONE |minimumMagnitudeNumber|NONE | +|fmaxmagnum19|maxmag |maxmag |NONE |maximumMagnitudeNumber|NONE | +|fminmagc |minmag |minmag |NONE |NONE |NONE | +|fmaxmagc |maxmag |maxmag |NONE |NONE |NONE | +|fmod |fmod |fmod | |NONE |NONE | +|fremainder |remainder |remainder | |remainder |NONE | Note (1) fsincos is macro-op fused (see below). @@ -188,6 +206,10 @@ Note (3) synthesised in IEEE754-2019 using "1.0 / x" Note (4) these are estimate opcodes that help accelerate software emulation +Note (5) f64-only (though can be used on f32 stored in f64 format), requires VSX. + +Note (6) 4xf32-only, requires VMX. + ## List of 2-arg opcodes | opcode | Description | pseudocode | Extension | @@ -199,6 +221,42 @@ software emulation | fpowr | x power of y (x +ve) | FRT = exp(FRA log(FRB)) | ZftransAdv | | frootn | x power 1/n (n integer) | FRT = pow(FRA, 1/RB) | ZftransAdv | | fhypot | hypotenuse | FRT = sqrt(FRA^2 + FRB^2) | ZftransAdv | +| fminnum08 | IEEE 754-2008 minNum | FRT = minNum(FRA, FRB) (1) | TBD | +| fmaxnum08 | IEEE 754-2008 maxNum | FRT = maxNum(FRA, FRB) (1) | TBD | +| fmin19 | IEEE 754-2019 minimum | FRT = minimum(FRA, FRB) | TBD | +| fmax19 | IEEE 754-2019 maximum | FRT = maximum(FRA, FRB) | TBD | +| fminnum19 | IEEE 754-2019 minimumNumber | FRT = minimumNumber(FRA, FRB) | TBD | +| fmaxnum19 | IEEE 754-2019 maximumNumber | FRT = maximumNumber(FRA, FRB) | TBD | +| fminc | C ternary-op minimum | FRT = FRA \< FRB ? FRA : FRB | TBD | +| fmaxc | C ternary-op maximum | FRT = FRA > FRB ? FRA : FRB | TBD | +| fminmagnum08 | IEEE 754-2008 minNumMag | FRT = minmaxmag(FRA, FRB, False, fminnum08) (2)| TBD | +| fmaxmagnum08 | IEEE 754-2008 maxNumMag | FRT = minmaxmag(FRA, FRB, True, fmaxnum08) (2) | TBD | +| fminmag19 | IEEE 754-2019 minimumMagnitude | FRT = minmaxmag(FRA, FRB, False, fmin19) (2) | TBD | +| fmaxmag19 | IEEE 754-2019 maximumMagnitude | FRT = minmaxmag(FRA, FRB, True, fmax19) (2) | TBD | +| fminmagnum19 | IEEE 754-2019 minimumMagnitudeNumber | FRT = minmaxmag(FRA, FRB, False, fminnum19) (2)| TBD | +| fmaxmagnum19 | IEEE 754-2019 maximumMagnitudeNumber | FRT = minmaxmag(FRA, FRB, True, fmaxnum19) (2) | TBD | +| fminmagc | C ternary-op minimum magnitude | FRT = minmaxmag(FRA, FRB, False, fminc) (2) | TBD | +| fmaxmagc | C ternary-op maximum magnitude | FRT = minmaxmag(FRA, FRB, True, fmaxc) (2) | TBD | +| fmod | modulus | FRT = fmod(FRA, FRB) | TBD | +| fremainder | IEEE 754 remainder | FRT = remainder(FRA, FRB) | TBD | + +Note (1): for the purposes of minNum/maxNum, -0.0 is defined to be less than +0.0. This is not unspecified in IEEE 754-2008. + +Note (2): minmaxmag(x, y, cmp, fallback) is defined as: + +```python +def minmaxmag(x, y, is_max, fallback): + a = abs(x) < abs(y) + b = abs(x) > abs(y) + if is_max: + a, b = b, a # swap + if a: + return x + if b: + return y + # equal magnitudes, or NaN input(s) + return fallback(x, y) +``` ## List of 1-arg transcendental opcodes