Commit 8eefb276 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜 Committed by Marge Bot
Browse files

pan/bi: Match CSEL argument order with hw



It turns out ports need to be in order of the arguments of an
instruction (port 3, that is), which breaks on instructions whose IR
argument order is different from the packed order, like csel. So fix
that.
Signed-off-by: Alyssa Rosenzweig's avatarAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <mesa/mesa!4458>
parent 9114ebbe
......@@ -691,10 +691,10 @@ bi_pack_fma_csel(bi_instruction *ins, struct bi_registers *regs)
unsigned size = nir_alu_type_get_type_size(ins->dest_type);
unsigned cmp_0 = (flip ? 3 : 0);
unsigned cmp_1 = (flip ? 0 : 3);
unsigned res_0 = (invert ? 2 : 1);
unsigned res_1 = (invert ? 1 : 2);
unsigned cmp_0 = (flip ? 1 : 0);
unsigned cmp_1 = (flip ? 0 : 1);
unsigned res_0 = (invert ? 3 : 2);
unsigned res_1 = (invert ? 2 : 3);
struct bifrost_csel4 pack = {
.src0 = bi_get_src(ins, regs, cmp_0, true),
......
......@@ -520,7 +520,7 @@ bi_fuse_csel_cond(bi_instruction *csel, nir_alu_src cond,
/* We found one, let's fuse it in */
csel->csel_cond = bcond;
bi_copy_src(csel, alu, 0, 0, constants_left, constant_shift);
bi_copy_src(csel, alu, 1, 3, constants_left, constant_shift);
bi_copy_src(csel, alu, 1, 1, constants_left, constant_shift);
}
static void
......@@ -571,8 +571,14 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
unsigned num_inputs = nir_op_infos[instr->op].num_inputs;
assert(num_inputs <= ARRAY_SIZE(alu.src));
for (unsigned i = 0; i < num_inputs; ++i)
bi_copy_src(&alu, instr, i, i, &constants_left, &constant_shift);
for (unsigned i = 0; i < num_inputs; ++i) {
unsigned f = 0;
if (i && alu.type == BI_CSEL)
f++;
bi_copy_src(&alu, instr, i, i + f, &constants_left, &constant_shift);
}
/* Op-specific fixup */
switch (instr->op) {
......@@ -642,8 +648,8 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
if (alu.type == BI_CSEL) {
/* Default to csel3 */
alu.csel_cond = BI_COND_NE;
alu.src[3] = BIR_INDEX_ZERO;
alu.src_types[3] = alu.src_types[0];
alu.src[1] = BIR_INDEX_ZERO;
alu.src_types[1] = alu.src_types[0];
bi_fuse_csel_cond(&alu, instr->src[0],
&constants_left, &constant_shift);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment