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>
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 {
} 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 */
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;
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;
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);