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

Author: Tom Stellard <tstel...@gmail.com>
Date:   Sun Aug  1 20:06:53 2010 -0700

r300/compiler: KILP may not always be inside an IF statement.

---

 .../drivers/dri/r300/compiler/radeon_program_alu.c |   23 ++++++++++++-------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c 
b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
index 3cc2897..857aae5 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
@@ -988,17 +988,22 @@ void radeonTransformKILP(struct radeon_compiler * c)
        for (inst = c->Program.Instructions.Next;
                        inst != &c->Program.Instructions; inst = inst->Next) {
 
-               if (inst->U.I.Opcode != RC_OPCODE_KILP
-                       || inst->Prev->U.I.Opcode != RC_OPCODE_IF
-                       || inst->Next->U.I.Opcode != RC_OPCODE_ENDIF) {
+               if (inst->U.I.Opcode != RC_OPCODE_KILP)
                        continue;
-               }
+
                inst->U.I.Opcode = RC_OPCODE_KIL;
-               inst->U.I.SrcReg[0] = 
negate(absolute(inst->Prev->U.I.SrcReg[0]));
 
-               /* Remove IF */
-               rc_remove_instruction(inst->Prev);
-               /* Remove ENDIF */
-               rc_remove_instruction(inst->Next);
+               if (inst->Prev->U.I.Opcode != RC_OPCODE_IF
+                               || inst->Next->U.I.Opcode != RC_OPCODE_ENDIF) {
+                       inst->U.I.SrcReg[0] = negate(builtin_one);
+               } else {
+
+                       inst->U.I.SrcReg[0] =
+                               negate(absolute(inst->Prev->U.I.SrcReg[0]));
+                       /* Remove IF */
+                       rc_remove_instruction(inst->Prev);
+                       /* Remove ENDIF */
+                       rc_remove_instruction(inst->Next);
+               }
        }
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to