Index: lib/libc/powerpc64/string/bcopy.S =================================================================== --- lib/libc/powerpc64/string/bcopy.S +++ lib/libc/powerpc64/string/bcopy.S @@ -34,6 +34,11 @@ #define BLOCK_SIZE (1 << BLOCK_SIZE_BITS) #define BLOCK_SIZE_MASK (BLOCK_SIZE - 1) +/* Minimum 8 byte alignment, to avoid cache-inhibited alignment faults.*/ +#ifndef ALIGN_MASK +#define ALIGN_MASK 0x7 +#endif + #define MULTI_PHASE_THRESHOLD 512 #ifndef FN_NAME @@ -67,8 +72,14 @@ #endif cmpldi %r5, MULTI_PHASE_THRESHOLD - bge .Lmulti_phase - + blt .Lavoid_vsx + /*check if aligned. if aligned, go to multi_phase*/ + andi. %r8, %r3, ALIGN_MASK + andi. %r7, %r4, ALIGN_MASK + cmpd %r8, %r7 + beq .Lmulti_phase + +.Lavoid_vsx: /* align src */ cmpd %r4, %r3 /* forward or backward copy? */ blt .Lbackward_align