Explanation, please!

Network News news at amdcad.AMD.COM
Wed Sep 7 11:10:03 AEST 1988


In article <5654 at june.cs.washington.edu> pardo at uw-june.UUCP (David Keppel) writes:
| hankd at pur-ee.UUCP (Hank Dietz) writes:
| >	if ((p - q) & 3) *byte copy* else *struct copy*
| 
| I believe that the VAX "movc" command takes arbitrary pointers and
| does the following:
| 
| * If both are word-aligned, do a word copy (I mean a 4-byte word).
| * If both are non-aligned and could be aligned with 1, 2, or 3 bytes
|   of byte-copy at either end, then do a byte copy at either end and do
|   a word copy down the middle.
| * If niether aligned then ??
| 
| Unfortunately, my VAX hardware reference is out of town for a couple
| of weeks, so I can't ask him about neither aligned.  Anybody know?

I assume that "both are non-aligned" in the above list means that the
source and the destination have the same alignment, but are not aligned
with respect to a 4-byte boundary, and that "neither aligned" means that
the source and the destination are misaligned.

We use an interesting trick in the Am29000 memcpy routine for
source/destination misalignment.  In this case, we set up the alignment
difference in the funnel-count register, read in two source words, and
"extract" a destination word using the funnel-shifter's ability to
extract any 32-bit word from a 64-bit double-word in a single cycle. 
The inner loop then consists of shifting the low source word to the high
source word, reading a new low source word, extracting a destination and
storing it (well, there is also the overhead of counting down the
correct number of "word" moves, but you get the idea.)

	-- Tim Olson
	Advanced Micro Devices
	(tim at delirun.amd.com)



More information about the Comp.lang.c mailing list