Mesa (main): pan/bi: Add full form of Valhall MUX instruction

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


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

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

pan/bi: Add full form of Valhall MUX instruction

Like Bifrost.

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 | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/bifrost/valhall/ISA.xml b/src/panfrost/bifrost/valhall/ISA.xml
index 3dcd81fb72b..e84ca54eeeb 100644
--- a/src/panfrost/bifrost/valhall/ISA.xml
+++ b/src/panfrost/bifrost/valhall/ISA.xml
@@ -576,6 +576,20 @@
     <value name="0x7C007C00">v2inf</value>
   </enum>
 
+  <enum name="Mux">
+    <desc>
+      Condition to use for a `MUX` instruction. `neg` checks the sign bit,
+      `int_zero` compares to `0x00000000`, `fp_zero` compares to $\pm 0.0$ as
+      an IEEE 754 float, and `bit` checks each bit separately. The `bit` mode
+      acts like an imaginary `CSEL.v32i1` instruction, and implements
+      `bitselect()` in OpenCL.
+    </desc>
+    <value desc="Negative">neg</value>
+    <value desc="Integer zero" default="true">int_zero</value>
+    <value desc="Floating point zero">fp_zero</value>
+    <value desc="Bitwise">bit</value>
+  </enum>
+
   <ins name="NOP" title="No operation" dests="0" opcode="0x00" unit="CVT">
     <desc>
       Do nothing. Useful at the start of a block for waiting on slots required
@@ -1430,9 +1444,13 @@
 
   <ins name="MUX.i32" title="Mux" dests="1" opcode="0xB8" unit="SFU">
     <desc>
-      Mux between A and B based on the provided mask. Equivalent to
-      `bitselect()` in OpenCL. `(A & mask) | (A & ~mask)`
+      Mux between A and B based on the provided mask. The condition specified
+      as the `mux` modifier is evaluated on the mask. If true, `A` is chosen,
+      else `B` is chosen. The `bit` modifier acts bitwise, equivalent to
+      `bitselect()` in OpenCL, so `MUX.i32.bit A, B, mask` calculates
+      `(A & mask) | (A & ~mask)`.
     </desc>
+    <mod name="mux" start="32" size="2"/>
     <src>A</src>
     <src>B</src>
     <src>Mask</src>



More information about the mesa-commit mailing list