mesa/st: only convert AND(a, NOT(b)) into MAD when not using native integers
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 3 Aug 2014 05:27:32 +0000 (01:27 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 3 Aug 2014 14:05:53 +0000 (10:05 -0400)
Native integers imply a somewhat different handling of booleans. Instead
of being 1.0/0.0 floats, they are 0 (true) / -1 (false) integers. As such
the original optimization no longer applies.

Reported-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 27e4615..b818139 100644 (file)
@@ -1354,7 +1354,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
 
    /* Quick peephole: Emit OPCODE_MAD(-a, -b, a) instead of AND(a, NOT(b))
     */
-   if (ir->operation == ir_binop_logic_and) {
+   if (!native_integers && ir->operation == ir_binop_logic_and) {
       if (try_emit_mad_for_and_not(ir, 1))
         return;
       if (try_emit_mad_for_and_not(ir, 0))