Mesa (main): pan/bi: Add Valhall's special FMA_RSCALE instructions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 18 23:34:31 UTC 2021


Module: Mesa
Branch: main
Commit: 58b65a340c85d762761825f1d0c0943569469125
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=58b65a340c85d762761825f1d0c0943569469125

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Mon Nov 15 18:19:57 2021 -0500

pan/bi: Add Valhall's special FMA_RSCALE instructions

Like Bifrost, but exposed as separate physical instructions.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13802>

---

 src/panfrost/bifrost/valhall/ISA.xml | 47 ++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/src/panfrost/bifrost/valhall/ISA.xml b/src/panfrost/bifrost/valhall/ISA.xml
index 15417dbe7f9..73eac8b7a84 100644
--- a/src/panfrost/bifrost/valhall/ISA.xml
+++ b/src/panfrost/bifrost/valhall/ISA.xml
@@ -1733,4 +1733,51 @@
     <src>D</src>
   </ins>
 
+  <ins name="FMA_RSCALE_N.f32" title="Fused floating-point multiply add with exponent bias and zero override" dests="1" opcode="0x161" unit="FMA">
+    <desc>
+      First calculates $A \cdot B + C$ and then biases the exponent by D. If $A
+      = 0$ or $B = 0$, the multiply $A \cdot B$ is treated as zero even if an
+      ordinary multiply would return NaN. Used in special transcendental
+      function sequences. It should not be used for general code as its special
+      case handling differs from two back-to-back `FMA.f32` operations.
+      Equivalent to `FMA.f32` back-to-back with `RSCALE.f32`
+    </desc>
+    <clamp/>
+    <src absneg="true">A</src>
+    <src absneg="true">B</src>
+    <src absneg="true">C</src>
+    <src>D</src>
+  </ins>
+
+  <ins name="FMA_RSCALE_LEFT.f32" title="Fused floating-point multiply add with exponent bias and asymmetric zero handling" dests="1" opcode="0x162" unit="FMA">
+    <desc>
+      First calculates $A \cdot B + C$ and then biases the exponent by D. If $A
+      = 0$ or $B = 0$, the multiply is treated as $A$ even if an
+      ordinary multiply would return NaN. Used in special transcendental
+      function sequences. It should not be used for general code as its special
+      case handling differs from two back-to-back `FMA.f32` operations.
+      Equivalent to `FMA.f32` back-to-back with `RSCALE.f32`
+    </desc>
+    <clamp/>
+    <src absneg="true">A</src>
+    <src absneg="true">B</src>
+    <src absneg="true">C</src>
+    <src>D</src>
+  </ins>
+
+  <ins name="FMA_RSCALE_SCALE16.f32" title="Fused floating-point multiply add with 16-bit exponent bias" dests="1" opcode="0x163" unit="FMA">
+    <desc>
+      First calculates $A \cdot B + C$ and then biases the exponent by D,
+      interpreted as a 16-bit value. Used in special transcendental function
+      sequences. It should not be used for general code as its special case
+      handling differs from two back-to-back `FMA.f32` operations.  Equivalent
+      to `FMA.f32` back-to-back with `RSCALE.f32`
+    </desc>
+    <clamp/>
+    <src absneg="true">A</src>
+    <src absneg="true">B</src>
+    <src absneg="true">C</src>
+    <src>D</src>
+  </ins>
+
 </valhall>



More information about the mesa-commit mailing list