[PATCH 2/2] newlib: Eliminate unrecommended use of vector keyword on SPU
Jeff Johnston
jjohnstn@redhat.com
Thu Jan 25 17:39:00 GMT 2007
Patch checked in.
-- Jeff J.
Kazunori Asayama wrote:
> Attached is a patch to eliminate 'vector' keywords in newlib.
>
> 2007-01-19 Kazunori Asayama <asayama@sm.sony.co.jp>
>
> * libc/machine/spu/c99ppe.h: Replace vector with __vector.
> * libc/machine/spu/vec_literal.h: Ditto.
> * libc/machine/spu/strncmp.c: Ditto.
>
> ----
> Index: newlib/newlib/libc/machine/spu/c99ppe.h
> ===================================================================
> --- newlib.orig/newlib/libc/machine/spu/c99ppe.h
> +++ newlib/newlib/libc/machine/spu/c99ppe.h
> @@ -31,7 +31,6 @@ Author: Joel Schopp <jschopp@austin.ibm.
> */
>
> #include <errno.h>
> -#include <spu_intrinsics.h>
>
> #define SPE_C99_SIGNALCODE 0x2100
>
> @@ -102,7 +101,7 @@ send_to_ppe(int signalcode, int opcode,
> unsigned int combined = ( ( opcode<<24 )&0xff000000 ) | ( ( unsigned int )data & 0x00ffffff );
> struct spe_reg128* ret = data;
>
> - vector unsigned int stopfunc = {
> + __vector unsigned int stopfunc = {
> signalcode, /* stop 0x210x*/
> (unsigned int) combined,
> 0x4020007f, /* nop */
> Index: newlib/newlib/libc/machine/spu/vec_literal.h
> ===================================================================
> --- newlib.orig/newlib/libc/machine/spu/vec_literal.h
> +++ newlib/newlib/libc/machine/spu/vec_literal.h
> @@ -49,27 +49,22 @@
> * construction when all the elements of the vector contain the same value.
> */
>
> -#ifdef __SPU__
> -#include <spu_intrinsics.h>
> -#endif
> -
> -
> /* Use curly brace style.
> */
> #define VEC_LITERAL(_type, ...) ((_type){__VA_ARGS__})
>
> -#define VEC_SPLAT_U8(_val) ((vector unsigned char){_val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val})
> -#define VEC_SPLAT_S8(_val) ((vector signed char){_val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val})
> +#define VEC_SPLAT_U8(_val) ((__vector unsigned char){_val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val})
> +#define VEC_SPLAT_S8(_val) ((__vector signed char){_val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val})
>
> -#define VEC_SPLAT_U16(_val) ((vector unsigned short){_val, _val, _val, _val, _val, _val, _val, _val})
> -#define VEC_SPLAT_S16(_val) ((vector signed short){_val, _val, _val, _val, _val, _val, _val, _val})
> +#define VEC_SPLAT_U16(_val) ((__vector unsigned short){_val, _val, _val, _val, _val, _val, _val, _val})
> +#define VEC_SPLAT_S16(_val) ((__vector signed short){_val, _val, _val, _val, _val, _val, _val, _val})
>
> -#define VEC_SPLAT_U32(_val) ((vector unsigned int){_val, _val, _val, _val})
> -#define VEC_SPLAT_S32(_val) ((vector signed int){_val, _val, _val, _val})
> -#define VEC_SPLAT_F32(_val) ((vector float){_val, _val, _val, _val})
> -
> -#define VEC_SPLAT_U64(_val) ((vector unsigned long long){_val, _val})
> -#define VEC_SPLAT_S64(_val) ((vector signed long long){_val, _val})
> -#define VEC_SPLAT_F64(_val) ((vector double){_val, _val})
> +#define VEC_SPLAT_U32(_val) ((__vector unsigned int){_val, _val, _val, _val})
> +#define VEC_SPLAT_S32(_val) ((__vector signed int){_val, _val, _val, _val})
> +#define VEC_SPLAT_F32(_val) ((__vector float){_val, _val, _val, _val})
> +
> +#define VEC_SPLAT_U64(_val) ((__vector unsigned long long){_val, _val})
> +#define VEC_SPLAT_S64(_val) ((__vector signed long long){_val, _val})
> +#define VEC_SPLAT_F64(_val) ((__vector double){_val, _val})
>
> #endif /* _VEC_LITERAL_H_ */
> Index: newlib/newlib/libc/machine/spu/strncmp.c
> ===================================================================
> --- newlib.orig/newlib/libc/machine/spu/strncmp.c
> +++ newlib/newlib/libc/machine/spu/strncmp.c
> @@ -106,7 +106,7 @@ int strncmp(const char *s1, const char *
>
> mask_v = spu_splats((unsigned int)0xFFFF);
>
> - shift_n_v = spu_andc((vector unsigned int)spu_sub(0, n_v), spu_cmpgt(n_v, -1));
> + shift_n_v = spu_andc((__vector unsigned int)spu_sub(0, n_v), spu_cmpgt(n_v, -1));
> shift_eos_v = spu_sub(32, max_cnt_v);
>
> max_shift_v = spu_sel(shift_n_v, shift_eos_v, spu_cmpgt(shift_eos_v, shift_n_v));
More information about the Newlib
mailing list