panfrost/midgard: Fix handling of csel with a vector constant condition.
authorEmma Anholt <emma@anholt.net>
Mon, 27 Feb 2023 22:24:07 +0000 (14:24 -0800)
committerMarge Bot <emma+marge@anholt.net>
Tue, 28 Feb 2023 06:13:05 +0000 (06:13 +0000)
If it's not all true or all false, then you'll have a csel with a vector
constant, and the backend failed to translate appropriately.  Expand the
constant to fix it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21476>

src/panfrost/midgard/midgard_compile.c

index 13d454f..e067d0a 100644 (file)
@@ -947,6 +947,9 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
       op = is_float ? (mixed ? midgard_alu_op_fcsel_v : midgard_alu_op_fcsel)
                     : (mixed ? midgard_alu_op_icsel_v : midgard_alu_op_icsel);
 
+      int index = nir_src_index(ctx, &instr->src[0].src);
+      emit_explicit_constant(ctx, index, index);
+
       break;
    }