Lines Matching refs:instr
61 is_eligible_mov(struct ir3_instruction *instr, in is_eligible_mov() argument
64 if (is_same_type_mov(instr)) { in is_eligible_mov()
65 struct ir3_register *dst = instr->dsts[0]; in is_eligible_mov()
66 struct ir3_register *src = instr->srcs[0]; in is_eligible_mov()
107 (!cond->address || cond->address->def->instr->block == cmp->block); in is_foldable_double_cmp()
160 lower_immed(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr, unsigned n, in lower_immed() argument
169 if (!ir3_valid_flags(instr, n, new_flags)) in lower_immed()
178 (is_cat2_float(instr->opc) || is_cat3_float(instr->opc)) ? true : false; in lower_immed()
243 instr->srcs[n] = reg; in lower_immed()
249 unuse(struct ir3_instruction *instr) in unuse() argument
251 debug_assert(instr->use_count > 0); in unuse()
253 if (--instr->use_count == 0) { in unuse()
254 struct ir3_block *block = instr->block; in unuse()
256 instr->barrier_class = 0; in unuse()
257 instr->barrier_conflict = 0; in unuse()
263 debug_assert(block->keeps[i] != instr); in unuse()
274 try_swap_mad_two_srcs(struct ir3_instruction *instr, unsigned new_flags) in try_swap_mad_two_srcs() argument
276 if (!is_mad(instr->opc)) in try_swap_mad_two_srcs()
282 swap(instr->srcs[0], instr->srcs[1]); in try_swap_mad_two_srcs()
294 ir3_valid_flags(instr, 0, new_flags) && in try_swap_mad_two_srcs()
296 ir3_valid_flags(instr, 1, instr->srcs[1]->flags); in try_swap_mad_two_srcs()
300 swap(instr->srcs[0], instr->srcs[1]); in try_swap_mad_two_srcs()
314 reg_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr, in reg_cp() argument
327 src->block->loop_id != instr->block->loop_id) in reg_cp()
330 if (is_eligible_mov(src, instr, true)) { in reg_cp()
337 if (ir3_valid_flags(instr, n, new_flags)) { in reg_cp()
345 instr->barrier_class |= src->barrier_class; in reg_cp()
346 instr->barrier_conflict |= src->barrier_conflict; in reg_cp()
349 reg->def->instr->use_count++; in reg_cp()
355 opc_cat(instr->opc) != 0) { in reg_cp()
365 if (!ir3_valid_flags(instr, n, new_flags)) { in reg_cp()
367 if (lower_immed(ctx, instr, n, src_reg, new_flags)) in reg_cp()
377 if ((n == 1) && try_swap_mad_two_srcs(instr, new_flags)) { in reg_cp()
397 conflicts(instr->address, reg->def->instr->address)) in reg_cp()
404 if ((opc_cat(instr->opc) == 3) && (n == 2) && in reg_cp()
416 if (is_meta(instr)) in reg_cp()
418 if (instr->opc == OPC_MOV && !type_float(instr->cat1.src_type)) in reg_cp()
420 if (!is_cat2_float(instr->opc) && !is_cat3_float(instr->opc)) in reg_cp()
427 if (is_cat2_float(instr->opc) || is_cat3_float(instr->opc)) in reg_cp()
429 if (instr->opc == OPC_MOV && type_float(instr->cat1.src_type)) in reg_cp()
433 src_reg = ir3_reg_clone(instr->block->shader, src_reg); in reg_cp()
435 instr->srcs[n] = src_reg; in reg_cp()
438 ir3_instr_set_address(instr, reg->def->instr->address->def->instr); in reg_cp()
446 debug_assert((opc_cat(instr->opc) == 1) || in reg_cp()
447 (opc_cat(instr->opc) == 2) || in reg_cp()
448 (opc_cat(instr->opc) == 6) || in reg_cp()
449 is_meta(instr) || in reg_cp()
450 (is_mad(instr->opc) && (n == 0))); in reg_cp()
452 if ((opc_cat(instr->opc) == 2) && in reg_cp()
453 !ir3_cat2_int(instr->opc)) { in reg_cp()
457 return lower_immed(ctx, instr, n, src_reg, new_flags); in reg_cp()
470 if (ir3_valid_flags(instr, n, new_flags) && in reg_cp()
471 ir3_valid_immediate(instr, iim_val)) { in reg_cp()
473 src_reg = ir3_reg_clone(instr->block->shader, src_reg); in reg_cp()
476 instr->srcs[n] = src_reg; in reg_cp()
481 return lower_immed(ctx, instr, n, src_reg, new_flags); in reg_cp()
495 eliminate_output_mov(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr) in eliminate_output_mov() argument
497 if (is_eligible_mov(instr, NULL, false)) { in eliminate_output_mov()
498 struct ir3_register *reg = instr->srcs[0]; in eliminate_output_mov()
506 return instr; in eliminate_output_mov()
514 instr_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr) in instr_cp() argument
516 if (instr->srcs_count == 0) in instr_cp()
519 if (ir3_instr_check_mark(instr)) in instr_cp()
526 foreach_src_n (reg, n, instr) { in instr_cp()
541 if (is_meta(instr) && in instr_cp()
549 progress |= reg_cp(ctx, instr, reg, n); in instr_cp()
560 if (instr->opc == OPC_MOV && (instr->srcs[0]->flags & IR3_REG_IMMED) && in instr_cp()
561 instr->cat1.src_type != instr->cat1.dst_type && in instr_cp()
565 full_type(instr->cat1.src_type) == TYPE_U32 && in instr_cp()
566 full_type(instr->cat1.dst_type) == TYPE_U32) { in instr_cp()
567 uint32_t uimm = instr->srcs[0]->uim_val; in instr_cp()
568 if (instr->cat1.dst_type == TYPE_U16) in instr_cp()
570 instr->srcs[0]->uim_val = uimm; in instr_cp()
571 if (instr->dsts[0]->flags & IR3_REG_HALF) in instr_cp()
572 instr->srcs[0]->flags |= IR3_REG_HALF; in instr_cp()
574 instr->srcs[0]->flags &= ~IR3_REG_HALF; in instr_cp()
575 instr->cat1.src_type = instr->cat1.dst_type; in instr_cp()
582 if ((instr->opc == OPC_CMPS_S) && is_foldable_double_cmp(instr)) { in instr_cp()
583 struct ir3_instruction *cond = ssa(instr->srcs[0]); in instr_cp()
588 instr->opc = cond->opc; in instr_cp()
589 instr->flags = cond->flags; in instr_cp()
590 instr->cat2 = cond->cat2; in instr_cp()
592 ir3_instr_set_address(instr, cond->address->def->instr); in instr_cp()
593 instr->srcs[0] = ir3_reg_clone(ctx->shader, cond->srcs[0]); in instr_cp()
594 instr->srcs[1] = ir3_reg_clone(ctx->shader, cond->srcs[1]); in instr_cp()
595 instr->barrier_class |= cond->barrier_class; in instr_cp()
596 instr->barrier_conflict |= cond->barrier_conflict; in instr_cp()
611 if (is_tex(instr) && (instr->flags & IR3_INSTR_S2EN) && in instr_cp()
612 !(instr->flags & IR3_INSTR_B) && in instr_cp()
617 struct ir3_instruction *samp_tex = ssa(instr->srcs[0]); in instr_cp()
625 instr->flags &= ~IR3_INSTR_S2EN; in instr_cp()
626 instr->cat5.samp = samp->iim_val; in instr_cp()
627 instr->cat5.tex = tex->iim_val; in instr_cp()
630 instr->srcs_count--; in instr_cp()
631 for (unsigned i = 0; i < instr->srcs_count; i++) { in instr_cp()
632 instr->srcs[i] = instr->srcs[i + 1]; in instr_cp()
655 foreach_instr (instr, &block->instr_list) { in ir3_cp()
660 debug_assert(instr->deps_count == 0); in ir3_cp()
662 foreach_ssa_src (src, instr) { in ir3_cp()