* 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'.
This commit is contained in:
parent
e71372faea
commit
60b2107cfd
@ -28,7 +28,14 @@
|
|||||||
|
|
||||||
2002-05-06 Jeff Johnston <jjohnstn@redhat.com>
|
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>
|
2002-05-06 Nick Clifton <nickc@cambridge.redhat.com>
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ typedef union
|
|||||||
int i[16 / sizeof(int)];
|
int i[16 / sizeof(int)];
|
||||||
long l[4];
|
long l[4];
|
||||||
short s[8];
|
short s[8];
|
||||||
char c[16];
|
signed char c[16];
|
||||||
} vec_16_byte_union;
|
} vec_16_byte_union;
|
||||||
#endif /* __ALTIVEC__ */
|
#endif /* __ALTIVEC__ */
|
||||||
|
|
||||||
@ -448,15 +448,15 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
|
|||||||
|
|
||||||
#define GET_INT(ap) \
|
#define GET_INT(ap) \
|
||||||
(flags&VECTOR ? \
|
(flags&VECTOR ? \
|
||||||
(vec_print_count < (16 / sizeof(int)) ? \
|
(vec_print_count < 16 ? \
|
||||||
vec_tmp.i[16 / sizeof(int) - vec_print_count] : \
|
vec_tmp.c[16 - vec_print_count] : \
|
||||||
(vec_tmp.v = va_arg(ap, vector int), vec_tmp.i[0])) : \
|
(vec_tmp.v = va_arg(ap, vector int), (int)vec_tmp.c[0])) : \
|
||||||
va_arg(ap, int))
|
va_arg(ap, int))
|
||||||
#define GET_UINT(ap) \
|
#define GET_UINT(ap) \
|
||||||
(flags&VECTOR ? \
|
(flags&VECTOR ? \
|
||||||
(vec_print_count < (16 / sizeof(int)) ? \
|
(vec_print_count < 16 ? \
|
||||||
(u_int)vec_tmp.i[16 / sizeof(int) - vec_print_count] : \
|
(u_int)((unsigned char)vec_tmp.c[16 - vec_print_count]) : \
|
||||||
(vec_tmp.v = va_arg(ap, vector int), (u_int)vec_tmp.i[0])) : \
|
(vec_tmp.v = va_arg(ap, vector int), (u_int)((unsigned char)vec_tmp.c[0]))) : \
|
||||||
(u_int)va_arg(ap, unsigned int))
|
(u_int)va_arg(ap, unsigned int))
|
||||||
#else /* !__ALTIVEC__ */
|
#else /* !__ALTIVEC__ */
|
||||||
#define GET_SHORT(ap) ((short)va_arg(ap, int))
|
#define GET_SHORT(ap) ((short)va_arg(ap, int))
|
||||||
@ -634,7 +634,7 @@ reswitch: switch (ch) {
|
|||||||
case 'v':
|
case 'v':
|
||||||
flags |= VECTOR;
|
flags |= VECTOR;
|
||||||
vec_print_count = (flags & SHORTINT) ? 8 :
|
vec_print_count = (flags & SHORTINT) ? 8 :
|
||||||
((flags & LONGINT) ? 4 : (16 / sizeof(int)));
|
((flags & LONGINT) ? 4 : 16);
|
||||||
goto rflag;
|
goto rflag;
|
||||||
#endif
|
#endif
|
||||||
case 'q':
|
case 'q':
|
||||||
@ -704,8 +704,11 @@ reswitch: switch (ch) {
|
|||||||
_fpvalue = (double) va_arg(ap, _LONG_DOUBLE);
|
_fpvalue = (double) va_arg(ap, _LONG_DOUBLE);
|
||||||
#ifdef __ALTIVEC__
|
#ifdef __ALTIVEC__
|
||||||
} else if (flags & VECTOR) {
|
} else if (flags & VECTOR) {
|
||||||
if (vec_print_count == 4)
|
if (vec_print_count >= 4)
|
||||||
vec_tmp.v = va_arg(ap, vector int);
|
{
|
||||||
|
vec_print_count = 4;
|
||||||
|
vec_tmp.v = va_arg(ap, vector int);
|
||||||
|
}
|
||||||
_fpvalue = (double)vec_tmp.f[4 - vec_print_count];
|
_fpvalue = (double)vec_tmp.f[4 - vec_print_count];
|
||||||
#endif /* __ALTIVEC__ */
|
#endif /* __ALTIVEC__ */
|
||||||
} else {
|
} else {
|
||||||
@ -736,8 +739,11 @@ reswitch: switch (ch) {
|
|||||||
_fpvalue = va_arg(ap, _LONG_DOUBLE);
|
_fpvalue = va_arg(ap, _LONG_DOUBLE);
|
||||||
#ifdef __ALTIVEC__
|
#ifdef __ALTIVEC__
|
||||||
} else if (flags & VECTOR) {
|
} else if (flags & VECTOR) {
|
||||||
if (vec_print_count == 4)
|
if (vec_print_count >= 4)
|
||||||
vec_tmp.v = va_arg(ap, vector int);
|
{
|
||||||
|
vec_print_count = 4;
|
||||||
|
vec_tmp.v = va_arg(ap, vector int);
|
||||||
|
}
|
||||||
_fpvalue = (_LONG_DOUBLE)k.f[4 - vec_print_count];
|
_fpvalue = (_LONG_DOUBLE)k.f[4 - vec_print_count];
|
||||||
#endif /* __ALTIVEC__ */
|
#endif /* __ALTIVEC__ */
|
||||||
} else {
|
} else {
|
||||||
@ -832,8 +838,12 @@ reswitch: switch (ch) {
|
|||||||
* -- ANSI X3J11
|
* -- ANSI X3J11
|
||||||
*/
|
*/
|
||||||
/* NOSTRICT */
|
/* NOSTRICT */
|
||||||
flags &= ~VECTOR;
|
#ifdef __ALTIVEC__
|
||||||
_uquad = (u_long)(unsigned _POINTER_INT)va_arg(ap, void *);
|
if (flags & VECTOR)
|
||||||
|
_uquad = UARG();
|
||||||
|
else
|
||||||
|
#endif /* __ALTIVEC__ */
|
||||||
|
_uquad = (u_long)(unsigned _POINTER_INT)va_arg(ap, void *);
|
||||||
base = HEX;
|
base = HEX;
|
||||||
xdigs = "0123456789abcdef";
|
xdigs = "0123456789abcdef";
|
||||||
flags |= HEXPREFIX;
|
flags |= HEXPREFIX;
|
||||||
|
@ -370,7 +370,11 @@ __svfscanf_r (rptr, fp, fmt0, ap)
|
|||||||
flags |= LONGDBL;
|
flags |= LONGDBL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
flags |= LONG;
|
{
|
||||||
|
flags |= LONG;
|
||||||
|
if (flags & VECTOR)
|
||||||
|
vec_read_count = 4;
|
||||||
|
}
|
||||||
goto again;
|
goto again;
|
||||||
case 'L':
|
case 'L':
|
||||||
flags |= LONGDBL;
|
flags |= LONGDBL;
|
||||||
@ -384,7 +388,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
|
|||||||
#ifdef __ALTIVEC__
|
#ifdef __ALTIVEC__
|
||||||
case 'v':
|
case 'v':
|
||||||
flags |= VECTOR;
|
flags |= VECTOR;
|
||||||
vec_read_count = (flags & SHORT) ? 8 : 4;
|
vec_read_count = (flags & SHORT) ? 8 : ((flags & LONG) ? 4 : 16);
|
||||||
goto again;
|
goto again;
|
||||||
#endif
|
#endif
|
||||||
case '0':
|
case '0':
|
||||||
@ -485,7 +489,6 @@ __svfscanf_r (rptr, fp, fmt0, ap)
|
|||||||
|
|
||||||
case 'p': /* pointer format is like hex */
|
case 'p': /* pointer format is like hex */
|
||||||
flags |= POINTER | PFXOK;
|
flags |= POINTER | PFXOK;
|
||||||
flags &= ~VECTOR;
|
|
||||||
type = CT_INT;
|
type = CT_INT;
|
||||||
ccfn = _strtoul_r;
|
ccfn = _strtoul_r;
|
||||||
base = 16;
|
base = 16;
|
||||||
@ -918,7 +921,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
|
|||||||
|
|
||||||
*p = 0;
|
*p = 0;
|
||||||
res = (*ccfn) (rptr, buf, (char **) NULL, base);
|
res = (*ccfn) (rptr, buf, (char **) NULL, base);
|
||||||
if (flags & POINTER)
|
if ((flags & POINTER) && !(flags & VECTOR))
|
||||||
*(va_arg (ap, _PTR *)) = (_PTR) (unsigned _POINTER_INT) res;
|
*(va_arg (ap, _PTR *)) = (_PTR) (unsigned _POINTER_INT) res;
|
||||||
else if (flags & SHORT)
|
else if (flags & SHORT)
|
||||||
{
|
{
|
||||||
@ -951,10 +954,16 @@ __svfscanf_r (rptr, fp, fmt0, ap)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(flags & VECTOR))
|
if (!(flags & VECTOR))
|
||||||
ip = va_arg (ap, int *);
|
{
|
||||||
else if (!looped)
|
ip = va_arg (ap, int *);
|
||||||
ip = vec_buf.i;
|
*ip++ = res;
|
||||||
*ip++ = res;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!looped)
|
||||||
|
ch_dest = vec_buf.c;
|
||||||
|
*ch_dest++ = (char)res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!(flags & VECTOR))
|
if (!(flags & VECTOR))
|
||||||
nassigned++;
|
nassigned++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user