nv50/ir/tgsi: optimize KIL
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Wed, 12 Jun 2013 19:31:19 +0000 (21:31 +0200)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 23 May 2014 16:34:39 +0000 (12:34 -0400)
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp

index e24be519d75a6cfb327a75e6b4fa6d70fcd7d1fa..a0f1fe1c87d5300fadc2a3ab4eee220569a23066 100644 (file)
@@ -2457,7 +2457,12 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
       break;
    case TGSI_OPCODE_KILL_IF:
       val0 = new_LValue(func, FILE_PREDICATE);
+      mask = 0;
       for (c = 0; c < 4; ++c) {
+         const int s = tgsi.getSrc(0).getSwizzle(c);
+         if (mask & (1 << s))
+            continue;
+         mask |= 1 << s;
          mkCmp(OP_SET, CC_LT, TYPE_F32, val0, TYPE_F32, fetchSrc(0, c), zero);
          mkOp(OP_DISCARD, TYPE_NONE, NULL)->setPredicate(CC_P, val0);
       }