pan/bi: Fix handling of constants with COMBINE
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 31 Mar 2020 00:54:51 +0000 (20:54 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 31 Mar 2020 01:12:26 +0000 (01:12 +0000)
We should never see COMBINE constants explicitly since they'll become
moves anyway, so we can simplify that. On the other hand, we do need the
type information for the lowering to work properly.

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

src/panfrost/bifrost/bifrost_compile.c

index f78dfddbcce4d572c411d70bf401bf37031b7360..0eced9713dabb08160fba466ab72c86cd20e6e47 100644 (file)
@@ -320,6 +320,9 @@ emit_load_const(bi_context *ctx, nir_load_const_instr *instr)
                 .src = {
                         BIR_INDEX_CONSTANT
                 },
+                .src_types = {
+                        instr->def.bit_size | nir_type_uint,
+                },
                 .constant = {
                         .u64 = nir_const_value_as_uint(instr->value[0], instr->def.bit_size)
                 }
@@ -560,6 +563,9 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
         unsigned constants_left = (64 / dest_bits);
         unsigned constant_shift = 0;
 
+        if (alu.type == BI_COMBINE)
+                constants_left = 0;
+
         /* Copy sources */
 
         unsigned num_inputs = nir_op_infos[instr->op].num_inputs;