- alu_node = ppir_node_create_dest(block, ppir_op_store_color, NULL, 0);
+ /* In simple cases where the store_output is ssa, that register
+ * can be directly marked as the output.
+ * If discard is used or the source is not ssa, things can get a
+ * lot more complicated, so don't try to optimize those and fall
+ * back to inserting a mov at the end.
+ * If the source node will only be able to output to pipeline
+ * registers, fall back to the mov as well. */
+ if (!block->comp->uses_discard && instr->src->is_ssa) {
+ node = block->comp->var_nodes[instr->src->ssa->index];
+ switch (node->op) {
+ case ppir_op_load_uniform:
+ case ppir_op_const:
+ break;
+ default:
+ node->is_end = 1;
+ return true;
+ }
+ }
+
+ alu_node = ppir_node_create_dest(block, ppir_op_mov, NULL, 0);