summaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-11-15 15:16:28 -0500
committerAlyssa Rosenzweig <[email protected]>2019-11-17 21:30:14 -0500
commit34a860b9e3c544ad82b8287e1b65a93c53bd7f62 (patch)
tree402dfe231021cd982f67b0fd06243add56671508 /src/panfrost
parent2236904f722d02d82232cf02f8160c2c5315c711 (diff)
pan/midgard: Expose more typesize helpers
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/midgard/compiler.h2
-rw-r--r--src/panfrost/midgard/mir.c20
2 files changed, 21 insertions, 1 deletions
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index 635c0cc14c5..3c70f071814 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -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);
diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c
index 7c7149bd547..8d928458a54 100644
--- a/src/panfrost/midgard/mir.c
+++ b/src/panfrost/midgard/mir.c
@@ -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) {