This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PTACH] strchr broken on SPU with non 16byte aligned argument
Andrew_Pinski@playstation.sony.com wrote:
> I noticed that the GCC testcase gcc.c-torture/execute/string-opt-5.c
> is failing on the spu and was debugging it and it looks like strchr does
> not handle correctly a non 16byte aligned agrument.
> Here is the reduced testcase which is failing:
Here is a patch to fix the problem.
But I'm worried that there may be similar problem to it...
Thanks,
--
(ASAYAMA Kazunori
(asayama@sm.sony.co.jp))
t
Index: newlib/newlib/libc/machine/spu/strchr.c
===================================================================
--- newlib.orig/newlib/libc/machine/spu/strchr.c
+++ newlib/newlib/libc/machine/spu/strchr.c
@@ -51,7 +51,7 @@ char *strchr(const char *s, int c)
ptr = (vec_uchar16 *)s;
skip = (unsigned int)(ptr) & 15;
- mask = spu_rlmask(one, -skip);
+ mask = spu_rlmask(one, -(skip + 16));
vc = spu_splats((unsigned char)(c));