pan/mdg: Treat packs "specially"
We maybe would prefer synthetic ops? We'll find out in due time.. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5265>
This commit is contained in:
committed by
Marge Bot
parent
c495c6c295
commit
e9c780b1d0
@@ -101,6 +101,11 @@ typedef struct midgard_instruction {
|
||||
nir_alu_type src_types[MIR_SRC_COUNT];
|
||||
nir_alu_type dest_type;
|
||||
|
||||
/* Packing ops have non-32-bit dest types even though they functionally
|
||||
* work at the 32-bit level, use this as a signal to disable copyprop.
|
||||
* We maybe need synthetic pack ops instead. */
|
||||
bool is_pack;
|
||||
|
||||
/* Modifiers, depending on type */
|
||||
union {
|
||||
struct {
|
||||
|
||||
@@ -1089,15 +1089,19 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
|
||||
} else if (instr->op == nir_op_pack_32_2x16) {
|
||||
ins.dest_type = nir_type_uint16;
|
||||
ins.mask = mask_of(nr_components * 2);
|
||||
ins.is_pack = true;
|
||||
} else if (instr->op == nir_op_pack_32_4x8) {
|
||||
ins.dest_type = nir_type_uint8;
|
||||
ins.mask = mask_of(nr_components * 4);
|
||||
ins.is_pack = true;
|
||||
} else if (instr->op == nir_op_unpack_32_2x16) {
|
||||
ins.dest_type = nir_type_uint32;
|
||||
ins.mask = mask_of(nr_components >> 1);
|
||||
ins.is_pack = true;
|
||||
} else if (instr->op == nir_op_unpack_32_4x8) {
|
||||
ins.dest_type = nir_type_uint32;
|
||||
ins.mask = mask_of(nr_components >> 2);
|
||||
ins.is_pack = true;
|
||||
}
|
||||
|
||||
/* Arrange for creation of iandnot/iornot */
|
||||
|
||||
@@ -35,6 +35,7 @@ midgard_opt_copy_prop_reg(compiler_context *ctx, midgard_block *block)
|
||||
mir_foreach_instr_in_block_safe(block, ins) {
|
||||
if (ins->type != TAG_ALU_4) continue;
|
||||
if (!OP_IS_MOVE(ins->alu.op)) continue;
|
||||
if (ins->is_pack) continue;
|
||||
|
||||
unsigned from = ins->src[1];
|
||||
unsigned to = ins->dest;
|
||||
@@ -68,6 +69,7 @@ midgard_opt_copy_prop(compiler_context *ctx, midgard_block *block)
|
||||
mir_foreach_instr_in_block_safe(block, ins) {
|
||||
if (ins->type != TAG_ALU_4) continue;
|
||||
if (!OP_IS_MOVE(ins->alu.op)) continue;
|
||||
if (ins->is_pack) continue;
|
||||
|
||||
unsigned from = ins->src[1];
|
||||
unsigned to = ins->dest;
|
||||
|
||||
@@ -511,6 +511,9 @@ allocate_registers(compiler_context *ctx, bool *spilled)
|
||||
|
||||
unsigned size = nir_alu_type_get_type_size(ins->dest_type);
|
||||
|
||||
if (ins->is_pack)
|
||||
size = 32;
|
||||
|
||||
/* 0 for x, 1 for xy, 2 for xyz, 3 for xyzw */
|
||||
int comps1 = util_logbase2(ins->mask);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user