[Mesa-dev] [PATCH] nir: Make vec-to-movs handle src/dest aliasing.

Connor Abbott cwabbott0 at gmail.com
Fri Jan 23 15:21:36 PST 2015


On Fri, Jan 23, 2015 at 5:34 PM, Eric Anholt <eric at anholt.net> wrote:
> Connor Abbott <cwabbott0 at gmail.com> writes:
>
>> Argh, nevermind, I was reading it wrong...
>>
>> On Thu, Jan 22, 2015 at 8:18 PM, Connor Abbott <cwabbott0 at gmail.com> wrote:
>>> What happens if you have something like foo = vec3(foo.z, bar.x,
>>> foo.x)? I don't think emitting vector mov's for only the contiguous
>>> components is enough.
>>>
>>> On Thu, Jan 22, 2015 at 4:51 PM, Eric Anholt <eric at anholt.net> wrote:
>>>> +static unsigned
>>>> +insert_movs(nir_alu_instr *vec, unsigned start_channel,
>>>> +            unsigned start_src_idx, void *mem_ctx)
>>
>> We need a comment explaining what this function does and what it
>> returns. Also, it only creates a single move so it should be called
>> insert_mov().
>
> How about:
>
> /**
>  * For a given writemask channel in the vec instruction, insert a MOV of all
>  * the src values that come from the same reg to the destination of the vec
>  * instruction.
>  */

First, I think we need to be a little more clear on what it does, e.g.
"for a given starting channel/source, scans the rest of the sources of
the vec instruction to find all sources that come from the same reg
and emits a writemasked MOV from the reg to the destination of the vec
instruction." Also, you need to explain what the return value is (a
mask of all the channels/sources we inserted a MOV for).


More information about the mesa-dev mailing list