Re: [PATCH] optimised memmove() for alpha

Tim Waugh (tim@cyberelk.demon.co.uk)
Fri, 28 May 1999 21:53:03 +0100 (GMT)


Here is an untested fix to the memmove patch.

I think the code looks quite ugly with tests everywhere to see which
direction we are going in. Perhaps it would be better to split out
separate functions for that, and have memcpy just use the 'up' versions.

Tim.
*/

--- memcpy.c.orig Fri May 28 21:47:22 1999
+++ memcpy.c Fri May 28 21:49:17 1999
@@ -106,11 +106,13 @@
n -= 8;
while (n >= 0) {
unsigned long tmp;
+ if (dir <= 0) s -= 8;
__asm__("ldq %0,%1":"=r" (tmp):"m" (*(unsigned long *) s));
n -= 8;
- (dir > 0) ? (s += 8) : (s -= 8);
+ if (dir > 0) s += 8;
+ else d -= 8;
*(unsigned long *) d = tmp;
- (dir > 0) ? (d += 8) : (d -= 8);
+ if (dir > 0) d += 8;
}
n += 8;
DO_REST_ALIGNED(d,s,n);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/