st/glsl_to_tgsi: don't optimize mul+add to mad if expression is precise
authorKarol Herbst <karolherbst@gmail.com>
Fri, 23 Jun 2017 18:30:26 +0000 (20:30 +0200)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 22 Jul 2017 03:45:18 +0000 (23:45 -0400)
Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index c8f40c1..baa8359 100644 (file)
@@ -1557,7 +1557,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
 
    /* Quick peephole: Emit MAD(a, b, c) instead of ADD(MUL(a, b), c)
     */
-   if (ir->operation == ir_binop_add) {
+   if (!this->precise && ir->operation == ir_binop_add) {
       if (try_emit_mad(ir, 1))
          return;
       if (try_emit_mad(ir, 0))