r600/sb: Add support for INTERP_X and INTERP_Z ops
authorGert Wollny <gert.wollny@collabora.com>
Mon, 18 Jan 2021 17:04:16 +0000 (18:04 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 20 Jan 2021 12:12:07 +0000 (12:12 +0000)
v2: Fix parsing the 2-slot instructions

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

src/gallium/drivers/r600/sb/sb_bc_parser.cpp
src/gallium/drivers/r600/sb/sb_dump.cpp
src/gallium/drivers/r600/sb/sb_ir.h

index abbb26c..446486c 100644 (file)
@@ -385,6 +385,9 @@ int bc_parser::prepare_alu_group(cf_node* cf, alu_group_node *g) {
                if (ctx.alu_slots(n->bc.op) & AF_4SLOT)
                        n->flags |= NF_ALU_4SLOT;
 
+               if (ctx.alu_slots(n->bc.op) & AF_2SLOT)
+                       n->flags |= NF_ALU_2SLOT;
+
                n->src.resize(src_count);
 
                unsigned flags = n->bc.op_ptr->flags;
@@ -586,12 +589,16 @@ int bc_parser::prepare_alu_group(cf_node* cf, alu_group_node *g) {
                alu_node *a = static_cast<alu_node*>(*I);
                unsigned sflags = a->bc.slot_flags;
 
-               if (sflags == AF_4V || (ctx.is_cayman() && sflags == AF_S)) {
+               if (sflags == AF_4V || sflags == AF_2V  || (ctx.is_cayman() && sflags == AF_S)) {
                        if (!p)
                                p = sh->create_alu_packed();
 
                        a->remove();
                        p->push_back(a);
+                        if (sflags == AF_2V && p->count() == 2) {
+                           g->push_front(p);
+                           p = NULL;
+                        }
                }
        }
 
index 57dded5..402ba35 100644 (file)
@@ -396,6 +396,8 @@ void dump::dump_flags(node &n) {
                sblog << "CH_CONS  ";
        if (n.flags & NF_ALU_4SLOT)
                sblog << "4S  ";
+       if (n.flags & NF_ALU_2SLOT)
+               sblog << "2S  ";
 }
 
 void dump::dump_val(value* v) {
index 2d62944..7a6742d 100644 (file)
@@ -713,7 +713,8 @@ enum node_flags {
        NF_SCHEDULE_EARLY = (1 << 9),
 
        // for ALU_PUSH_BEFORE - when set, replace with PUSH + ALU
-       NF_ALU_STACK_WORKAROUND = (1 << 10)
+       NF_ALU_STACK_WORKAROUND = (1 << 10),
+       NF_ALU_2SLOT = (1 << 11),
 };
 
 inline node_flags operator |(node_flags l, node_flags r) {
@@ -1021,8 +1022,9 @@ public:
        virtual bool fold_dispatch(expr_handler *ex);
 
        unsigned forced_bank_swizzle() {
-               return ((bc.op_ptr->flags & AF_INTERP) && (bc.slot_flags == AF_4V)) ?
-                               VEC_210 : 0;
+               return ((bc.op_ptr->flags & AF_INTERP) &&
+                       ((bc.slot_flags == AF_4V) ||
+                        (bc.slot_flags == AF_2V))) ? VEC_210 : 0;
        }
 
        // return param index + 1 if instruction references interpolation param,