Re: Accelerating memset/memcpy
[email protected] 01 Oct 2002 10:31:26 -0700
| Newsgroups | gmane.os.netbsd.ports.mips |
|---|---|
| Message-ID | <[email protected]> |
At Tue, 01 Oct 2002 18:20:15 +0100, Nigel Stephens wrote: > Good point. So there's at least three alternatives to start with: "pref > 30", "create_dirty_exclusive" and "none". Let's hope that covers most of > them - now we just have to do a survey! But at least "pref 30" should be > a safe initial assumption for any MIPS32/MIPS64 processor. Well, and a fourth: Prefetch for read/write an appropriate distance ahead in your copy loop, or prefetch for write an appropriate distance ahead in your set loop. I believe that this will have the desired effect on most CPUs. (you can use 'pref 30' on the write side, if you put it far enough ahead of the writes, since IIRC a bunch of CPUs implement that op as 'prefetch for read' or 'prefetch for write' if they don't implement PrepareForStore.) (Also, since you don't want to stall on the reading the input data for a copy, you really should be prefetching ahead for data anyway. 8-) chris