static inline void sad8_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h) { int len= -(stride<<h); asm volatile( ".balign 16			\n\t" "1:				\n\t" "movq (%1, %%eax), %%mm0	\n\t" "movq (%2, %%eax), %%mm2	\n\t" "movq (%2, %%eax), %%mm4	\n\t" "addl %3, %%eax			\n\t" "psubusb %%mm0, %%mm2		\n\t" "psubusb %%mm4, %%mm0		\n\t" "movq (%1, %%eax), %%mm1	\n\t" "movq (%2, %%eax), %%mm3	\n\t" "movq (%2, %%eax), %%mm5	\n\t" "psubusb %%mm1, %%mm3		\n\t" "psubusb %%mm5, %%mm1		\n\t" "por %%mm2, %%mm0		\n\t" "por %%mm1, %%mm3		\n\t" "movq %%mm0, %%mm1		\n\t" "movq %%mm3, %%mm2		\n\t" "punpcklbw %%mm7, %%mm0		\n\t" "punpckhbw %%mm7, %%mm1		\n\t" "punpcklbw %%mm7, %%mm3		\n\t" "punpckhbw %%mm7, %%mm2		\n\t" "paddw %%mm1, %%mm0		\n\t" "paddw %%mm3, %%mm2		\n\t" "paddw %%mm2, %%mm0		\n\t" "paddw %%mm0, %%mm6		\n\t" "addl %3, %%eax			\n\t" " js 1b				\n\t" : "+a" (len) : "r" (blk1 - len), "r" (blk2 - len), "r" (stride) ); }
PIX_SAD(mmx)
static inline void sad8_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h){    int len= -(stride<<h);    asm volatile(        ".balign 16			\n\t"        "1:				\n\t"        "movq (%1, %%eax), %%mm0	\n\t"        "movq (%2, %%eax), %%mm2	\n\t"        "movq (%2, %%eax), %%mm4	\n\t"        "addl %3, %%eax			\n\t"        "psubusb %%mm0, %%mm2		\n\t"        "psubusb %%mm4, %%mm0		\n\t"        "movq (%1, %%eax), %%mm1	\n\t"        "movq (%2, %%eax), %%mm3	\n\t"        "movq (%2, %%eax), %%mm5	\n\t"        "psubusb %%mm1, %%mm3		\n\t"        "psubusb %%mm5, %%mm1		\n\t"        "por %%mm2, %%mm0		\n\t"        "por %%mm1, %%mm3		\n\t"        "movq %%mm0, %%mm1		\n\t"        "movq %%mm3, %%mm2		\n\t"        "punpcklbw %%mm7, %%mm0		\n\t"        "punpckhbw %%mm7, %%mm1		\n\t"        "punpcklbw %%mm7, %%mm3		\n\t"        "punpckhbw %%mm7, %%mm2		\n\t"        "paddw %%mm1, %%mm0		\n\t"        "paddw %%mm3, %%mm2		\n\t"        "paddw %%mm2, %%mm0		\n\t"        "paddw %%mm0, %%mm6		\n\t"        "addl %3, %%eax			\n\t"        " js 1b				\n\t"        : "+a" (len)        : "r" (blk1 - len), "r" (blk2 - len), "r" (stride)    );}