This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PTACH] strchr broken on SPU with non 16byte aligned argument


Kazunori Asayama wrote:
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...

Technically, shouldn't that unsigned int cast be a uintptr_t?

Any ideas whether other spu/str* code has similar pointer math which
might be suspect?

--joel
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));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]