On Tue, Feb 25, 2014 at 12:41 AM, Ian Romanick <i...@freedesktop.org> wrote:
> On 02/24/2014 03:36 PM, Roland Scheidegger wrote:
>>
>> Am 25.02.2014 00:00, schrieb Matt Turner:
>>>
>>> ---
>>>   src/glsl/opt_algebraic.cpp | 3 +++
>>>   1 file changed, 3 insertions(+)
>>>
>>> diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
>>> index 778638c..50342ac 100644
>>> --- a/src/glsl/opt_algebraic.cpp
>>> +++ b/src/glsl/opt_algebraic.cpp
>>> @@ -421,6 +421,9 @@ ir_algebraic_visitor::handle_expression(ir_expression
>>> *ir)
>>>         }
>>>         if (is_vec_one(op_const[1]))
>>>          return ir->operands[0];
>>> +      if (is_vec_two(op_const[1]) && ir->type->is_integer()) {
>>> +         return rshift(ir->operands[0], new(mem_ctx) ir_constant(1));
>>> +      }
>>>         break;
>>>
>>>      case ir_binop_dot:
>>>
>>
>> Does glsl require any particular rounding behavior for negative numbers
>> (like c99 does, which wouldn't work with shift emulation)? A quick look
>> didn't find anything but it might be implied somewhere...
>
>
> What is a case by C99 rules where x / 2 is not the same as x >> 2?
>

-1 / 2 = 0 according to C99, but shifting will leave you with -1.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to