aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/lib/memmove.c
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2010-10-09 00:05:58 -0400
committerMichal Simek <monstr@monstr.eu>2010-10-21 01:52:02 -0400
commit1180b28ca82c529972bfd438467d5cd71cca5372 (patch)
treea97ade3a37875493a06fabfed24d3075f4c61f60 /arch/microblaze/lib/memmove.c
parent93e2e85139509338c68279c7260ebb68177b23a9 (diff)
microblaze: Support C optimized lib functions for little-endian
Optimized C library functions can rapidly speedup the kernel. memset doesn't need to be optimized because there is no difference in behavior on little/big endian cpu. Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/lib/memmove.c')
-rw-r--r--arch/microblaze/lib/memmove.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/arch/microblaze/lib/memmove.c b/arch/microblaze/lib/memmove.c
index 1d3c0e7990e..123e3616f2d 100644
--- a/arch/microblaze/lib/memmove.c
+++ b/arch/microblaze/lib/memmove.c
@@ -114,7 +114,7 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
114 case 0x1: /* Unaligned - Off by 1 */ 114 case 0x1: /* Unaligned - Off by 1 */
115 /* Word align the source */ 115 /* Word align the source */
116 i_src = (const void *) (((unsigned)src + 4) & ~3); 116 i_src = (const void *) (((unsigned)src + 4) & ~3);
117 117#ifndef __MICROBLAZEEL__
118 /* Load the holding buffer */ 118 /* Load the holding buffer */
119 buf_hold = *--i_src >> 24; 119 buf_hold = *--i_src >> 24;
120 120
@@ -123,7 +123,16 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
123 *--i_dst = buf_hold << 8 | value; 123 *--i_dst = buf_hold << 8 | value;
124 buf_hold = value >> 24; 124 buf_hold = value >> 24;
125 } 125 }
126#else
127 /* Load the holding buffer */
128 buf_hold = (*--i_src & 0xFF) << 24;
126 129
130 for (; c >= 4; c -= 4) {
131 value = *--i_src;
132 *--i_dst = buf_hold | ((value & 0xFFFFFF00)>>8);
133 buf_hold = (value & 0xFF) << 24;
134 }
135#endif
127 /* Realign the source */ 136 /* Realign the source */
128 src = (const void *)i_src; 137 src = (const void *)i_src;
129 src += 1; 138 src += 1;
@@ -131,7 +140,7 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
131 case 0x2: /* Unaligned - Off by 2 */ 140 case 0x2: /* Unaligned - Off by 2 */
132 /* Word align the source */ 141 /* Word align the source */
133 i_src = (const void *) (((unsigned)src + 4) & ~3); 142 i_src = (const void *) (((unsigned)src + 4) & ~3);
134 143#ifndef __MICROBLAZEEL__
135 /* Load the holding buffer */ 144 /* Load the holding buffer */
136 buf_hold = *--i_src >> 16; 145 buf_hold = *--i_src >> 16;
137 146
@@ -140,7 +149,16 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
140 *--i_dst = buf_hold << 16 | value; 149 *--i_dst = buf_hold << 16 | value;
141 buf_hold = value >> 16; 150 buf_hold = value >> 16;
142 } 151 }
152#else
153 /* Load the holding buffer */
154 buf_hold = (*--i_src & 0xFFFF) << 16;
143 155
156 for (; c >= 4; c -= 4) {
157 value = *--i_src;
158 *--i_dst = buf_hold | ((value & 0xFFFF0000)>>16);
159 buf_hold = (value & 0xFFFF) << 16;
160 }
161#endif
144 /* Realign the source */ 162 /* Realign the source */
145 src = (const void *)i_src; 163 src = (const void *)i_src;
146 src += 2; 164 src += 2;
@@ -148,7 +166,7 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
148 case 0x3: /* Unaligned - Off by 3 */ 166 case 0x3: /* Unaligned - Off by 3 */
149 /* Word align the source */ 167 /* Word align the source */
150 i_src = (const void *) (((unsigned)src + 4) & ~3); 168 i_src = (const void *) (((unsigned)src + 4) & ~3);
151 169#ifndef __MICROBLAZEEL__
152 /* Load the holding buffer */ 170 /* Load the holding buffer */
153 buf_hold = *--i_src >> 8; 171 buf_hold = *--i_src >> 8;
154 172
@@ -157,7 +175,16 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
157 *--i_dst = buf_hold << 24 | value; 175 *--i_dst = buf_hold << 24 | value;
158 buf_hold = value >> 8; 176 buf_hold = value >> 8;
159 } 177 }
178#else
179 /* Load the holding buffer */
180 buf_hold = (*--i_src & 0xFFFFFF) << 8;
160 181
182 for (; c >= 4; c -= 4) {
183 value = *--i_src;
184 *--i_dst = buf_hold | ((value & 0xFF000000)>> 24);
185 buf_hold = (value & 0xFFFFFF) << 8;;
186 }
187#endif
161 /* Realign the source */ 188 /* Realign the source */
162 src = (const void *)i_src; 189 src = (const void *)i_src;
163 src += 3; 190 src += 3;