[Mesa-dev] [PATCH] tgsi/scan: fix uses_double

Brian Paul brianp at vmware.com
Tue Aug 22 16:29:25 UTC 2017


On 08/22/2017 09:52 AM, Nicolai Hähnle wrote:
> On 22.08.2017 17:42, Marek Olšák wrote:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>>   src/gallium/auxiliary/tgsi/tgsi_scan.c | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c
>> b/src/gallium/auxiliary/tgsi/tgsi_scan.c
>> index 2fd7d7c..db87ce3 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
>> @@ -450,22 +450,28 @@ scan_instruction(struct tgsi_shader_info *info,
>>               info->uses_linear_opcode_interp_offset = TRUE;
>>               break;
>>            case TGSI_OPCODE_INTERP_SAMPLE:
>>               info->uses_linear_opcode_interp_sample = TRUE;
>>               break;
>>            }
>>            break;
>>         }
>>      }
>> -   if (fullinst->Instruction.Opcode >= TGSI_OPCODE_F2D &&
>> -       fullinst->Instruction.Opcode <= TGSI_OPCODE_DSSG)
>> +   if ((fullinst->Instruction.Opcode >= TGSI_OPCODE_F2D &&
>> +        fullinst->Instruction.Opcode <= TGSI_OPCODE_DSSG) ||
>> +       fullinst->Instruction.Opcode == TGSI_OPCODE_DFMA ||
>> +       fullinst->Instruction.Opcode == TGSI_OPCODE_DDIV ||
>> +       fullinst->Instruction.Opcode == TGSI_OPCODE_D2U64 ||
>> +       fullinst->Instruction.Opcode == TGSI_OPCODE_D2I64 ||
>> +       fullinst->Instruction.Opcode == TGSI_OPCODE_U642D ||
>> +       fullinst->Instruction.Opcode == TGSI_OPCODE_I642D)
>>         info->uses_doubles = TRUE;


I'd suggest creating a tgsi_uses_double(opcode) helper function.  And 
use explicit switch cases instead of range checks just in case we ever 
renumber the opcodes.  The compiler should optimize the switch cases 
accordingly.

-Brian


>
> Nice.
>
> In a neat coincidence, this is precisely the kind of thing that can be
> done more cleanly on top of the tgsi_info series that I just sent out :)
>
> I suggest using that, but for now this approach is also
>
> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
>
>>      for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) {
>>         scan_src_operand(info, fullinst, &fullinst->Src[i], i,
>>                          tgsi_util_get_inst_usage_mask(fullinst, i),
>>                          is_interp_instruction, &is_mem_inst);
>>      }
>>      if (fullinst->Instruction.Texture) {
>>         for (i = 0; i < fullinst->Texture.NumOffsets; i++) {
>>
>
>



More information about the mesa-dev mailing list