mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 10:50:10 +01:00
pan/bi: Deduplicate csel/cmp cond
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4789>
This commit is contained in:
parent
df486689c0
commit
95fc71ece2
6 changed files with 9 additions and 12 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue