Lines Matching refs:op2

38 …p_fold(ir_ctx *ctx, ir_insn *_values, ir_ref res, uint32_t opt, ir_ref op1, ir_ref op2, ir_ref op3)  in ir_sccp_fold()  argument
44 op2 = ir_sccp_identity(_values, op2); in ir_sccp_fold()
50 op2_insn = (op2 > 0 && IR_IS_CONST_OP(_values[op2].op)) ? _values + op2 : ctx->ir_base + op2; in ir_sccp_fold()
53 switch (ir_folding(ctx, opt, op1, op2, op3, op1_insn, op2_insn, op3_insn)) { in ir_sccp_fold()
57 op2 = ctx->fold_insn.op2; in ir_sccp_fold()
500 ir_ref op1, op2, op3; in ir_sccp_fold2() local
506 op2 = insn->op2; in ir_sccp_fold2()
511 op2_insn = ctx->ir_base + op2; in ir_sccp_fold2()
514 switch (ir_folding(ctx, opt, op1, op2, op3, op1_insn, op2_insn, op3_insn)) { in ir_sccp_fold2()
518 op2 = ctx->fold_insn.op2; in ir_sccp_fold2()
525 || insn->op2 != ctx->fold_insn.op2 in ir_sccp_fold2()
542 if (insn->op2 != ctx->fold_insn.op2) { in ir_sccp_fold2()
543 if (insn->op2 > 0) { in ir_sccp_fold2()
544 ir_use_list_remove_one(ctx, insn->op2, ref); in ir_sccp_fold2()
546 if (ctx->fold_insn.op2 > 0) { in ir_sccp_fold2()
547 ir_use_list_add(ctx, ctx->fold_insn.op2, ref); in ir_sccp_fold2()
559 insn->op2 = ctx->fold_insn.op2; in ir_sccp_fold2()
600 insn->op2 = IR_UNUSED; in ir_sccp_remove_if()
764 ir_may_promote_d2f(ctx, insn->op2); in ir_may_promote_d2f()
797 ir_may_promote_f2d(ctx, insn->op2); in ir_may_promote_f2d()
852 if (insn->op1 == insn->op2) { in ir_promote_d2f()
853 insn->op2 = insn->op1 = ir_promote_d2f(ctx, insn->op1, ref); in ir_promote_d2f()
856 insn->op2 = ir_promote_d2f(ctx, insn->op2, ref); in ir_promote_d2f()
925 if (insn->op1 == insn->op2) { in ir_promote_f2d()
926 insn->op2 = insn->op1 = ir_promote_f2d(ctx, insn->op1, ref); in ir_promote_f2d()
929 insn->op2 = ir_promote_f2d(ctx, insn->op2, ref); in ir_promote_f2d()
968 ir_may_promote_i2i(ctx, type, insn->op2); in ir_may_promote_i2i()
1024 if (insn->op1 == insn->op2) { in ir_promote_i2i()
1025 insn->op2 = insn->op1 = ir_promote_i2i(ctx, type, insn->op1, ref); in ir_promote_i2i()
1028 insn->op2 = ir_promote_i2i(ctx, type, insn->op2, ref); in ir_promote_i2i()
1126 || (op_insn->op1 != ref && op_insn->op2 != ref) in ir_try_promote_ext()
1142 && (use_insn->op1 == ref || use_insn->op2 == ref)) { in ir_try_promote_ext()
1168 && (use_insn->op1 == ref || use_insn->op2 == ref)); in ir_try_promote_ext()
1177 if (use_insn->op2 != ref) { in ir_try_promote_ext()
1178 if (IR_IS_CONST_REF(use_insn->op2) in ir_try_promote_ext()
1179 && !IR_IS_SYM_CONST(ctx->ir_base[use_insn->op2].op)) { in ir_try_promote_ext()
1180 ctx->ir_base[use].op2 = ir_ext_const(ctx, &ctx->ir_base[use_insn->op2], op, type); in ir_try_promote_ext()
1182 ctx->ir_base[use].op2 = ir_ext_ref(ctx, use, use_insn->op2, op, type, worklist); in ir_try_promote_ext()
1191 if (IR_IS_CONST_REF(phi_insn->op2) in ir_try_promote_ext()
1192 && !IR_IS_SYM_CONST(ctx->ir_base[phi_insn->op2].op)) { in ir_try_promote_ext()
1193 ctx->ir_base[ref].op2 = ir_ext_const(ctx, &ctx->ir_base[phi_insn->op2], op, type); in ir_try_promote_ext()
1195 ctx->ir_base[ref].op2 = ir_ext_ref(ctx, ref, phi_insn->op2, op, type, worklist); in ir_try_promote_ext()
1267 ir_ref end1_ref = insn->op1, end2_ref = insn->op2; in ir_try_remove_empty_diamond()
1322 if (!IR_IS_CONST_REF(root->op2)) { in ir_try_remove_empty_diamond()
1323 ir_use_list_remove_all(ctx, root->op2, root_ref); in ir_try_remove_empty_diamond()
1324 if (ir_is_dead(ctx, root->op2)) { in ir_try_remove_empty_diamond()
1325 ir_bitqueue_add(worklist, root->op2); in ir_try_remove_empty_diamond()
1380 if (!IR_IS_CONST_REF(root->op2)) { in ir_try_remove_empty_diamond()
1381 ir_use_list_remove_all(ctx, root->op2, root_ref); in ir_try_remove_empty_diamond()
1382 if (ir_is_dead(ctx, root->op2)) { in ir_try_remove_empty_diamond()
1383 ir_bitqueue_add(worklist, root->op2); in ir_try_remove_empty_diamond()
1421 ir_ref end1_ref = merge->op1, end2_ref = merge->op2; in ir_optimize_phi()
1434 if (root->op == IR_IF && ctx->use_lists[root->op2].count == 1) { in ir_optimize_phi()
1435 ir_ref cond_ref = root->op2; in ir_optimize_phi()
1455 && ((insn->op2 == cond->op1 && insn->op3 == cond->op2) in ir_optimize_phi()
1456 || (insn->op2 == cond->op2 && insn->op3 == cond->op1))) { in ir_optimize_phi()
1492 (is_less ? cond->op1 : cond->op2) in ir_optimize_phi()
1494 ((start1->op == IR_IF_TRUE) ? insn->op2 : insn->op3) in ir_optimize_phi()
1497 if (insn->op2 > insn->op3) { in ir_optimize_phi()
1498 insn->op1 = insn->op2; in ir_optimize_phi()
1499 insn->op2 = insn->op3; in ir_optimize_phi()
1510 if (!IR_IS_CONST_REF(insn->op2)) { in ir_optimize_phi()
1511 ir_use_list_remove_all(ctx, insn->op2, cond_ref); in ir_optimize_phi()
1528 && ((ctx->ir_base[insn->op2].op == IR_NEG in ir_optimize_phi()
1529 && ctx->use_lists[insn->op2].count == 1 in ir_optimize_phi()
1530 && ctx->ir_base[insn->op2].op1 == insn->op3 in ir_optimize_phi()
1532 && ir_is_zero(ctx, cond->op2) in ir_optimize_phi()
1534 || (cond->op2 == insn->op3 in ir_optimize_phi()
1539 && ctx->ir_base[insn->op3].op1 == insn->op2 in ir_optimize_phi()
1540 && ((cond->op1 == insn->op2 in ir_optimize_phi()
1541 && ir_is_zero(ctx, cond->op2) in ir_optimize_phi()
1543 || (cond->op2 == insn->op2 in ir_optimize_phi()
1583 if (ctx->ir_base[insn->op2].op == IR_NEG) { in ir_optimize_phi()
1584 neg_ref = insn->op2; in ir_optimize_phi()
1588 insn->op1 = insn->op2; in ir_optimize_phi()
1590 insn->op2 = IR_UNUSED; in ir_optimize_phi()
1654 SWAP_REFS(insn->op2, insn->op3); in ir_optimize_phi()
1660 ir_use_list_remove_all(ctx, root->op2, root_ref); in ir_optimize_phi()
1683 static bool ir_cmp_is_true(ir_op op, ir_insn *op1, ir_insn *op2) in ir_cmp_is_true() argument
1685 IR_ASSERT(op1->type == op2->type); in ir_cmp_is_true()
1688 return op1->val.u64 == op2->val.u64; in ir_cmp_is_true()
1690 return op1->val.u64 != op2->val.u64; in ir_cmp_is_true()
1693 return op1->val.i64 < op2->val.i64; in ir_cmp_is_true()
1695 return op1->val.u64 < op2->val.u64; in ir_cmp_is_true()
1699 return op1->val.i64 >= op2->val.i64; in ir_cmp_is_true()
1701 return op1->val.u64 >= op2->val.u64; in ir_cmp_is_true()
1705 return op1->val.i64 <= op2->val.i64; in ir_cmp_is_true()
1707 return op1->val.u64 <= op2->val.u64; in ir_cmp_is_true()
1711 return op1->val.i64 > op2->val.i64; in ir_cmp_is_true()
1713 return op1->val.u64 > op2->val.u64; in ir_cmp_is_true()
1716 return op1->val.u64 < op2->val.u64; in ir_cmp_is_true()
1718 return op1->val.u64 >= op2->val.u64; in ir_cmp_is_true()
1720 return op1->val.u64 <= op2->val.u64; in ir_cmp_is_true()
1722 return op1->val.u64 > op2->val.u64; in ir_cmp_is_true()
1729 return op1->val.d == op2->val.d; in ir_cmp_is_true()
1731 return op1->val.d != op2->val.d; in ir_cmp_is_true()
1733 return op1->val.d < op2->val.d; in ir_cmp_is_true()
1735 return op1->val.d >= op2->val.d; in ir_cmp_is_true()
1737 return op1->val.d <= op2->val.d; in ir_cmp_is_true()
1739 return op1->val.d > op2->val.d; in ir_cmp_is_true()
1741 return !(op1->val.d >= op2->val.d); in ir_cmp_is_true()
1743 return !(op1->val.d < op2->val.d); in ir_cmp_is_true()
1745 return !(op1->val.d > op2->val.d); in ir_cmp_is_true()
1747 return !(op1->val.d <= op2->val.d); in ir_cmp_is_true()
1755 return op1->val.f == op2->val.f; in ir_cmp_is_true()
1757 return op1->val.f != op2->val.f; in ir_cmp_is_true()
1759 return op1->val.f < op2->val.f; in ir_cmp_is_true()
1761 return op1->val.f >= op2->val.f; in ir_cmp_is_true()
1763 return op1->val.f <= op2->val.f; in ir_cmp_is_true()
1765 return op1->val.f > op2->val.f; in ir_cmp_is_true()
1767 return !(op1->val.f >= op2->val.f); in ir_cmp_is_true()
1769 return !(op1->val.f < op2->val.f); in ir_cmp_is_true()
1771 return !(op1->val.f > op2->val.f); in ir_cmp_is_true()
1773 return !(op1->val.f <= op2->val.f); in ir_cmp_is_true()
1783 ir_ref cond_ref = insn->op2; in ir_try_split_if()
1789 && ((IR_IS_CONST_REF(cond->op2) && !IR_IS_SYM_CONST(ctx->ir_base[cond->op2].op)) in ir_try_split_if()
1795 ir_ref end1_ref = merge->op1, end2_ref = merge->op2; in ir_try_split_if()
1806 if (!IR_IS_CONST_REF(cond->op2) || IR_IS_SYM_CONST(ctx->ir_base[cond->op2].op)) { in ir_try_split_if()
1808 SWAP_REFS(cond->op2, cond->op3); in ir_try_split_if()
1809 SWAP_REFS(merge->op1, merge->op2); in ir_try_split_if()
1813 if (ir_const_is_true(&ctx->ir_base[cond->op2])) { in ir_try_split_if()
1885 if_false->op2 = end2_ref; in ir_try_split_if()
1925 end2->op2 = cond->op3; in ir_try_split_if()
1929 merge->op2 = IR_UNUSED; in ir_try_split_if()
1936 insn->op2 = IR_UNUSED; in ir_try_split_if()
1942 if_false->op2 = ref; in ir_try_split_if()
1959 ir_ref cond_ref = insn->op2; in ir_try_split_if_cmp()
1963 && IR_IS_CONST_REF(cond->op2) in ir_try_split_if_cmp()
1964 && !IR_IS_SYM_CONST(ctx->ir_base[cond->op2].op) in ir_try_split_if_cmp()
1965 && ctx->use_lists[insn->op2].count == 1) { in ir_try_split_if_cmp()
1973 && ((IR_IS_CONST_REF(phi->op2) && !IR_IS_SYM_CONST(ctx->ir_base[phi->op2].op)) in ir_try_split_if_cmp()
1979 ir_ref end1_ref = merge->op1, end2_ref = merge->op2; in ir_try_split_if_cmp()
1990 if (!IR_IS_CONST_REF(phi->op2) || IR_IS_SYM_CONST(ctx->ir_base[phi->op2].op)) { in ir_try_split_if_cmp()
1992 SWAP_REFS(phi->op2, phi->op3); in ir_try_split_if_cmp()
1993 SWAP_REFS(merge->op1, merge->op2); in ir_try_split_if_cmp()
1997 if (ir_cmp_is_true(cond->op, &ctx->ir_base[phi->op2], &ctx->ir_base[cond->op2])) { in ir_try_split_if_cmp()
2005 …if (ir_cmp_is_true(cond->op, &ctx->ir_base[phi->op3], &ctx->ir_base[cond->op2]) ^ (op == IR_IF_TRU… in ir_try_split_if_cmp()
2077 if_false->op2 = end2_ref; in ir_try_split_if_cmp()
2113 ir_use_list_replace_one(ctx, phi->op3, phi_ref, insn->op2); in ir_try_split_if_cmp()
2120 end2->op2 = insn->op2; in ir_try_split_if_cmp()
2124 merge->op2 = IR_UNUSED; in ir_try_split_if_cmp()
2132 insn->op2 = IR_UNUSED; in ir_try_split_if_cmp()
2138 if_false->op2 = ref; in ir_try_split_if_cmp()
2176 if (next->op2 == phi_ref) { in ir_optimize_merge()
2181 ir_insn *cmp = &ctx->ir_base[next->op2]; in ir_optimize_merge()
2185 && IR_IS_CONST_REF(cmp->op2) in ir_optimize_merge()
2186 && !IR_IS_SYM_CONST(ctx->ir_base[cmp->op2].op) in ir_optimize_merge()
2187 && ctx->use_lists[next->op2].count == 1) { in ir_optimize_merge()
2262 } else if (!ir_sccp_fold(ctx, _values, i, insn->opt, insn->op1, insn->op2, insn->op3)) { in ir_sccp()
2314 if (IR_IS_TOP(insn->op2)) { in ir_sccp()
2316 if (!_values[insn->op2].op1) { in ir_sccp()
2317 _values[insn->op2].op1 = 1; in ir_sccp()
2318 ir_bitqueue_add(&worklist, insn->op2); in ir_sccp()
2322 if (!IR_IS_BOTTOM(insn->op2) in ir_sccp()
2324 && (IR_IS_CONST_REF(insn->op2) || _values[insn->op2].op != IR_COPY) in ir_sccp()
2327 bool b = ir_sccp_is_true(ctx, _values, insn->op2); in ir_sccp()
2351 if (IR_IS_TOP(insn->op2)) { in ir_sccp()
2353 if (!_values[insn->op2].op1) { in ir_sccp()
2354 _values[insn->op2].op1 = 1; in ir_sccp()
2355 ir_bitqueue_add(&worklist, insn->op2); in ir_sccp()
2359 if (!IR_IS_BOTTOM(insn->op2) in ir_sccp()
2361 && (IR_IS_CONST_REF(insn->op2) || _values[insn->op2].op != IR_COPY) in ir_sccp()
2373 if (ir_sccp_is_equal(ctx, _values, insn->op2, use_insn->op2)) { in ir_sccp()
2419 use = insn->op2; in ir_sccp()