summaryrefslogtreecommitdiffstats
path: root/newlib/libc/machine
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2006-11-22 21:19:56 +0000
committerJeff Johnston <jjohnstn@redhat.com>2006-11-22 21:19:56 +0000
commit9bc5b6181bcaf823ff1bce61e2ca984920915afb (patch)
tree5d805d16b301ba8f9a2e2fead05aa8f99092fd56 /newlib/libc/machine
parentd22713e25db2660fa35444f572673624804b6586 (diff)
downloadcygnal-9bc5b6181bcaf823ff1bce61e2ca984920915afb.tar.gz
cygnal-9bc5b6181bcaf823ff1bce61e2ca984920915afb.tar.bz2
cygnal-9bc5b6181bcaf823ff1bce61e2ca984920915afb.zip
2006-11-22 Luca Barbato <lu_zero@gentoo.org>
* libc/machine/spu/memcpy.c: Use spu_splats, explicit cast. * libc/machine/spu/memmove.c: Use spu_splats, explicit cast. * libc/machine/spu/memset.c: Use spu_splats, remove apple-cast. * libc/machine/spu/strchr.c: Use spu_splats, remove apple-cast. * libc/machine/spu/strncat.c: Explicit cast. * libc/machine/spu/strncmp.c: Use spu_splats. * libc/machine/spu/strncpy.c: Explicit cast. * libc/machine/spu/strrchr.c: Use spu_splats. * libc/machine/spu/strspn.c: Use spu_splats.
Diffstat (limited to 'newlib/libc/machine')
-rw-r--r--newlib/libc/machine/spu/memcpy.c8
-rw-r--r--newlib/libc/machine/spu/memmove.c14
-rw-r--r--newlib/libc/machine/spu/memset.c8
-rw-r--r--newlib/libc/machine/spu/strchr.c4
-rw-r--r--newlib/libc/machine/spu/strncat.c5
-rw-r--r--newlib/libc/machine/spu/strncmp.c2
-rw-r--r--newlib/libc/machine/spu/strncpy.c6
-rw-r--r--newlib/libc/machine/spu/strrchr.c10
-rw-r--r--newlib/libc/machine/spu/strspn.c2
9 files changed, 29 insertions, 30 deletions
diff --git a/newlib/libc/machine/spu/memcpy.c b/newlib/libc/machine/spu/memcpy.c
index 08f835e47..dbbce8cee 100644
--- a/newlib/libc/machine/spu/memcpy.c
+++ b/newlib/libc/machine/spu/memcpy.c
@@ -38,7 +38,7 @@
* The memory areas may not overlap. The memcpy subroutine
* returns a pointer to dest.
*
- * Faster implemenation of this function can be implemented
+ * Faster implementation of this function can be implemented
* either with prior knowledge of the alignment or special
* casing specific optimal alignments.
*/
@@ -88,10 +88,10 @@ void * memcpy(void * __restrict__ dest, const void * __restrict__ src, size_t n)
* mask2 = mask for trailing unchange bytes
* mask3 = mask indicating the more than one qword is being changed.
*/
- mask = VEC_SPLAT_U8(-1);
+ mask = spu_splats((unsigned char)-1);
mask1 = spu_rlmaskqwbyte(mask, -doffset1);
mask2 = spu_slqwbyte(mask, 16-doffset2);
- mask3 = (vec_uchar16)spu_cmpgt(spu_splats(doffset1 + n), 15);
+ mask3 = (vec_uchar16)spu_cmpgt(spu_splats((unsigned int)(doffset1 + n)), 15);
*vDst++ = spu_sel(ddata, sdata, spu_and(mask1, spu_or(mask2, mask3)));
@@ -108,7 +108,7 @@ void * memcpy(void * __restrict__ dest, const void * __restrict__ src, size_t n)
/* Handle any trailing partial (destination) quadwords
*/
- mask = spu_and((vec_uchar16)spu_cmpgt(spu_splats(n), 16), mask2);
+ mask = spu_and((vec_uchar16)spu_cmpgt(spu_splats((unsigned int)n), 16), mask2);
*vDst = spu_sel(*vDst, spu_shuffle(sdata2, *vSrc, shuffle), mask);
return (dest);
diff --git a/newlib/libc/machine/spu/memmove.c b/newlib/libc/machine/spu/memmove.c
index d870a9d7f..f2fe4f983 100644
--- a/newlib/libc/machine/spu/memmove.c
+++ b/newlib/libc/machine/spu/memmove.c
@@ -48,7 +48,7 @@ void * memmove(void * __restrict__ dest, const void * __restrict__ src, size_t n
unsigned int soffset1, soffset2, doffset1, doffset2;
vec_uchar16 *vSrc, *vDst;
vec_uchar16 sdata1, sdata2, sdata, ddata, shuffle;
- vec_uchar16 mask, mask1, mask2, mask3;
+ vec_uchar16 mask, mask1, mask2, mask3, one = spu_splats((unsigned char)-1);
soffset1 = (unsigned int)(src) & 15;
doffset1 = (unsigned int)(dest) & 15;
@@ -62,10 +62,10 @@ void * memmove(void * __restrict__ dest, const void * __restrict__ src, size_t n
* mask2 = mask for trailing unchange bytes
* mask3 = mask indicating the more than one qword is being changed.
*/
- mask = VEC_SPLAT_U8(-1);
+ mask = one;
mask1 = spu_rlmaskqwbyte(mask, -doffset1);
mask2 = spu_slqwbyte(mask, 16-doffset2);
- mask3 = (vec_uchar16)spu_cmpgt(spu_splats(doffset1 + n), 15);
+ mask3 = (vec_uchar16)spu_cmpgt(spu_splats((unsigned int)(doffset1 + n)), 15);
vDst = (vec_uchar16 *)(dest);
@@ -120,10 +120,10 @@ void * memmove(void * __restrict__ dest, const void * __restrict__ src, size_t n
* mask2 = mask for trailing unchange bytes
* mask3 = mask indicating the more than one qword is being changed.
*/
- mask = VEC_SPLAT_U8(-1);
+ mask = one;
mask1 = spu_rlmaskqwbyte(mask, -doffset1);
mask2 = spu_slqwbyte(mask, 16-doffset2);
- mask3 = (vec_uchar16)spu_cmpgt(spu_splats(doffset1 + n), 15);
+ mask3 = (vec_uchar16)spu_cmpgt(spu_splats((unsigned int)(doffset1 + n)), 15);
*vDst++ = spu_sel(ddata, sdata, spu_and(mask1, spu_or(mask2, mask3)));
@@ -140,7 +140,7 @@ void * memmove(void * __restrict__ dest, const void * __restrict__ src, size_t n
/* Handle any trailing partial (destination) quadwords
*/
- mask = spu_and((vec_uchar16)spu_cmpgt(spu_splats(n), 16), mask2);
+ mask = spu_and((vec_uchar16)spu_cmpgt(spu_splats((unsigned int)n), 16), mask2);
*vDst = spu_sel(*vDst, spu_shuffle(sdata2, *vSrc, shuffle), mask);
} else {
@@ -188,7 +188,7 @@ void * memmove(void * __restrict__ dest, const void * __restrict__ src, size_t n
* mask2 = mask for trailing unchange bytes
* mask3 = mask indicating the more than one qword is being changed.
*/
- mask = VEC_SPLAT_U8(-1);
+ mask = one;
mask1 = spu_rlmaskqwbyte(mask, -doffset1);
mask2 = spu_slqwbyte(mask, 15-doffset2);
mask3 = (vec_uchar16)spu_cmpgt(spu_splats((int)(doffset2 - n)), -2);
diff --git a/newlib/libc/machine/spu/memset.c b/newlib/libc/machine/spu/memset.c
index 9ca2a6992..d142605c1 100644
--- a/newlib/libc/machine/spu/memset.c
+++ b/newlib/libc/machine/spu/memset.c
@@ -40,7 +40,7 @@ void * memset(void *s, int c, size_t n)
{
int skip, cnt, i;
vec_uchar16 *vs;
- vec_uchar16 vc, mask;
+ vec_uchar16 vc, mask, one = spu_splats((unsigned int)-1);
vs = (vec_uchar16 *)(s);
vc = spu_splats((unsigned char)c);
@@ -52,10 +52,10 @@ void * memset(void *s, int c, size_t n)
*/
skip = (int)(s) & 15;
if (skip) {
- mask = spu_rlmaskqwbyte((vec_uchar16)(-1), 0-skip);
+ mask = spu_rlmaskqwbyte(one, -skip);
cnt -= 16 - skip;
if (cnt < 0) {
- mask = spu_and(mask, spu_slqwbyte((vec_uchar16)(-1), (unsigned int)(-cnt)));
+ mask = spu_and(mask, spu_slqwbyte(one, (unsigned int)(-cnt)));
}
*vs = spu_sel(*vs, vc, mask);
vs++;
@@ -82,7 +82,7 @@ void * memset(void *s, int c, size_t n)
/* Handle any trailing partial quadwords
*/
if (cnt > 0) {
- mask = spu_slqwbyte((vec_uchar16)(-1), (unsigned int)(16-cnt));
+ mask = spu_slqwbyte(one, (unsigned int)(16-cnt));
*vs = spu_sel(*vs, vc, mask);
}
diff --git a/newlib/libc/machine/spu/strchr.c b/newlib/libc/machine/spu/strchr.c
index 2b1eeac80..bd0fec1db 100644
--- a/newlib/libc/machine/spu/strchr.c
+++ b/newlib/libc/machine/spu/strchr.c
@@ -44,14 +44,14 @@ char *strchr(const char *s, int c)
vec_uint4 cmp_c, cmp_0;
vec_uint4 result;
vec_uint4 mask;
-
+ vec_uint4 one = spu_splats((unsigned int)-1);
/* Scan memory array a quadword at a time. Skip leading
* mis-aligned bytes.
*/
ptr = (vec_uchar16 *)s;
skip = (unsigned int)(ptr) & 15;
- mask = spu_rlmask((vec_uint4)(0xFFFF), -skip);
+ mask = spu_rlmask(one, -skip);
vc = spu_splats((unsigned char)(c));
diff --git a/newlib/libc/machine/spu/strncat.c b/newlib/libc/machine/spu/strncat.c
index e1c3088a4..4348a06ee 100644
--- a/newlib/libc/machine/spu/strncat.c
+++ b/newlib/libc/machine/spu/strncat.c
@@ -42,8 +42,7 @@
char * strncat(char * __restrict__ dest, const char * __restrict__ src, size_t n)
{
- size_t len;
- unsigned int cmp, skip, mask;
+ unsigned int cmp, skip, mask, len;
vec_uchar16 *ptr, data;
vec_uint4 cnt, gt, N;
char *dst;
@@ -55,7 +54,7 @@ char * strncat(char * __restrict__ dest, const char * __restrict__ src, size_t n
/* Copy the src image until either the src string terminates
* or n characters are copied.
*/
- N = spu_promote(n, 0);
+ N = spu_promote((unsigned int)n, 0);
/* Determine the string length, not including termination character,
* clamped to n characters.
diff --git a/newlib/libc/machine/spu/strncmp.c b/newlib/libc/machine/spu/strncmp.c
index 0f5860903..68c863b37 100644
--- a/newlib/libc/machine/spu/strncmp.c
+++ b/newlib/libc/machine/spu/strncmp.c
@@ -50,7 +50,7 @@ int strncmp(const char *s1, const char *s2, size_t n)
vec_uchar16 data1A, data1B, data1, data2A, data2B, data2;
vec_uchar16 *ptr1, *ptr2;
- data1 = data2 = VEC_SPLAT_U8(0);
+ data1 = data2 = spu_splats(0);
ptr1 = (vec_uchar16 *)s1;
ptr2 = (vec_uchar16 *)s2;
diff --git a/newlib/libc/machine/spu/strncpy.c b/newlib/libc/machine/spu/strncpy.c
index f1c89f571..5e6169f32 100644
--- a/newlib/libc/machine/spu/strncpy.c
+++ b/newlib/libc/machine/spu/strncpy.c
@@ -40,12 +40,12 @@
*/
char * strncpy(char * __restrict__ dest, const char * __restrict__ src, size_t n)
{
- size_t len;
+ unsigned int len;
unsigned int cmp, skip, mask;
vec_uchar16 *ptr, data;
vec_uint4 cnt, gt, N;
- N = spu_promote(n, 0);
+ N = spu_promote((unsigned int)n, 0);
/* Determine the string length, including termination character,
* clamped to n characters.
@@ -74,7 +74,7 @@ char * strncpy(char * __restrict__ dest, const char * __restrict__ src, size_t n
/* len = MIN(len, n)
*/
- len = spu_extract(spu_sel(spu_promote(len, 0), N, gt), 0);
+ len = spu_extract(spu_sel(spu_promote((unsigned int)len, 0), N, gt), 0);
/* Perform a memcpy of the resulting length
*/
diff --git a/newlib/libc/machine/spu/strrchr.c b/newlib/libc/machine/spu/strrchr.c
index ec80841c2..c96d0f546 100644
--- a/newlib/libc/machine/spu/strrchr.c
+++ b/newlib/libc/machine/spu/strrchr.c
@@ -45,14 +45,14 @@ char * strrchr(const char *s, int c)
vec_uint4 cmp_c, cmp_0, cmp;
vec_uint4 res_ptr, res_cmp;
vec_uint4 mask, result;
-
+ vec_uint4 one = spu_splats((unsigned int)-1);
/* Scan memory array a quadword at a time. Skip leading
* mis-aligned bytes.
*/
ptr = (vec_uchar16 *)s;
nskip = -((unsigned int)(ptr) & 15);
- mask = spu_rlmask((vec_uint4)(0xFFFF), nskip);
+ mask = spu_rlmask(one, nskip);
vc = spu_splats((unsigned char)(c));
@@ -62,8 +62,8 @@ char * strrchr(const char *s, int c)
cmp_c = spu_and(spu_gather(spu_cmpeq(data, vc)), mask);
cmp_0 = spu_and(spu_gather(spu_cmpeq(data, 0)), mask);
- res_ptr = VEC_SPLAT_U32(0);
- res_cmp = VEC_SPLAT_U32(0);
+ res_ptr = spu_splats(0);
+ res_cmp = spu_splats(0);
while (spu_extract(cmp_0, 0) == 0) {
cmp = spu_cmpeq(cmp_c, 0);
@@ -84,7 +84,7 @@ char * strrchr(const char *s, int c)
*
* First mask off compare results following the first termination character.
*/
- mask = spu_sl(VEC_SPLAT_U32(-1), 31 - spu_extract(spu_cntlz(cmp_0), 0));
+ mask = spu_sl(one, 31 - spu_extract(spu_cntlz(cmp_0), 0));
cmp_c = spu_and(cmp_c, mask);
/* Conditionally update res_ptr and res_cmd if a match was found in the last
diff --git a/newlib/libc/machine/spu/strspn.c b/newlib/libc/machine/spu/strspn.c
index 657a3bebf..93cbd9d3c 100644
--- a/newlib/libc/machine/spu/strspn.c
+++ b/newlib/libc/machine/spu/strspn.c
@@ -63,7 +63,7 @@ size_t strspn(const char *s1, const char *s2)
do {
data1 = spu_shuffle(dataA, dataB, shuffle);
- match = VEC_SPLAT_U8(0);
+ match = spu_splats(0);
ptr2 = (vec_uchar16 *)s2;
data2 = *ptr2;