diff options
author | Michal Simek <monstr@monstr.eu> | 2010-10-09 00:05:58 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2010-10-21 01:52:02 -0400 |
commit | 1180b28ca82c529972bfd438467d5cd71cca5372 (patch) | |
tree | a97ade3a37875493a06fabfed24d3075f4c61f60 /arch/microblaze | |
parent | 93e2e85139509338c68279c7260ebb68177b23a9 (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')
-rw-r--r-- | arch/microblaze/lib/memcpy.c | 33 | ||||
-rw-r--r-- | arch/microblaze/lib/memmove.c | 33 |
2 files changed, 60 insertions, 6 deletions
diff --git a/arch/microblaze/lib/memcpy.c b/arch/microblaze/lib/memcpy.c index ab2d115f9ee5..cc495d7d99cc 100644 --- a/arch/microblaze/lib/memcpy.c +++ b/arch/microblaze/lib/memcpy.c | |||
@@ -93,7 +93,7 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c) | |||
93 | case 0x1: /* Unaligned - Off by 1 */ | 93 | case 0x1: /* Unaligned - Off by 1 */ |
94 | /* Word align the source */ | 94 | /* Word align the source */ |
95 | i_src = (const void *) ((unsigned)src & ~3); | 95 | i_src = (const void *) ((unsigned)src & ~3); |
96 | 96 | #ifndef __MICROBLAZEEL__ | |
97 | /* Load the holding buffer */ | 97 | /* Load the holding buffer */ |
98 | buf_hold = *i_src++ << 8; | 98 | buf_hold = *i_src++ << 8; |
99 | 99 | ||
@@ -102,7 +102,16 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c) | |||
102 | *i_dst++ = buf_hold | value >> 24; | 102 | *i_dst++ = buf_hold | value >> 24; |
103 | buf_hold = value << 8; | 103 | buf_hold = value << 8; |
104 | } | 104 | } |
105 | #else | ||
106 | /* Load the holding buffer */ | ||
107 | buf_hold = (*i_src++ & 0xFFFFFF00) >>8; | ||
105 | 108 | ||
109 | for (; c >= 4; c -= 4) { | ||
110 | value = *i_src++; | ||
111 | *i_dst++ = buf_hold | ((value & 0xFF) << 24); | ||
112 | buf_hold = (value & 0xFFFFFF00) >>8; | ||
113 | } | ||
114 | #endif | ||
106 | /* Realign the source */ | 115 | /* Realign the source */ |
107 | src = (const void *)i_src; | 116 | src = (const void *)i_src; |
108 | src -= 3; | 117 | src -= 3; |
@@ -110,7 +119,7 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c) | |||
110 | case 0x2: /* Unaligned - Off by 2 */ | 119 | case 0x2: /* Unaligned - Off by 2 */ |
111 | /* Word align the source */ | 120 | /* Word align the source */ |
112 | i_src = (const void *) ((unsigned)src & ~3); | 121 | i_src = (const void *) ((unsigned)src & ~3); |
113 | 122 | #ifndef __MICROBLAZEEL__ | |
114 | /* Load the holding buffer */ | 123 | /* Load the holding buffer */ |
115 | buf_hold = *i_src++ << 16; | 124 | buf_hold = *i_src++ << 16; |
116 | 125 | ||
@@ -119,7 +128,16 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c) | |||
119 | *i_dst++ = buf_hold | value >> 16; | 128 | *i_dst++ = buf_hold | value >> 16; |
120 | buf_hold = value << 16; | 129 | buf_hold = value << 16; |
121 | } | 130 | } |
131 | #else | ||
132 | /* Load the holding buffer */ | ||
133 | buf_hold = (*i_src++ & 0xFFFF0000 )>>16; | ||
122 | 134 | ||
135 | for (; c >= 4; c -= 4) { | ||
136 | value = *i_src++; | ||
137 | *i_dst++ = buf_hold | ((value & 0xFFFF)<<16); | ||
138 | buf_hold = (value & 0xFFFF0000) >>16; | ||
139 | } | ||
140 | #endif | ||
123 | /* Realign the source */ | 141 | /* Realign the source */ |
124 | src = (const void *)i_src; | 142 | src = (const void *)i_src; |
125 | src -= 2; | 143 | src -= 2; |
@@ -127,7 +145,7 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c) | |||
127 | case 0x3: /* Unaligned - Off by 3 */ | 145 | case 0x3: /* Unaligned - Off by 3 */ |
128 | /* Word align the source */ | 146 | /* Word align the source */ |
129 | i_src = (const void *) ((unsigned)src & ~3); | 147 | i_src = (const void *) ((unsigned)src & ~3); |
130 | 148 | #ifndef __MICROBLAZEEL__ | |
131 | /* Load the holding buffer */ | 149 | /* Load the holding buffer */ |
132 | buf_hold = *i_src++ << 24; | 150 | buf_hold = *i_src++ << 24; |
133 | 151 | ||
@@ -136,7 +154,16 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c) | |||
136 | *i_dst++ = buf_hold | value >> 8; | 154 | *i_dst++ = buf_hold | value >> 8; |
137 | buf_hold = value << 24; | 155 | buf_hold = value << 24; |
138 | } | 156 | } |
157 | #else | ||
158 | /* Load the holding buffer */ | ||
159 | buf_hold = (*i_src++ & 0xFF000000) >> 24; | ||
139 | 160 | ||
161 | for (; c >= 4; c -= 4) { | ||
162 | value = *i_src++; | ||
163 | *i_dst++ = buf_hold | ((value & 0xFFFFFF) << 8); | ||
164 | buf_hold = (value & 0xFF000000) >> 24; | ||
165 | } | ||
166 | #endif | ||
140 | /* Realign the source */ | 167 | /* Realign the source */ |
141 | src = (const void *)i_src; | 168 | src = (const void *)i_src; |
142 | src -= 1; | 169 | src -= 1; |
diff --git a/arch/microblaze/lib/memmove.c b/arch/microblaze/lib/memmove.c index 1d3c0e7990e5..123e3616f2dd 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; |