Lines Matching defs:phi
56 * Does a phi have one constant value from outside a loop and one from inside?
59 phi_has_constant_from_outside_and_one_from_inside_loop(nir_phi_instr *phi,
65 assert(exec_list_length(&phi->srcs) == 2);
70 nir_foreach_phi_src(src, phi) {
86 * condition is a phi node of two constants and moves half of the if to above
95 * vec1 32 ssa_2 = phi block_0: ssa_0, block_7: ssa_5
96 * vec1 32 ssa_3 = phi block_0: ssa_0, block_7: ssa_1
122 * vec1 32 ssa_2 = phi block_0: ssa_0, block_7: ssa_5
206 * accidentally ending up in a phi.
331 * Splits ALU instructions that have a source that is a phi node
339 * - At least one source of the instruction is a phi node from the header block.
341 * - Any non-phi sources of the ALU instruction come from a block that
345 * - The phi node selects a constant or undef from the block before the loop or
352 * on. A new phi node is added to the header block that selects either the
354 * instruction are replaced by this phi.
364 * vec1 32 ssa_11 = phi block_0: ssa_10, block_4: ssa_15
365 * vec1 32 ssa_12 = phi block_0: ssa_1, block_4: ssa_15
366 * vec1 32 ssa_13 = phi block_0: ssa_10, block_4: ssa_16
382 * vec1 32 ssa_11 = phi block_0: ssa_10, block_4: ssa_15
383 * vec1 32 ssa_12 = phi block_0: ssa_1, block_4: ssa_15
384 * vec1 32 ssa_13 = phi block_0: ssa_10, block_4: ssa_16
385 * vec1 32 ssa_21 = phi block_0: ssa_22, block_4: ssa_20
440 /* If the source is a phi in the loop header block, then the
442 * of the phi.
446 nir_phi_instr *const phi = nir_instr_as_phi(src_instr);
456 nir_foreach_phi_src(src_of_phi, phi) {
477 /* If the source is not a phi (or a phi in a block other than the
509 * of the new instruction that read a phi with an undef source from
510 * prev_block with the non-undef source of that phi.
519 /* Make a new phi node that selects a value from prev_block and the
522 nir_phi_instr *const phi = nir_phi_instr_create(b->shader);
523 nir_phi_instr_add_src(phi, prev_block, nir_src_for_ssa(prev_value));
524 nir_phi_instr_add_src(phi, continue_block, nir_src_for_ssa(alu_copy));
526 nir_ssa_dest_init(&phi->instr, &phi->dest,
530 nir_builder_instr_insert(b, &phi->instr);
533 * result of the phi.
536 &phi->dest.ssa);
551 * Simplify a bcsel whose sources are all phi nodes from the loop header block
554 * converted to phi nodes:
559 * - All of the sources of the bcsel are phi nodes in the header block of the
562 * - The phi node representing the condition of the bcsel instruction chooses
567 * from the continue block. Since each of these sources is also a phi node in
568 * the header block, the value of the phi node can be "evaluated." These
569 * evaluated phi nodes provide the sources for a new phi node. All users of
570 * the bcsel result are updated to use the phi node result.
582 * vec1 32 ssa_11 = phi block_0: ssa_1, block_4: ssa_14
583 * vec1 32 ssa_12 = phi block_0: ssa_10, block_4: ssa_15
584 * vec1 32 ssa_13 = phi block_0: ssa_7, block_4: ssa_25
604 * vec1 32 ssa_11 = phi block_0: ssa_1, block_4: ssa_14
605 * vec1 32 ssa_12 = phi block_0: ssa_10, block_4: ssa_15
606 * vec1 32 ssa_13 = phi block_0: ssa_7, block_4: ssa_25
607 * vec1 32 sss_26 = phi block_0: ssa_1, block_4: ssa_25
617 * It may be possible modify this function to not require a phi node as the
620 * (since it will become the source of a phi node in the header block of the
673 /* Create a new phi node that selects the value for prev_block from
676 * already been verified to be phi nodes.
679 nir_phi_instr *const phi = nir_phi_instr_create(b->shader);
680 nir_phi_instr_add_src(phi, prev_block,
684 nir_phi_instr_add_src(phi, continue_block,
688 nir_ssa_dest_init(&phi->instr,
689 &phi->dest,
695 nir_builder_instr_insert(b, &phi->instr);
698 * the phi.
701 &phi->dest.ssa);
858 nir_phi_instr *phi = nir_instr_as_phi(instr);
860 nir_foreach_phi_src(src, phi) {
917 * or dead control-flow passes and are perfectly legal. Run a quick phi
937 /* Find phi statements after an if that choose between true and false, and
954 nir_phi_instr *phi = nir_instr_as_phi(instr);
955 if (phi->dest.ssa.bit_size != cond->bit_size ||
956 phi->dest.ssa.num_components != 1)
963 nir_foreach_phi_src(src, phi) {
979 nir_ssa_def_rewrite_uses(&phi->dest.ssa, cond);
983 nir_ssa_def_rewrite_uses(&phi->dest.ssa, nir_inot(b, cond));
1183 * or dead control-flow passes and are perfectly legal. Run a quick phi