[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] transform module not MMX



I don't know if this supplemental patch to transform_sse.patch is necessary but I am including it for completeness. It protects the stack variables I use in the PMULHUW macro by moving the stack pointer. As far as I can tell system interrupts do not affect the application stack, but exceptions and signals do. So this patch may make the code more debugger and signal friendly.

Lenard Lindstrom wrote:
Yes, filter_shrink_Y_MMX was giving me concern. But I think this new replacement patch catches all the SSE instructions. I tested it with test/transform_test.py and examples/scaletest.py . Shrinking works. I have built but not tested it with SSE instructions enables, the default build. The disassembled code looks correct. My only concern I have is that my use of the stack pointer esp in the PMULHUW macro is compatible across operating systems.

René Dudfield wrote:
ah,

cool.  So the filter_shrink_Y_MMX function still needs to be fixed?

On 8/15/07, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
Lenard Lindstrom wrote:
Lenard Lindstrom wrote:
The assembler code in the transform module is not MMX as advertised.
It contains at least one SSE instruction: PSHUFW .

This is a patch for SVN transform.c that removes the offensive SSE
instructions when the macro NO_SSE is defined.

Never mind. I overlooked the PMULHUW SSE instructions in
filter_shrink_Y_MMX .

--
Lenard Lindstrom
<len-l@xxxxxxxxx>




--
Lenard Lindstrom
<len-l@xxxxxxxxx>

40c40,41
<   " movq       %%mm" #mmxregno_d ",            -16(%%esp);"  \
---
>   " subl                       $16,                 %%esp;"  \
>   " movq       %%mm" #mmxregno_d ",               (%%esp);"  \
43,44c44,45
<   " movq       %%mm" #mmxregno_d ",             -8(%%esp);"  \
<   " movq                -16(%%esp),   %%mm" #mmxregno_d ";"  \
---
>   " movq       %%mm" #mmxregno_d ",              8(%%esp);"  \
>   " movq                   (%%esp),   %%mm" #mmxregno_d ";"  \
46,47c47,48
<   " paddw                -8(%%esp),   %%mm" #mmxregno_d ";"  \
<   " movq       %%mm" #mmxregno_d ",             -8(%%esp);"  \
---
>   " paddw                 8(%%esp),   %%mm" #mmxregno_d ";"  \
>   " movq       %%mm" #mmxregno_d ",              8(%%esp);"  \
51,52c52,54
<   " pand                -16(%%esp),   %%mm" #mmxregno_d ";"  \
<   " paddw                -8(%%esp),   %%mm" #mmxregno_d ";"
---
>   " pand                   (%%esp),   %%mm" #mmxregno_d ";"  \
>   " paddw                 8(%%esp),   %%mm" #mmxregno_d ";"  \
>   " addl                       $16,                 %%esp;"