intel/compiler: invert the logic of lower_integer_multiplication()
authorPaulo Zanoni <paulo.r.zanoni@intel.com>
Thu, 11 Jul 2019 00:03:48 +0000 (17:03 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 12 Aug 2019 22:16:23 +0000 (15:16 -0700)
Invert the logic of how progress is handled: remove the continue
statements and mark progress inside the places where it actually
happens.

We're going to add a new lowering that also looks for BRW_OPCODE_MUL,
so inverting the logic here makes the resulting code much easier to
follow.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
src/intel/compiler/brw_fs.cpp

index 3db3332a2089f1db1bb8bc18c09be4c6e7d8d842..ccf6c95520201f9e519206fca7b4fd6a12f2dc09 100644 (file)
@@ -4062,23 +4062,20 @@ fs_visitor::lower_integer_multiplication()
 
    foreach_block_and_inst_safe(block, fs_inst, inst, cfg) {
       if (inst->opcode == BRW_OPCODE_MUL) {
-         if (inst->dst.is_accumulator() ||
-             (inst->dst.type != BRW_REGISTER_TYPE_D &&
-              inst->dst.type != BRW_REGISTER_TYPE_UD))
-            continue;
-
-         if (devinfo->has_integer_dword_mul)
-            continue;
-
-         lower_mul_dword_inst(inst, block);
+         if (!inst->dst.is_accumulator() &&
+             (inst->dst.type == BRW_REGISTER_TYPE_D ||
+              inst->dst.type == BRW_REGISTER_TYPE_UD) &&
+             !devinfo->has_integer_dword_mul) {
+            lower_mul_dword_inst(inst, block);
+            inst->remove(block);
+            progress = true;
+         }
       } else if (inst->opcode == SHADER_OPCODE_MULH) {
          lower_mulh_inst(inst, block);
-      } else {
-         continue;
+         inst->remove(block);
+         progress = true;
       }
 
-      inst->remove(block);
-      progress = true;
    }
 
    if (progress)