Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@redhat.com>2002-05-08 05:23:44 +0400
committerThomas Fitzsimmons <fitzsim@redhat.com>2002-05-08 05:23:44 +0400
commit60b2107cfda24875c6feb8dadfaec1a7e4bfb645 (patch)
tree47c762c2ad19b7e464571f81ec9269f0240f8ee2 /newlib
parente71372faea4af670215b087a69c2b7432181a852 (diff)
* libc/machine/powerpc/vfprintf.c[__ALTIVEC__]: Add vector
support for 'p' format. Fix code to print bytes for vector integer formats that do not specify 'h' or 'l'. * libc/machine/powerpc/vfscanf.c[__ALTIVEC__]: Add vector support for 'p' specifier. Fix code to scan 16 bytes for vector integer formats that do not specify 'h' or 'l'.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog11
-rw-r--r--newlib/libc/machine/powerpc/vfprintf.c38
-rw-r--r--newlib/libc/machine/powerpc/vfscanf.c25
3 files changed, 50 insertions, 24 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 2158397c8..28244340c 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -28,8 +28,15 @@
2002-05-06 Jeff Johnston <jjohnstn@redhat.com>
- * libc/include/stdlib.h (a64l, l64a, _l64a_r): Added prototypes.
-
+ * libc/machine/powerpc/vfprintf.c[__ALTIVEC__]: Add vector
+ support for 'p' format. Fix code to print bytes for vector
+ integer formats that do not specify 'h' or 'l'.
+ * libc/machine/powerpc/vfscanf.c[__ALTIVEC__]: Add vector support
+ for 'p' specifier. Fix code to scan 16 bytes for vector integer
+ formats that do not specify 'h' or 'l'.
+
+ * libc/include/stdlib.h (a64l, l64a, _l64a_r): Added prototypes.
+
2002-05-06 Nick Clifton <nickc@cambridge.redhat.com>
* libc/sys/arm/syscalls.c (_rename): Add parameter names.
diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c
index cf054293b..aed3d704f 100644
--- a/newlib/libc/machine/powerpc/vfprintf.c
+++ b/newlib/libc/machine/powerpc/vfprintf.c
@@ -196,7 +196,7 @@ typedef union
int i[16 / sizeof(int)];
long l[4];
short s[8];
- char c[16];
+ signed char c[16];
} vec_16_byte_union;
#endif /* __ALTIVEC__ */
@@ -448,15 +448,15 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
#define GET_INT(ap) \
(flags&VECTOR ? \
- (vec_print_count < (16 / sizeof(int)) ? \
- vec_tmp.i[16 / sizeof(int) - vec_print_count] : \
- (vec_tmp.v = va_arg(ap, vector int), vec_tmp.i[0])) : \
+ (vec_print_count < 16 ? \
+ vec_tmp.c[16 - vec_print_count] : \
+ (vec_tmp.v = va_arg(ap, vector int), (int)vec_tmp.c[0])) : \
va_arg(ap, int))
#define GET_UINT(ap) \
(flags&VECTOR ? \
- (vec_print_count < (16 / sizeof(int)) ? \
- (u_int)vec_tmp.i[16 / sizeof(int) - vec_print_count] : \
- (vec_tmp.v = va_arg(ap, vector int), (u_int)vec_tmp.i[0])) : \
+ (vec_print_count < 16 ? \
+ (u_int)((unsigned char)vec_tmp.c[16 - vec_print_count]) : \
+ (vec_tmp.v = va_arg(ap, vector int), (u_int)((unsigned char)vec_tmp.c[0]))) : \
(u_int)va_arg(ap, unsigned int))
#else /* !__ALTIVEC__ */
#define GET_SHORT(ap) ((short)va_arg(ap, int))
@@ -634,7 +634,7 @@ reswitch: switch (ch) {
case 'v':
flags |= VECTOR;
vec_print_count = (flags & SHORTINT) ? 8 :
- ((flags & LONGINT) ? 4 : (16 / sizeof(int)));
+ ((flags & LONGINT) ? 4 : 16);
goto rflag;
#endif
case 'q':
@@ -704,8 +704,11 @@ reswitch: switch (ch) {
_fpvalue = (double) va_arg(ap, _LONG_DOUBLE);
#ifdef __ALTIVEC__
} else if (flags & VECTOR) {
- if (vec_print_count == 4)
- vec_tmp.v = va_arg(ap, vector int);
+ if (vec_print_count >= 4)
+ {
+ vec_print_count = 4;
+ vec_tmp.v = va_arg(ap, vector int);
+ }
_fpvalue = (double)vec_tmp.f[4 - vec_print_count];
#endif /* __ALTIVEC__ */
} else {
@@ -736,8 +739,11 @@ reswitch: switch (ch) {
_fpvalue = va_arg(ap, _LONG_DOUBLE);
#ifdef __ALTIVEC__
} else if (flags & VECTOR) {
- if (vec_print_count == 4)
- vec_tmp.v = va_arg(ap, vector int);
+ if (vec_print_count >= 4)
+ {
+ vec_print_count = 4;
+ vec_tmp.v = va_arg(ap, vector int);
+ }
_fpvalue = (_LONG_DOUBLE)k.f[4 - vec_print_count];
#endif /* __ALTIVEC__ */
} else {
@@ -832,8 +838,12 @@ reswitch: switch (ch) {
* -- ANSI X3J11
*/
/* NOSTRICT */
- flags &= ~VECTOR;
- _uquad = (u_long)(unsigned _POINTER_INT)va_arg(ap, void *);
+#ifdef __ALTIVEC__
+ if (flags & VECTOR)
+ _uquad = UARG();
+ else
+#endif /* __ALTIVEC__ */
+ _uquad = (u_long)(unsigned _POINTER_INT)va_arg(ap, void *);
base = HEX;
xdigs = "0123456789abcdef";
flags |= HEXPREFIX;
diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c
index b2ea57274..c0bd0e526 100644
--- a/newlib/libc/machine/powerpc/vfscanf.c
+++ b/newlib/libc/machine/powerpc/vfscanf.c
@@ -370,7 +370,11 @@ __svfscanf_r (rptr, fp, fmt0, ap)
flags |= LONGDBL;
}
else
- flags |= LONG;
+ {
+ flags |= LONG;
+ if (flags & VECTOR)
+ vec_read_count = 4;
+ }
goto again;
case 'L':
flags |= LONGDBL;
@@ -384,7 +388,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
#ifdef __ALTIVEC__
case 'v':
flags |= VECTOR;
- vec_read_count = (flags & SHORT) ? 8 : 4;
+ vec_read_count = (flags & SHORT) ? 8 : ((flags & LONG) ? 4 : 16);
goto again;
#endif
case '0':
@@ -485,7 +489,6 @@ __svfscanf_r (rptr, fp, fmt0, ap)
case 'p': /* pointer format is like hex */
flags |= POINTER | PFXOK;
- flags &= ~VECTOR;
type = CT_INT;
ccfn = _strtoul_r;
base = 16;
@@ -918,7 +921,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
*p = 0;
res = (*ccfn) (rptr, buf, (char **) NULL, base);
- if (flags & POINTER)
+ if ((flags & POINTER) && !(flags & VECTOR))
*(va_arg (ap, _PTR *)) = (_PTR) (unsigned _POINTER_INT) res;
else if (flags & SHORT)
{
@@ -951,10 +954,16 @@ __svfscanf_r (rptr, fp, fmt0, ap)
else
{
if (!(flags & VECTOR))
- ip = va_arg (ap, int *);
- else if (!looped)
- ip = vec_buf.i;
- *ip++ = res;
+ {
+ ip = va_arg (ap, int *);
+ *ip++ = res;
+ }
+ else
+ {
+ if (!looped)
+ ch_dest = vec_buf.c;
+ *ch_dest++ = (char)res;
+ }
}
if (!(flags & VECTOR))
nassigned++;