pan/bi: Add bitwise modifiers
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 28 Apr 2020 17:48:37 +0000 (13:48 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Apr 2020 00:30:05 +0000 (00:30 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4790>

src/panfrost/bifrost/bi_print.c
src/panfrost/bifrost/compiler.h

index e67a14857806e31280a84e362ac43d9dfef61015..1c9c8a72a314ce329f7e08375d56ab038d778f3e 100644 (file)
@@ -206,6 +206,9 @@ bi_print_src(FILE *fp, bi_instruction *ins, unsigned s)
         if (abs)
                 fprintf(fp, "abs(");
 
+        if (ins->type == BI_BITWISE && ins->bitwise.src_invert[s])
+                fprintf(fp, "~");
+
         bi_print_index(fp, ins, src, s);
 
         if (abs)
@@ -378,6 +381,8 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
                 fprintf(fp, ".loc%u", ins->blend_location);
         else if (ins->type == BI_TEX)
                 fprintf(fp, ".%s", bi_tex_op_name(ins->op.texture));
+        else if (ins->type == BI_BITWISE)
+                fprintf(fp, ".%cshift", ins->bitwise.rshift ? 'r' : 'l');
 
         if (ins->vector_channels)
                 fprintf(fp, ".v%u", ins->vector_channels);
index 4178352f3a8372625ca3da5d8be8b3065ce4d00e..0716cf342eff53814c44af3f746f4bdfaa30e94f 100644 (file)
@@ -214,6 +214,11 @@ enum bi_tex_op {
         BI_TEX_DUAL
 };
 
+struct bi_bitwise {
+        bool src_invert[2];
+        bool rshift; /* false for lshift */
+};
+
 typedef struct {
         struct list_head link; /* Must be first */
         enum bi_class type;
@@ -290,6 +295,8 @@ typedef struct {
 
                 /* For BLEND -- the location 0-7 */
                 unsigned blend_location;
+
+                struct bi_bitwise bitwise;
         };
 } bi_instruction;