Mesa (master): i915g: Fix peephole optimization for MOVs.

Stephane Marchesin marcheu at kemper.freedesktop.org
Thu Sep 22 19:46:25 UTC 2011


Module: Mesa
Branch: master
Commit: 687e62a5d76e2e4cbbc6268e5b0e3f148b681185
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=687e62a5d76e2e4cbbc6268e5b0e3f148b681185

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Thu Sep 22 12:43:24 2011 -0700

i915g: Fix peephole optimization for MOVs.

---

 src/gallium/drivers/i915/i915_fpc_optimize.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_fpc_optimize.c b/src/gallium/drivers/i915/i915_fpc_optimize.c
index 50b3a28..0d680fb 100644
--- a/src/gallium/drivers/i915/i915_fpc_optimize.c
+++ b/src/gallium/drivers/i915/i915_fpc_optimize.c
@@ -62,6 +62,13 @@ static boolean same_src_reg(struct i915_full_src_register* d1, struct i915_full_
            d1->Register.Negate == d2->Register.Negate);
 }
 
+static boolean has_destination(unsigned opcode)
+{
+   return (opcode != TGSI_OPCODE_NOP &&
+           opcode != TGSI_OPCODE_KIL &&
+           opcode != TGSI_OPCODE_RET);
+}
+
 static boolean is_unswizzled(struct i915_full_src_register* r,
                              unsigned write_mask)
 {
@@ -192,6 +199,7 @@ static void i915_fpc_optimize_useless_mov(union i915_full_token* current, union
    if ( current->Token.Type == TGSI_TOKEN_TYPE_INSTRUCTION  &&
         next->Token.Type == TGSI_TOKEN_TYPE_INSTRUCTION  &&
         next->FullInstruction.Instruction.Opcode == TGSI_OPCODE_MOV &&
+        has_destination(current->FullInstruction.Instruction.Opcode) &&
         next->FullInstruction.Instruction.Saturate == TGSI_SAT_NONE &&
         next->FullInstruction.Src[0].Register.Absolute == 0 &&
         next->FullInstruction.Src[0].Register.Negate == 0 &&




More information about the mesa-commit mailing list