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}


Jakub Jelinek wrote:

>The problem is that s390 cmpstrsi insn
>clc   0(17,%r1),0(%r2)
>in the testcase below) does not behave like IA-32 rep; cmpsb.
>The former has memcmp behaviour, the latter strcmp behaviour.

I was not aware that cmpstr was supposed to ensure that behaviour; 
in fact even in the gcc 3.3 docs we read

"Block compare instruction, with five operands.  Operand 0 is the output;
it has mode M.  The remaining four operands are like the operands
of movstrM.  The two memory blocks specified are compared
byte by byte in lexicographic order.  The effect of the instruction is
to store a value in operand 0 whose sign indicates the result of the
comparison."

which does appear to imply memcpy semantics ...

I see now that in the gcc-head docs, the sentence "The instruction is not 
allowed to prefetch more than one byte at a time since either string may 
end in the first byte and reading past that may access an invalid page or 
segment and cause a fault." was added.  Does that mean that this is a
new requirement that was added on the head only?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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