pan/bi: Deduplicate csel/cmp cond
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 27 Apr 2020 18:15:57 +0000 (14:15 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Apr 2020 17:17:48 +0000 (17:17 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4789>

src/panfrost/bifrost/bi_pack.c
src/panfrost/bifrost/bi_print.c
src/panfrost/bifrost/bifrost_compile.c
src/panfrost/bifrost/compiler.h
src/panfrost/bifrost/test/bi_interpret.c
src/panfrost/bifrost/test/bi_test_pack.c

index 5ae911e35484f361512d906037db68062d0059bf..af5193949f8e3a64b2aa3fa2192873a8a7f71d78 100644 (file)
@@ -772,7 +772,7 @@ bi_pack_fma_csel(bi_instruction *ins, struct bi_registers *regs)
         bool flip = false, invert = false;
 
         enum bifrost_csel_cond cond =
-                bi_cond_to_csel(ins->csel_cond, &flip, &invert, ins->src_types[0]);
+                bi_cond_to_csel(ins->cond, &flip, &invert, ins->src_types[0]);
 
         unsigned size = nir_alu_type_get_type_size(ins->dest_type);
 
index aff319791e03fce99dbf4e8e7f6239eb1a400e05..b1ecc662ada6c714cd177a61c0c82450f718ac76 100644 (file)
@@ -362,8 +362,6 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
                 fprintf(fp, "%s", bi_reduce_op_name(ins->op.reduce));
         else if (ins->type == BI_FREXP)
                 fprintf(fp, "%s", bi_frexp_op_name(ins->op.frexp));
-        else if (ins->type == BI_CMP)
-                fprintf(fp, "%s", bi_cond_name(ins->op.compare));
         else
                 fprintf(fp, "%s", bi_class_name(ins->type));
 
@@ -376,8 +374,8 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
                 bi_print_load_vary(&ins->load_vary, fp);
         else if (ins->type == BI_BRANCH)
                 bi_print_branch(&ins->branch, fp);
-        else if (ins->type == BI_CSEL)
-                fprintf(fp, ".%s", bi_cond_name(ins->csel_cond));
+        else if (ins->type == BI_CSEL || ins->type == BI_CMP)
+                fprintf(fp, ".%s", bi_cond_name(ins->cond));
         else if (ins->type == BI_BLEND)
                 fprintf(fp, ".loc%u", ins->blend_location);
         else if (ins->type == BI_TEX)
index 5dfe12d0a55f365f50e2119cd8ff422be640160b..a23a6121ccebd7877ab6ce157abcb62504bbb2ea 100644 (file)
@@ -533,7 +533,7 @@ bi_fuse_csel_cond(bi_instruction *csel, nir_alu_src cond,
                 return;
 
         /* We found one, let's fuse it in */
-        csel->csel_cond = bcond;
+        csel->cond = bcond;
         bi_copy_src(csel, alu, 0, 0, constants_left, constant_shift, comps);
         bi_copy_src(csel, alu, 1, 1, constants_left, constant_shift, comps);
 }
@@ -636,7 +636,7 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
         BI_CASE_CMP(nir_op_ieq)
         BI_CASE_CMP(nir_op_fne)
         BI_CASE_CMP(nir_op_ine)
-                alu.op.compare = bi_cond_for_nir(instr->op, false);
+                alu.cond = bi_cond_for_nir(instr->op, false);
                 break;
         case nir_op_fround_even:
                 alu.op.round = BI_ROUND_MODE;
@@ -660,7 +660,7 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
 
         if (alu.type == BI_CSEL) {
                 /* Default to csel3 */
-                alu.csel_cond = BI_COND_NE;
+                alu.cond = BI_COND_NE;
                 alu.src[1] = BIR_INDEX_ZERO;
                 alu.src_types[1] = alu.src_types[0];
 
index b18232e58463f1e6e7cf88965a668239133ad574..4b3d1c68e51fdd9fa68295e474a0f0d77bf3fb72 100644 (file)
@@ -278,7 +278,6 @@ typedef struct {
                 enum bi_reduce_op reduce;
                 enum bi_table_op table;
                 enum bi_frexp_op frexp;
-                enum bi_cond compare;
                 enum bi_tex_op texture;
 
                 /* For FMA/ADD, should we add a biased exponent? */
@@ -293,7 +292,7 @@ typedef struct {
 
                 /* For CSEL, the comparison op. BI_COND_ALWAYS doesn't make
                  * sense here but you can always just use a move for that */
-                enum bi_cond csel_cond;
+                enum bi_cond cond;
 
                 /* For BLEND -- the location 0-7 */
                 unsigned blend_location;
index 449770bf833e0529a0ea65157bb097e9f30f5ff2..609a0c7eede34d360e64fd7e97a71a20210d38a8 100644 (file)
@@ -433,7 +433,7 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA)
         }
 
         case BI_CSEL: {
-                bool direct = ins->csel_cond == BI_COND_ALWAYS;
+                bool direct = ins->cond == BI_COND_ALWAYS;
                 bool cond = direct ? srcs[0].u32 :
                         bit_eval_cond(ins->csel_cond, srcs[0], srcs[1], ins->src_types[0], 0);
 
index a4d86855eb997d1512470b8920611adaab65b868..969bd0583245cc59058814e357e2f3f27b6475bc 100644 (file)
@@ -285,7 +285,7 @@ bit_csel_helper(struct panfrost_device *dev,
         ins.src[2] = ins.src[0];
 
         for (enum bi_cond cond = BI_COND_LT; cond <= BI_COND_NE; ++cond) {
-                ins.csel_cond = cond;
+                ins.cond = cond;
 
                 if (!bit_test_single(dev, &ins, input, true, debug)) {
                         fprintf(stderr, "FAIL: csel%u.%s\n",