Re: Athlon problem report summary

Alan Cox (alan@lxorguk.ukuu.org.uk)
Sat, 21 Apr 2001 01:34:46 +0100 (BST)


> Is there anything out there to test/benchmark MMX ops? (Preferably with
> reporting on MMX and equiv non-MMX ops, tunable memory bandwidth, etc.)

I wrote a set of programs to tune the MMX code. Arjan I suspect did similar
when he reoptimised the code for the newer Athlon. Simple stuff like

#include <stdio.h>

char space[1024*1024];
char target[1024*1024];

void mmx_copy(char *from, char *to)
{
int i;
char fpu_save[108];
__asm__ __volatile__ ( " fsave %0; fwait\n"::"m"(fpu_save[0]) );
__asm__ __volatile__ (
" prefetch (%0)\n"
" prefetch 64(%0)\n"
" prefetch 128(%0)\n"
" prefetch 192(%0)\n"
" prefetch 256(%0)\n"
: : "r" (from) );

for(i=0;i<4096/64;i++)
{
__asm__ __volatile__ (
" prefetch 320(%0)\n"
" movq (%0), %%mm0\n"
" movq 8(%0), %%mm1\n"
" movq 16(%0), %%mm2\n"
" movq 24(%0), %%mm3\n"
" movq %%mm0, (%1)\n"
" movq %%mm1, 8(%1)\n"
" movq %%mm2, 16(%1)\n"
" movq %%mm3, 24(%1)\n"
" movq 32(%0), %%mm0\n"
" movq 40(%0), %%mm1\n"
" movq 48(%0), %%mm2\n"
" movq 56(%0), %%mm3\n"
" movq %%mm0, 32(%1)\n"
" movq %%mm1, 40(%1)\n"
" movq %%mm2, 48(%1)\n"
" movq %%mm3, 56(%1)\n"
: : "r" (from), "r" (to) : "memory");
from+=64;
to+=64;
}
__asm__ __volatile__ ( " frstor %0;\n"::"m"(fpu_save[0]) );
}

int main(int argc, char *argv)
{
char *from=space;
char *to=target;
int r;
int i;
for(r=0;r<2048;r++)
{
for(i=0;i<256;i++)
{
mmx_copy(from, to);
from+=4096;
to+=4096;

}
from=space;
to=target;
}
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/