This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] make spu-elf target build with gcc-fsf


Issues addressed:

- size_t has no implicit cast to an allowed tipe for spu

- apple-cast is forbidden

- vector is defined in spu_intrinsics.h

lu

-- 

Luca Barbato

Gentoo/linux Gentoo/PPC
http://dev.gentoo.org/~lu_zero

Index: libgloss/spu/syscalls.c
===================================================================
RCS file: /cvs/src/src/libgloss/spu/syscalls.c,v
retrieving revision 1.4
diff -u -r1.4 syscalls.c
--- libgloss/spu/syscalls.c	30 Aug 2006 19:06:48 -0000	1.4
+++ libgloss/spu/syscalls.c	21 Nov 2006 11:13:35 -0000
@@ -29,7 +29,7 @@
 
 Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
 */
-
+#include <spu_intrinsics.h>
 #include "jsre.h"
 
 void
Index: newlib/libc/machine/spu/memcpy.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/spu/memcpy.c,v
retrieving revision 1.3
diff -u -r1.3 memcpy.c
--- newlib/libc/machine/spu/memcpy.c	27 Oct 2006 23:02:00 -0000	1.3
+++ newlib/libc/machine/spu/memcpy.c	21 Nov 2006 11:13:37 -0000
@@ -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.
  */
@@ -91,7 +91,7 @@
   mask  = VEC_SPLAT_U8(-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 @@
 
   /* 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);
Index: newlib/libc/machine/spu/memmove.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/spu/memmove.c,v
retrieving revision 1.1
diff -u -r1.1 memmove.c
--- newlib/libc/machine/spu/memmove.c	27 Oct 2006 23:02:00 -0000	1.1
+++ newlib/libc/machine/spu/memmove.c	21 Nov 2006 11:13:38 -0000
@@ -65,7 +65,7 @@
   mask  = VEC_SPLAT_U8(-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 = (vec_uchar16 *)(dest);
 
@@ -123,7 +123,7 @@
     mask  = VEC_SPLAT_U8(-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)));
 
@@ -140,7 +140,7 @@
 
     /* 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 {
Index: newlib/libc/machine/spu/memset.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/spu/memset.c,v
retrieving revision 1.1
diff -u -r1.1 memset.c
--- newlib/libc/machine/spu/memset.c	27 Oct 2006 23:02:00 -0000	1.1
+++ newlib/libc/machine/spu/memset.c	21 Nov 2006 11:13:38 -0000
@@ -40,7 +40,7 @@
 {
   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 @@
    */
   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 @@
   /* 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);
   }
 
Index: newlib/libc/machine/spu/strchr.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/spu/strchr.c,v
retrieving revision 1.1
diff -u -r1.1 strchr.c
--- newlib/libc/machine/spu/strchr.c	27 Oct 2006 23:02:00 -0000	1.1
+++ newlib/libc/machine/spu/strchr.c	21 Nov 2006 11:13:38 -0000
@@ -44,14 +44,14 @@
   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));
 
Index: newlib/libc/machine/spu/strncat.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/spu/strncat.c,v
retrieving revision 1.1
diff -u -r1.1 strncat.c
--- newlib/libc/machine/spu/strncat.c	27 Oct 2006 23:02:00 -0000	1.1
+++ newlib/libc/machine/spu/strncat.c	21 Nov 2006 11:13:38 -0000
@@ -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 @@
   /* 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.
Index: newlib/libc/machine/spu/strncmp.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/spu/strncmp.c,v
retrieving revision 1.1
diff -u -r1.1 strncmp.c
--- newlib/libc/machine/spu/strncmp.c	27 Oct 2006 23:02:00 -0000	1.1
+++ newlib/libc/machine/spu/strncmp.c	21 Nov 2006 11:13:39 -0000
@@ -50,7 +50,7 @@
   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;
Index: newlib/libc/machine/spu/strncpy.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/spu/strncpy.c,v
retrieving revision 1.1
diff -u -r1.1 strncpy.c
--- newlib/libc/machine/spu/strncpy.c	27 Oct 2006 23:02:00 -0000	1.1
+++ newlib/libc/machine/spu/strncpy.c	21 Nov 2006 11:13:39 -0000
@@ -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 @@
 
   /* 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
    */
Index: newlib/libc/machine/spu/strrchr.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/spu/strrchr.c,v
retrieving revision 1.1
diff -u -r1.1 strrchr.c
--- newlib/libc/machine/spu/strrchr.c	27 Oct 2006 23:02:00 -0000	1.1
+++ newlib/libc/machine/spu/strrchr.c	21 Nov 2006 11:13:39 -0000
@@ -45,14 +45,14 @@
   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));
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]