[Mesa-dev] [PATCH 3/3] i965: Emit MUL with a negated src for neg(mul(...)).

Matt Turner mattst88 at gmail.com
Mon Feb 23 09:38:42 PST 2015


On Sun, Feb 22, 2015 at 2:23 PM, Ben Widawsky <ben at bwidawsk.net> wrote:
> On Wed, Feb 11, 2015 at 02:54:51PM -0800, Matt Turner wrote:
>> total instructions in shared programs: 5932832 -> 5932736 (-0.00%)
>> instructions in affected programs:     8184 -> 8088 (-1.17%)
>> helped:                                52
>> HURT:                                  14
>> GAINED:                                1
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 14 ++++++++++++++
>>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 19 +++++++++++++++++++
>>  2 files changed, 33 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>> index b628bff..17849c7 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>> @@ -630,6 +630,20 @@ fs_visitor::visit(ir_expression *ir)
>>
>>     /* Deal with the real oddball stuff first */
>>     switch (ir->operation) {
>> +   case ir_unop_neg: {
>> +      if (!ir->type->is_float())
>> +         break;
>> +
>
> Perhaps obvious to some, but why is this only for floats?

Good question -- that's because we have to emit the MUL/MACH sequence
for integers and I didn't want to think about the argument ordering
changes and things like that. I guess we could apply this to cases
where we've got a 16-bit immediate, but I'm not sure it's worth it.


More information about the mesa-dev mailing list