[Mesa-dev] [PATCH 1/6] glsl: Optimize ~~x into x.

Eric Anholt eric at anholt.net
Thu Feb 6 13:56:28 PST 2014


Matt Turner <mattst88 at gmail.com> writes:

> On Sun, Jan 19, 2014 at 11:18 PM, Eric Anholt <eric at anholt.net> wrote:
>> ---
>>  src/glsl/opt_algebraic.cpp | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
>> index 332f0b7..6b0d992 100644
>> --- a/src/glsl/opt_algebraic.cpp
>> +++ b/src/glsl/opt_algebraic.cpp
>> @@ -218,6 +218,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
>>        this->mem_ctx = ralloc_parent(ir);
>>
>>     switch (ir->operation) {
>> +   case ir_unop_bit_not:
>> +      if (op_expr[0] == NULL)
>> +        break;
>> +
>> +      switch (op_expr[0]->operation) {
>> +      case ir_unop_bit_not:
>> +         return abs(op_expr[0]->operands[0]);
>> +      default:
>> +         break;
>> +      }
>> +      break;
>> +
>>     case ir_unop_abs:
>>        if (op_expr[0] == NULL)
>>          break;
>> --
>> 1.8.5.2
>
> Don't forget to commit this series :)

It's still sitting on my master branch.  Since a bug had been caught, I
tried writing some piglit tests using the autogeneration stuff.  That
didn't turn out very well so I backed off and I'm going to just commit
it as is.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140206/14e829a8/attachment.pgp>


More information about the mesa-dev mailing list