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 c8f40c147d8dd8f485c966c879263a5ef7d85a82..baa835924bcd4644cbf3396e0f9fbcea61166925 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))