pan/mdg: eliminate references to ins->alu.outmod

In an effort to simplify MIR by not prepacking instructions, this commit
removes references to `ins->alu.outmod` so that we can later remove the
`ins->alu` field from midgard_instruction.
Every place that was using `ins->alu.outmod` was changed to now use the
generic `ins->outmod` field instead.
We then reconstruct the outmod field right before emission.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
This commit is contained in:
Italo Nicola 2020-07-15 18:43:18 +00:00 committed by Marge Bot
parent f34815c6be
commit 5011373e2b
4 changed files with 11 additions and 10 deletions

View File

@ -178,6 +178,12 @@ typedef struct midgard_instruction {
/* Use this in conjunction with `type` */
unsigned op;
/* This refers to midgard_outmod_float or midgard_outmod_int.
* In case of a ALU op, use midgard_is_integer_out_op() to know which
* one is used.
* If it's a texture op, it's always midgard_outmod_float. */
unsigned outmod;
union {
midgard_load_store_word load_store;
midgard_vector_alu alu;
@ -556,9 +562,7 @@ v_mov(unsigned src, unsigned dest)
.dest = dest,
.dest_type = nir_type_uint32,
.op = midgard_alu_op_imov,
.alu = {
.outmod = midgard_outmod_int_wrap
},
.outmod = midgard_outmod_int_wrap
};
return ins;

View File

@ -1161,10 +1161,6 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
ins.mask = mask_of(nr_components);
midgard_vector_alu alu = {
.outmod = outmod,
};
/* Apply writemask if non-SSA, keeping in mind that we can't write to
* components that don't exist. Note modifier => SSA => !reg => no
* writemask, so we don't have to worry about writemasks here.*/
@ -1172,9 +1168,8 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
if (!is_ssa)
ins.mask &= instr->dest.write_mask;
ins.alu = alu;
ins.op = op;
ins.outmod = outmod;
/* Late fixup for emulated instructions */

View File

@ -492,6 +492,7 @@ vector_alu_from_instr(midgard_instruction *ins)
{
midgard_vector_alu alu = ins->alu;
alu.op = ins->op;
alu.outmod = ins->outmod;
alu.reg_mode = reg_mode_for_bitsize(max_bitsize_for_alu(ins));
return alu;
}
@ -699,6 +700,7 @@ emit_binary_bundle(compiler_context *ctx,
ins->texture.out_upper = override > 0;
ins->texture.in_reg_full = (isz == 32);
ins->texture.sampler_type = midgard_sampler_type(ins->dest_type);
ins->texture.outmod = ins->outmod;
if (mir_op_computes_derivatives(ctx->stage, ins->texture.op)) {
ins->texture.cont = !ins->helper_terminate;

View File

@ -141,7 +141,7 @@ bool
mir_nontrivial_outmod(midgard_instruction *ins)
{
bool is_int = midgard_is_integer_op(ins->op);
unsigned mod = ins->alu.outmod;
unsigned mod = ins->outmod;
if (ins->dest_type != ins->src_types[1])
return true;