mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
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 <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>
This commit is contained in:
parent
9114ebbe79
commit
8eefb2765a
2 changed files with 15 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue