This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [PATCH] Optimize MIPS memcpy
- From: Steve Ellcey <sellcey at mips dot com>
- To: Maxim Kuvyrkov <maxim at codesourcery dot com>
- Cc: Andrew T Pinski <pinskia at gmail dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, <libc-ports at sourceware dot org>
- Date: Mon, 15 Oct 2012 10:49:33 -0700
- Subject: Re: [PATCH] Optimize MIPS memcpy
- References: <5044746c.23eb440a.75e2.618f@mx.google.com> <1346771341.14333.20.camel@ubuntu-sellcey> <596797ED-6575-456D-98FD-C13A209DBC49@mentor.com> <1346948701.14333.152.camel@ubuntu-sellcey> <F265181B-6B5C-401B-B7CC-DC206B601795@codesourcery.com> <1347376645.14333.319.camel@ubuntu-sellcey> <F0856A02-839F-45C7-BF93-AA59E030A015@codesourcery.com> <1348166309.6170.55.camel@ubuntu-sellcey> <25105334-8813-4532-AC0E-B3A44BE69A19@codesourcery.com> <5B30D440-A918-4352-8DED-A7D681DF0338@codesourcery.com> <1349715796.30194.131.camel@ubuntu-sellcey> <954E9625-0D5C-4295-9229-C16A3F5C200D@codesourcery.com>
On Tue, 2012-10-09 at 11:30 +1300, Maxim Kuvyrkov wrote:
> I too want to keep prepare-for-store prefetches is possible. For debugging purposes you could amend
> prepare-for-store prefetch macros to trigger a loop that would unconditionally clobber memory locations
> that prepare-for-store is expected to zero-out. Or add some other assertions to help out with debugging.
>
> Thanks,
>
> --
> Maxim Kuvyrkov
> CodeSourcery / Mentor Graphics
Maxim,
Could you try running this test program on your system. I want to see
if it verifies that your machine is doing 32 byte prefetches. The
output I get looks like:
0x004754a0, (0x004754a0 to 0x004754c0, 32 byte prefetch)
0x004754a1, (0x004754a0 to 0x004754c0, 32 byte prefetch)
0x004754a2, (0x004754a0 to 0x004754c0, 32 byte prefetch)
0x004754a3, (0x004754a0 to 0x004754c0, 32 byte prefetch)
0x004754a4, (0x004754a0 to 0x004754c0, 32 byte prefetch)
0x004754a5, (0x004754a0 to 0x004754c0, 32 byte prefetch)
.
.
.
0x0047589b, (0x00475880 to 0x004758a0, 32 byte prefetch)
0x0047589c, (0x00475880 to 0x004758a0, 32 byte prefetch)
0x0047589d, (0x00475880 to 0x004758a0, 32 byte prefetch)
0x0047589e, (0x00475880 to 0x004758a0, 32 byte prefetch)
0x0047589f, (0x00475880 to 0x004758a0, 32 byte prefetch)
Steve Ellcey
sellcey@mips.com
#include <stdio.h>
char dummy[409600];
char buffer[3072];
check_buffer(char *p)
{
int i, zero_start, zero_stop;
/* Initialize buffer to non-zero data */
for (i = 0; i < 2048; i++)
buffer[i] = 1;
/* Clear buffer out of cache */
for (i = 0; i < 409600; i++)
dummy[i] = 9;
#if 1
__asm__ ("pref 30, 0x0(%0)" : : "r" (p));
#endif
/* Check contents for single block of zeros */
zero_start = 0;
while ((buffer[zero_start] == 1) && (zero_start < 2048)) zero_start++;
zero_stop = zero_start;
while ((buffer[zero_stop] == 0) && (zero_stop < 2048)) zero_stop++;
for (i = zero_stop; i < 2048; i++)
if (buffer[i] == 0) printf("Error, extra set of zeros\n");
if (zero_start >= 2048)
printf("0x%8.8x, (no zeros)\n", p);
else
printf("0x%8.8x, (0x%8.8x to 0x%8.8x, %d byte prefetch)\n", p, &buffer[zero_start], &buffer[zero_stop], (zero_stop - zero_start));
#if 0
/* Dump buffer contents */
for (i = 0; i < 2048; i++)
printf("%1d", buffer[i]);
printf("\n");
#endif
}
main()
{
int i;
for (i = 1024; i < 2048; i++)
check_buffer(&buffer[i]);
}