pan/midgard: Expose more typesize helpers
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 15 Nov 2019 20:16:28 +0000 (15:16 -0500)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 18 Nov 2019 02:30:14 +0000 (21:30 -0500)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/compiler.h
src/panfrost/midgard/mir.c

index 635c0cc14c54b6a1339226e5061351f55b9e10d0..3c70f071814e8862a11a56d4c73edd28400793ce 100644 (file)
@@ -518,7 +518,9 @@ unsigned mir_ubo_shift(midgard_load_store_op op);
 midgard_reg_mode mir_typesize(midgard_instruction *ins);
 midgard_reg_mode mir_srcsize(midgard_instruction *ins, unsigned i);
 unsigned mir_bytes_for_mode(midgard_reg_mode mode);
+midgard_reg_mode mir_mode_for_destsize(unsigned size);
 uint16_t mir_from_bytemask(uint16_t bytemask, midgard_reg_mode mode);
+uint16_t mir_to_bytemask(midgard_reg_mode mode, unsigned mask);
 uint16_t mir_bytemask(midgard_instruction *ins);
 uint16_t mir_round_bytemask_down(uint16_t mask, midgard_reg_mode mode);
 void mir_set_bytemask(midgard_instruction *ins, uint16_t bytemask);
index 7c7149bd547c695b433694ab8696d1d2a907578d..8d928458a54e4d79097e52183a8df6b3a7a6ea18 100644 (file)
@@ -283,9 +283,27 @@ mir_srcsize(midgard_instruction *ins, unsigned i)
         return mode;
 }
 
+midgard_reg_mode
+mir_mode_for_destsize(unsigned size)
+{
+        switch (size) {
+        case 8:
+                return midgard_reg_mode_8;
+        case 16:
+                return midgard_reg_mode_16;
+        case 32:
+                return midgard_reg_mode_32;
+        case 64:
+                return midgard_reg_mode_64;
+        default:
+                unreachable("Unknown destination size");
+        }
+}
+
+
 /* Converts per-component mask to a byte mask */
 
-static uint16_t
+uint16_t
 mir_to_bytemask(midgard_reg_mode mode, unsigned mask)
 {
         switch (mode) {