+/*
+ * Optimize away things like:
+ * *** TEMP[0], TEMP[1], TEMP[2]
+ * MOV OUT[0] TEMP[0]
+ * into:
+ * *** OUT[0], TEMP[1], TEMP[2]
+ */
+static void i915_fpc_optimize_useless_mov(union i915_full_token* current, union i915_full_token* next)
+{
+ if ( current->Token.Type == TGSI_TOKEN_TYPE_INSTRUCTION &&
+ next->Token.Type == TGSI_TOKEN_TYPE_INSTRUCTION &&
+ next->FullInstruction.Instruction.Opcode == TGSI_OPCODE_MOV &&
+ next->FullInstruction.Instruction.Saturate == TGSI_SAT_NONE &&
+ next->FullInstruction.Src[0].Register.Absolute == 0 &&
+ next->FullInstruction.Src[0].Register.Negate == 0 &&
+ is_unswizzled(&next->FullInstruction.Src[0], next->FullInstruction.Dst[0].Register.WriteMask) &&
+ current->FullInstruction.Dst[0].Register.WriteMask == next->FullInstruction.Dst[0].Register.WriteMask &&
+ same_src_dst_reg(&next->FullInstruction.Src[0], ¤t->FullInstruction.Dst[0]) )
+ {
+ next->FullInstruction.Instruction.Opcode = TGSI_OPCODE_NOP;
+
+ current->FullInstruction.Dst[0] = next->FullInstruction.Dst[0];
+ return;
+ }
+}
+