Lines Matching refs:ins

28 void mir_rewrite_index_src_single(midgard_instruction *ins, unsigned old, unsigned new)
30 mir_foreach_src(ins, i) {
31 if (ins->src[i] == old)
32 ins->src[i] = new;
36 void mir_rewrite_index_dst_single(midgard_instruction *ins, unsigned old, unsigned new)
38 if (ins->dest == old)
39 ins->dest = new;
43 mir_rewrite_index_src_single_swizzle(midgard_instruction *ins, unsigned old, unsigned new, unsigned *swizzle)
45 for (unsigned i = 0; i < ARRAY_SIZE(ins->src); ++i) {
46 if (ins->src[i] != old) continue;
48 ins->src[i] = new;
49 mir_compose_swizzle(ins->swizzle[i], swizzle, ins->swizzle[i]);
56 mir_foreach_instr_global(ctx, ins) {
57 mir_rewrite_index_src_single(ins, old, new);
64 mir_foreach_instr_global(ctx, ins) {
65 mir_rewrite_index_src_single_swizzle(ins, old, new, swizzle);
72 mir_foreach_instr_global(ctx, ins) {
73 mir_rewrite_index_dst_single(ins, old, new);
96 mir_foreach_instr_global(ctx, ins) {
97 if (mir_has_arg(ins, value))
124 mir_nontrivial_mod(midgard_instruction *ins, unsigned i, bool check_swizzle)
126 bool is_int = midgard_is_integer_op(ins->op);
129 if (ins->src_shift[i]) return true;
131 if (ins->src_neg[i]) return true;
132 if (ins->src_abs[i]) return true;
135 if (ins->dest_type != ins->src_types[i]) return true;
139 if (!(ins->mask & (1 << c))) continue;
140 if (ins->swizzle[i][c] != c) return true;
148 mir_nontrivial_outmod(midgard_instruction *ins)
150 bool is_int = midgard_is_integer_op(ins->op);
151 unsigned mod = ins->outmod;
153 if (ins->dest_type != ins->src_types[1])
222 mir_bytemask(midgard_instruction *ins)
224 unsigned type_size = nir_alu_type_get_type_size(ins->dest_type);
225 return pan_to_bytemask(type_size, ins->mask);
229 mir_set_bytemask(midgard_instruction *ins, uint16_t bytemask)
231 unsigned type_size = nir_alu_type_get_type_size(ins->dest_type);
232 ins->mask = mir_from_bytemask(bytemask, type_size);
239 mir_upper_override(midgard_instruction *ins, unsigned inst_size)
241 unsigned type_size = nir_alu_type_get_type_size(ins->dest_type);
246 if (ins->op == midgard_alu_op_imov && type_size == 8)
261 unsigned zeroes = __builtin_ctz(ins->mask);
289 mir_bytemask_of_read_components_index(midgard_instruction *ins, unsigned i)
292 if (ins->compact_branch && ins->branch.conditional && (i == 0))
301 if (ins->type == TAG_ALU_4 && !ins->compact_branch) {
302 unsigned props = alu_opcode_props[ins->op].props;
309 qmask = ins->mask;
312 return mir_bytemask_of_read_components_single(ins->swizzle[i], qmask,
313 nir_alu_type_get_type_size(ins->src_types[i]));
317 mir_bytemask_of_read_components(midgard_instruction *ins, unsigned node)
324 mir_foreach_src(ins, i) {
325 if (ins->src[i] != node) continue;
326 mask |= mir_bytemask_of_read_components_index(ins, i);
340 mir_bundle_for_op(compiler_context *ctx, midgard_instruction ins)
342 midgard_instruction *u = mir_upload_ins(ctx, ins);
345 .tag = ins.type,
356 bundle.control = ins.type | u->unit;
386 midgard_instruction ins)
396 midgard_bundle new = mir_bundle_for_op(ctx, ins);
410 midgard_instruction ins)
424 midgard_bundle new = mir_bundle_for_op(ctx, ins);
436 mir_flip(midgard_instruction *ins)
438 unsigned temp = ins->src[0];
439 ins->src[0] = ins->src[1];
440 ins->src[1] = temp;
442 assert(ins->type == TAG_ALU_4);
444 temp = ins->src_types[0];
445 ins->src_types[0] = ins->src_types[1];
446 ins->src_types[1] = temp;
448 temp = ins->src_abs[0];
449 ins->src_abs[0] = ins->src_abs[1];
450 ins->src_abs[1] = temp;
452 temp = ins->src_neg[0];
453 ins->src_neg[0] = ins->src_neg[1];
454 ins->src_neg[1] = temp;
456 temp = ins->src_invert[0];
457 ins->src_invert[0] = ins->src_invert[1];
458 ins->src_invert[1] = temp;
461 memcpy(temp_swizzle, ins->swizzle[0], sizeof(ins->swizzle[0]));
462 memcpy(ins->swizzle[0], ins->swizzle[1], sizeof(ins->swizzle[0]));
463 memcpy(ins->swizzle[1], temp_swizzle, sizeof(ins->swizzle[0]));
476 mir_foreach_instr_global(ctx, ins) {
477 if (ins->dest < SSA_FIXED_MINIMUM)
478 max_dest = MAX2(max_dest, ins->dest + 1);