[Cbe-oss-dev] mars and fsf-gcc
Andrew Pinski
pinskia at gmail.com
Sun Jun 7 22:38:08 EST 2009
On Sun, Jun 7, 2009 at 1:42 AM, Jonathan
Adamczewski<jadamcze at utas.edu.au> wrote:
> Attempting to compile mars-1.1.3 with spu-gcc-4.4.0 (as packaged for
> debian sid), on the following code from base/src/mpu/kernel/kernel.c
>
> static int kernel_memcmp(const void *s1, const void *s2, int size)
> {
> __vector const int *vptr_1 = (__vector const int *)s1;
> __vector const int *vptr_2 = (__vector const int *)s2;
> __vector const int *vptr_e = (__vector const int *)(s1 + size);
>
> while (vptr_1 < vptr_e)
> if (!(*vptr_1++ == *vptr_2++))
> return 1;
>
> return 0;
> }
>
>
> I see this error :
>
> kernel.c: In function 'kernel_memcmp':
> kernel.c:101: error: invalid operands to binary == (have 'const int
> __vector__' and 'const int __vector__')
>
>
> It appears that == is not supported for vectors in this version of
> gcc, or I'm missing something obvious.
>
well, I just submitted a patch to the FSF GCC to support this :).
See http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01912.html .
Basically spu_equal followed by spu_collect (I think that is the
intrinsics is called) will work. But there are more issues with
kernel_memcmp than just that, it looks like it does not handle the
case where size is not a multiple of 16 and where s1 and s2 are not
aligned to the 16 byte boundary either.
-- Pinski
More information about the cbe-oss-dev
mailing list