This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: builtin_str{,n}cmp bug on s390{,x}


On Fri, Jul 11, 2003 at 06:11:49PM +0200, Ulrich Weigand wrote:
> Jakub Jelinek wrote:
> 
> > And s390* could also provide cmpstrsi pattern, which would check if length
> > is ~(size_t)0, bail otherwise.
> > ATM expand_builtin_strcmp only uses cmpstrM patterns if one argument
> > is a string literal, but I don't see why it couldn't use it even if
> > there is no string literal and the length is unknown (ie. worst ~(size_t)0).
> 
> Does that mean that cmpstr now really assumes C-string syntax?
> I.e. "ab\0cd" and "ab\0ef" compared with length 5 (or ~0) compare equal?
> This is different from what even the updated doc text says ...

No, cmpstrM has the syntax described in md.texi (ie. does not stop
at 0 byte, but stops on first difference and is not allowed to prefetch).
If it was not true, IA-32 would have to provide cmpmemM as well as
cmpstrM, because builtin_memcmp could not be implemented using
cmpstrM.
But given that only s390*, i370, i386 and c4x define cmp{mem,str}M patterns,
it shouldn't be hard to redefine cmpstrM when we decide so.

	Jakub


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