r300/compiler: KILP may not always be inside an IF statement.
authorTom Stellard <tstellar@gmail.com>
Mon, 2 Aug 2010 03:06:53 +0000 (20:06 -0700)
committerTom Stellard <tstellar@gmail.com>
Wed, 4 Aug 2010 02:11:08 +0000 (19:11 -0700)
src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c

index 3cc28972934d1d3143555ca01287384e08a957cc..857aae55145434f479cd8792794460077055f1e9 100644 (file)
@@ -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);
+               }
        }
 }