summaryrefslogtreecommitdiff
path: root/libc/sysdeps/powerpc/powerpc64/power6/wordcopy.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/powerpc/powerpc64/power6/wordcopy.c')
-rw-r--r--libc/sysdeps/powerpc/powerpc64/power6/wordcopy.c256
1 files changed, 32 insertions, 224 deletions
diff --git a/libc/sysdeps/powerpc/powerpc64/power6/wordcopy.c b/libc/sysdeps/powerpc/powerpc64/power6/wordcopy.c
index 184904db5..4c72404e3 100644
--- a/libc/sysdeps/powerpc/powerpc64/power6/wordcopy.c
+++ b/libc/sysdeps/powerpc/powerpc64/power6/wordcopy.c
@@ -1,5 +1,5 @@
/* _memcopy.c -- subroutines for memory copy functions.
- Copyright (C) 1991, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1991-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund (tege@sics.se).
@@ -59,6 +59,21 @@ _wordcopy_fwd_aligned (dstp, srcp, len)
while (len != 0);
}
+#define fwd_align_merge(align) \
+ do \
+ { \
+ a1 = ((op_t *) srcp)[1]; \
+ a2 = ((op_t *) srcp)[2]; \
+ ((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (64-align*8)); \
+ ((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (64-align*8)); \
+ a0 = a2; \
+ srcp += 2 * OPSIZ; \
+ dstp += 2 * OPSIZ; \
+ len -= 2; \
+ } \
+ while (len != 0)
+
+
/* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to
block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
DSTP should be aligned for memory operations on `op_t's, but SRCP must
@@ -100,114 +115,7 @@ _wordcopy_fwd_dest_aligned (dstp, srcp, len)
len -= 1;
}
- switch (align)
- {
- case 1:
- do
- {
- a1 = ((op_t *) srcp)[1];
- a2 = ((op_t *) srcp)[2];
- ((op_t *) dstp)[0] = MERGE (a0, 8, a1, (64-8));
- ((op_t *) dstp)[1] = MERGE (a1, 8, a2, (64-8));
- a0 = a2;
-
- srcp += 2 * OPSIZ;
- dstp += 2 * OPSIZ;
- len -= 2;
- }
- while (len != 0);
- break;
- case 2:
- do
- {
- a1 = ((op_t *) srcp)[1];
- a2 = ((op_t *) srcp)[2];
- ((op_t *) dstp)[0] = MERGE (a0, 16, a1, (64-16));
- ((op_t *) dstp)[1] = MERGE (a1, 16, a2, (64-16));
- a0 = a2;
-
- srcp += 2 * OPSIZ;
- dstp += 2 * OPSIZ;
- len -= 2;
- }
- while (len != 0);
- break;
- case 3:
- do
- {
- a1 = ((op_t *) srcp)[1];
- a2 = ((op_t *) srcp)[2];
- ((op_t *) dstp)[0] = MERGE (a0, 24, a1, (64-24));
- ((op_t *) dstp)[1] = MERGE (a1, 24, a2, (64-24));
- a0 = a2;
-
- srcp += 2 * OPSIZ;
- dstp += 2 * OPSIZ;
- len -= 2;
- }
- while (len != 0);
- break;
- case 4:
- do
- {
- a1 = ((op_t *) srcp)[1];
- a2 = ((op_t *) srcp)[2];
- ((op_t *) dstp)[0] = MERGE (a0, 32, a1, (64-32));
- ((op_t *) dstp)[1] = MERGE (a1, 32, a2, (64-32));
- a0 = a2;
-
- srcp += 2 * OPSIZ;
- dstp += 2 * OPSIZ;
- len -= 2;
- }
- while (len != 0);
- break;
- case 5:
- do
- {
- a1 = ((op_t *) srcp)[1];
- a2 = ((op_t *) srcp)[2];
- ((op_t *) dstp)[0] = MERGE (a0, 40, a1, (64-40));
- ((op_t *) dstp)[1] = MERGE (a1, 40, a2, (64-40));
- a0 = a2;
-
- srcp += 2 * OPSIZ;
- dstp += 2 * OPSIZ;
- len -= 2;
- }
- while (len != 0);
- break;
- case 6:
- do
- {
- a1 = ((op_t *) srcp)[1];
- a2 = ((op_t *) srcp)[2];
- ((op_t *) dstp)[0] = MERGE (a0, 48, a1, (64-48));
- ((op_t *) dstp)[1] = MERGE (a1, 48, a2, (64-48));
- a0 = a2;
-
- srcp += 2 * OPSIZ;
- dstp += 2 * OPSIZ;
- len -= 2;
- }
- while (len != 0);
- break;
- case 7:
- do
- {
- a1 = ((op_t *) srcp)[1];
- a2 = ((op_t *) srcp)[2];
- ((op_t *) dstp)[0] = MERGE (a0, 56, a1, (64-56));
- ((op_t *) dstp)[1] = MERGE (a1, 56, a2, (64-56));
- a0 = a2;
-
- srcp += 2 * OPSIZ;
- dstp += 2 * OPSIZ;
- len -= 2;
- }
- while (len != 0);
- break;
- }
+ fwd_align_merge (align);
}
@@ -250,6 +158,20 @@ _wordcopy_bwd_aligned (dstp, srcp, len)
while (len != 0);
}
+#define bwd_align_merge(align) \
+ do \
+ { \
+ srcp -= 2 * OPSIZ; \
+ dstp -= 2 * OPSIZ; \
+ a1 = ((op_t *) srcp)[1]; \
+ a0 = ((op_t *) srcp)[0]; \
+ ((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (64-align*8)); \
+ ((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (64-align*8)); \
+ a2 = a0; \
+ len -= 2; \
+ } \
+ while (len != 0)
+
/* _wordcopy_bwd_dest_aligned -- Copy block finishing right
before SRCP to block finishing right before DSTP with LEN `op_t'
words (not LEN bytes!). DSTP should be aligned for memory
@@ -291,119 +213,5 @@ _wordcopy_bwd_dest_aligned (dstp, srcp, len)
len -= 1;
}
- switch (align)
- {
- case 1:
- do
- {
- srcp -= 2 * OPSIZ;
- dstp -= 2 * OPSIZ;
-
- a1 = ((op_t *) srcp)[1];
- a0 = ((op_t *) srcp)[0];
- ((op_t *) dstp)[1] = MERGE (a1, 8, a2, (64-8));
- ((op_t *) dstp)[0] = MERGE (a0, 8, a1, (64-8));
- a2 = a0;
-
- len -= 2;
- }
- while (len != 0);
- break;
- case 2:
- do
- {
- srcp -= 2 * OPSIZ;
- dstp -= 2 * OPSIZ;
-
- a1 = ((op_t *) srcp)[1];
- a0 = ((op_t *) srcp)[0];
- ((op_t *) dstp)[1] = MERGE (a1, 16, a2, (64-16));
- ((op_t *) dstp)[0] = MERGE (a0, 16, a1, (64-16));
- a2 = a0;
-
- len -= 2;
- }
- while (len != 0);
- break;
- case 3:
- do
- {
- srcp -= 2 * OPSIZ;
- dstp -= 2 * OPSIZ;
-
- a1 = ((op_t *) srcp)[1];
- a0 = ((op_t *) srcp)[0];
- ((op_t *) dstp)[1] = MERGE (a1, 24, a2, (64-24));
- ((op_t *) dstp)[0] = MERGE (a0, 24, a1, (64-24));
- a2 = a0;
-
- len -= 2;
- }
- while (len != 0);
- break;
- case 4:
- do
- {
- srcp -= 2 * OPSIZ;
- dstp -= 2 * OPSIZ;
-
- a1 = ((op_t *) srcp)[1];
- a0 = ((op_t *) srcp)[0];
- ((op_t *) dstp)[1] = MERGE (a1, 32, a2, (64-32));
- ((op_t *) dstp)[0] = MERGE (a0, 32, a1, (64-32));
- a2 = a0;
-
- len -= 2;
- }
- while (len != 0);
- break;
- case 5:
- do
- {
- srcp -= 2 * OPSIZ;
- dstp -= 2 * OPSIZ;
-
- a1 = ((op_t *) srcp)[1];
- a0 = ((op_t *) srcp)[0];
- ((op_t *) dstp)[1] = MERGE (a1, 40, a2, (64-40));
- ((op_t *) dstp)[0] = MERGE (a0, 40, a1, (64-40));
- a2 = a0;
-
- len -= 2;
- }
- while (len != 0);
- break;
- case 6:
- do
- {
- srcp -= 2 * OPSIZ;
- dstp -= 2 * OPSIZ;
-
- a1 = ((op_t *) srcp)[1];
- a0 = ((op_t *) srcp)[0];
- ((op_t *) dstp)[1] = MERGE (a1, 48, a2, (64-48));
- ((op_t *) dstp)[0] = MERGE (a0, 48, a1, (64-48));
- a2 = a0;
-
- len -= 2;
- }
- while (len != 0);
- break;
- case 7:
- do
- {
- srcp -= 2 * OPSIZ;
- dstp -= 2 * OPSIZ;
-
- a1 = ((op_t *) srcp)[1];
- a0 = ((op_t *) srcp)[0];
- ((op_t *) dstp)[1] = MERGE (a1, 56, a2, (64-56));
- ((op_t *) dstp)[0] = MERGE (a0, 56, a1, (64-56));
- a2 = a0;
-
- len -= 2;
- }
- while (len != 0);
- break;
- }
+ bwd_align_merge (align);
}