26#define MIN_AMOUNT_FOR_COMPLEX_COPY 8
27#define MIN_AMOUNT_FOR_MISALIGNED_COPY 8
34inline void lwl_copy(
byte *dst,
const byte *src) {
36 asm volatile (
"lwr %0,0(%1)\n\t"
38 :
"=&r" (data) :
"r" (src),
"m" (*src));
40 asm volatile (
"swr %1,0(%2)\n\t"
42 :
"=m" (*dst) :
"r" (data),
"r" (dst));
50 static void testCopy(
const byte *debugDst,
const byte *debugSrc, uint32 debugBytes);
51 static void copy(
byte *dst,
const byte *src, uint32 bytes);
52 static void copy32Aligned(uint32 *dst32,
const uint32 *src32, uint32 bytes);
53 static void copy32Misaligned(uint32 *dst32,
const byte *src, uint32 bytes, uint32 alignSrc);
55 static inline void copy8(
byte *dst,
const byte *src, int32 bytes) {
57 uint32 words = bytes >> 2;
58 for (; words; words--) {
64 uint32 bytesLeft = bytes & 0x3;
65 for (; bytesLeft; bytesLeft--) {
72 static void *fastCopy(
void *dstv,
const void *srcv, int32 bytes) {
73 byte *dst = (
byte *)dstv;
74 const byte *src = (
const byte *)srcv;
76 if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) {
77 copy8(dst, src, bytes);
79 copy(dst, src, bytes);
86inline void *psp_memcpy(
void *dst,
const void *src, int32 bytes) {
87 return PspMemory::fastCopy(dst, src, bytes);