On 04/07/2014 05:41 AM, Ilia Mirkin wrote:
> On Mon, Apr 7, 2014 at 2:49 AM, Kenneth Graunke <kenn...@whitecape.org> wrote:
>> The i965 MUL instruction doesn't natively support 32-bit by 32-bit
>> integer multiplication; additional instructions (MACH/MOV) are required.
>> However, we can avoid those if we know one of the operands can be
>> represented in 16 bits or less.  The vector backend's is_16bit_constant
>> static helper function checks for this.
>>
>> We want to be able to use it in the scalar backend as well, which means
>> moving the function to a more generally-usable location.  Since it isn't
>> i965 specific, I decided to make it an ir_constant method, in case it
>> ends up being useful to other people as well.
>>
>> Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
>> ---
>>  src/glsl/ir.cpp                                |  9 +++++++++
>>  src/glsl/ir.h                                  | 11 +++++++++++
>>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 18 ++----------------
>>  3 files changed, 22 insertions(+), 16 deletions(-)
>>
>> diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
>> index a41eddf..07c0a9b 100644
>> --- a/src/glsl/ir.cpp
>> +++ b/src/glsl/ir.cpp
>> @@ -1223,6 +1223,15 @@ ir_constant::is_basis() const
>>     return ones == 1;
>>  }
>>
>> +bool
>> +ir_constant::is_16bit_integer_constant() const
> 
> Perhaps make this is_uint16_constant? Otherwise one might assume based
> on the name that it would return true for a value like -1.

I like that.  I've renamed it to is_uint16_constant and updated the
comments to clarify that it can return true for signed values, as long
as those values are non-negative and fit in 16-bits.

--Ken


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to