[Mesa-dev] [PATCH 07/16] i965: Add is_3src() to backend_instruction.

Matt Turner mattst88 at gmail.com
Fri Jan 23 13:19:18 PST 2015


On Fri, Jan 23, 2015 at 11:42 AM, Ian Romanick <idr at freedesktop.org> wrote:
> On 01/20/2015 12:16 AM, Kenneth Graunke wrote:
>> On Monday, January 19, 2015 03:31:06 PM Matt Turner wrote:
>>> ---
>>>  src/mesa/drivers/dri/i965/brw_shader.cpp                | 10 ++++++++++
>>>  src/mesa/drivers/dri/i965/brw_shader.h                  |  1 +
>>>  src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp |  6 +-----
>>>  3 files changed, 12 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
>>> index cbdf976..c6fead7 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
>>> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
>>> @@ -678,6 +678,16 @@ backend_reg::is_accumulator() const
>>>  }
>>>
>>>  bool
>>> +backend_instruction::is_3src() const
>>> +{
>>> +   return opcode == BRW_OPCODE_LRP ||
>>> +          opcode == BRW_OPCODE_MAD ||
>>> +          opcode == BRW_OPCODE_BFE ||
>>> +          opcode == BRW_OPCODE_BFI2 ||
>>> +          opcode == BRW_OPCODE_CSEL;
>
> Can this also replace is_3src() in brw_eu_compact.c?  FWIW, that
> function was already doing basically what Ken suggests below... and you
> wrote it!  (Commit 31eed95b)

Not easily (or cleanly) if we want it as a method of
backend_instruction. Not much code savings either.

>> Pah, manual listings of things :)  Let's do even better:
>>
>>    return opcode < 128 && opcode_descs[op].nsrc == 3;
>
> Shouldn't that be
>
>    return opcode < ARRAY_SIZE(opcode_descs) && opcode_descs[opode].nsrc
> == 3;

Yes.


More information about the mesa-dev mailing list