Dear all,
While doing a bit of work on rockboy optimization (some people think it would be
nice to have it run full speed), I came accross this in the rockboy source:
#ifdef ALLOW_UNALIGNED_IO /* long long is ok since this is i386-only anyway? */
#define MEMCPY8(d, s) ((*(long long *)(d)) = (*(long long *)(s)))
#else
#define MEMCPY8(d, s) memcpy((d), (s), 8)
#endif
A first optimization (which already gives a nice performance boost) is to
replace the second define by
#define MEMCPY8(d, s) {d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; d[3] = s[3]; \
d[4] = s[4]; d[5] = s[5]; d[6] = s[6]; d[7] = s[7];}
but it would even be better if we could use the first one. So the question is:
On the processors we use (ColdFire and SH7034), is the following instruction
authorized, even if s and d are not aligned?
((*(long long *)(d)) = (*(long long *)(s)))
Fred
PS: other rockboy optimizations are on the way...