[Mesa-dev] [Mesa-stable] [PATCH 3/3] i965: Avoid applying negate to wrong MAD source.

Emil Velikov emil.l.velikov at gmail.com
Sat Mar 7 10:25:45 PST 2015


On 7 March 2015 at 18:00, Matt Turner <mattst88 at gmail.com> wrote:
> On Sat, Mar 7, 2015 at 9:54 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> On 27 February 2015 at 19:34, Matt Turner <mattst88 at gmail.com> wrote:
>>> For some given GLSL IR like (+ (neg x) (* 1.2 x)), the try_emit_mad
>>> function would see that one of the +'s sources was a negate expression
>>> and set mul_negate = true without confirming that it was actually a
>>> multiply.
>>>
>> Hi Matt,
>>
>> This commit does not pick cleanly due to with commit
>> 8cfd1e2ac6b(i965/fs: Emit MAD instructions when possible.) and
>> 3654b6d43ce(i965/fs: Emit MADs from (x + abs(y * z)).)
>
> Those commits are why this one is needed. I think the problem is that
> the i965/vec4 versions of those commits aren't on 10.5, so you can
> simply drop the changes to i965_vec4_visitor.cpp from this patch for
> 10.5.

Thank you Matt. The vec4 changes were during 10.6-devel, thus dropping
leaves the following trivial conflict. I'll give the branch a quick
piglit test and push it.

-Emil

--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@@ -452,15 -449,13 +447,18 @@@ fs_visitor::try_emit_mad(ir_expression
           mul_negate = true;
        }

-       if (!mul || mul->operation != ir_binop_mul)
-          return false;
+       if (mul && mul->operation == ir_binop_mul)
+          break;
     }

+    if (!mul || mul->operation != ir_binop_mul)
+       return false;
+
 +   if (nonmul->as_constant() ||
 +       mul->operands[0]->as_constant() ||
 +       mul->operands[1]->as_constant())
 +      return false;
 +
     nonmul->accept(this);
     fs_reg src0 = this->result;


More information about the mesa-dev mailing list