pan/bi: Generalize data register setting
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 20 Mar 2020 16:38:08 +0000 (12:38 -0400)
committerMarge Bot <eric+marge@anholt.net>
Sun, 22 Mar 2020 03:32:35 +0000 (03:32 +0000)
So we can use it for stores too.

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

src/panfrost/bifrost/bi_pack.c

index 4555b53e56e7d012eca30b173ebbe1c0b811e4de..c8070dbf96b4d5ae2743f1f8a36a1247df53961c 100644 (file)
@@ -355,14 +355,26 @@ bi_pack_registers(struct bi_registers regs)
 }
 
 static void
-bi_write_data_register(bi_clause *clause, bi_instruction *ins)
+bi_set_data_register(bi_clause *clause, unsigned idx)
 {
-        assert(ins->dest & BIR_INDEX_REGISTER);
-        unsigned reg = ins->dest & ~BIR_INDEX_REGISTER;
+        assert(idx & BIR_INDEX_REGISTER);
+        unsigned reg = idx & ~BIR_INDEX_REGISTER;
         assert(reg <= 63);
         clause->data_register = reg;
 }
 
+static void
+bi_read_data_register(bi_clause *clause, bi_instruction *ins)
+{
+        bi_set_data_register(clause, ins->src[0]);
+}
+
+static void
+bi_write_data_register(bi_clause *clause, bi_instruction *ins)
+{
+        bi_set_data_register(clause, ins->dest);
+}
+
 static enum bifrost_packed_src
 bi_get_src_reg_port(struct bi_registers *regs, unsigned src)
 {