nv50/ir/opt: Add isOptSupported() check in logical arith optimization.
authorFrancisco Jerez <currojerez@riseup.net>
Sun, 8 Apr 2012 21:14:15 +0000 (23:14 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 14 Apr 2012 19:54:03 +0000 (21:54 +0200)
src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp

index 85e08579714c04fcc2cc163f309727f4f59224a9..29704c47f038a6be5a6f772bc9e9d89f9241397e 100644 (file)
@@ -1042,6 +1042,10 @@ AlgebraicOpt::handleLOGOP(Instruction *logop)
          if (set1->op != OP_SET)
             return;
       }
+      operation redOp = (logop->op == OP_AND ? OP_SET_AND :
+                         logop->op == OP_XOR ? OP_SET_XOR : OP_SET_OR);
+      if (!prog->getTarget()->isOpSupported(redOp, set1->sType))
+         return;
       if (set0->op != OP_SET &&
           set0->op != OP_SET_AND &&
           set0->op != OP_SET_OR &&
@@ -1067,14 +1071,7 @@ AlgebraicOpt::handleLOGOP(Instruction *logop)
       set0->getDef(0)->reg.file = FILE_PREDICATE;
       set0->getDef(0)->reg.size = 1;
       set1->setSrc(2, set0->getDef(0));
-      switch (logop->op) {
-      case OP_AND: set1->op = OP_SET_AND; break;
-      case OP_OR:  set1->op = OP_SET_OR; break;
-      case OP_XOR: set1->op = OP_SET_XOR; break;
-      default:
-         assert(0);
-         break;
-      }
+      set1->op = redOp;
       set1->setDef(0, logop->getDef(0));
       delete_Instruction(prog, logop);
    }