On Mon, Jun 25, 2012 at 4:00 PM, Loren Merritt <[email protected]> wrote:
> On Mon, 25 Jun 2012, Jason Garrett-Glaser wrote:
>
>>> +    packssdw   m0, m3           ; m0 =  0,  6, 12, 18,  3,  9, 15, 21
>>> +    packssdw   m1, m4           ; m1 =  1,  7, 13, 19,  4, 10, 16, 22
>>> +    packssdw   m2, m5           ; m2 =  2,  8, 14, 20,  5, 11, 17, 23
>>> +                                ; unpack words:
>>> +    movhlps    m3, m0           ; m3 =  3,  9, 15, 21,  x,  x,  x,  x
>>> +    punpcklwd  m0, m1           ; m0 =  0,  1,  6,  7, 12, 13, 18, 19
>>> +    punpckhwd  m1, m2           ; m1 =  4,  5, 10, 11, 16, 17, 22, 23
>>> +    punpcklwd  m2, m3           ; m2 =  2,  3,  8,  9, 14, 15, 20, 21
>>> +                                ; unpack dwords:
>>> +    punpckhdq  m3, m0, m2       ; m3 = 12, 13, 14, 15, 18, 19, 20, 21
>
> If you swap the inputs here
>
>>> +    punpckldq  m2, m1           ; m2 =  2,  3,  4,  5,  8,  9, 10, 11
>>> +                                ; shuffle qwords:
>>> +    movhlps    m4, m2           ; m4 =  8,  9, 10, 11,  x,  x,  x,  x
>>> +    movlhps    m4, m3           ; m4 =  8,  9, 10, 11, 12, 13, 14, 15 
>>> (final)
>
> then you can get away with one less op here
>
>>> +    movlhps    m2, m0           ; m2 =  2,  3,  4,  5,  0,  1,  6,  7
>>> +    movhlps    m3, m1           ; m3 = 16, 17, 22, 23, 18, 19, 20, 21
>
> at the cost of changing this to shufps or pblendw or vpperm.
> Which should be a good tradeoff on nehalem+ and k10+, but bad on
> conroe/penryn/k8.
>
>>> +                                ; shuffle dwords:
>>> +    pshufd     m2, m2, q3102    ; m2 =  0,  1,  2,  3,  4,  5,  6,  7 
>>> (final)
>>> +    pshufd     m3, m3, q1320    ; m3 = 16, 17, 18, 19, 20, 21, 22, 23 
>>> (final)
>>
>> Could some shuffps be used here instead?
>
> No, shufps has the constraint that the bottom half must come from one
> source reg and the top half from the other. vpperm would work.

I meant in place of some of the previous movhlps/movlhps stuff as
well, not merely the pshufd.

Jason
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to