From: Kaveh R. Ghazi Date: Sat, 26 Apr 2003 20:44:30 +0000 (+0000) Subject: md.texi (cmpstr): Document additional restrictions. X-Git-Tag: releases/gcc-3.4.0~7016 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5cc2f4f36ffd5f3d47346f330b15337afdbe4927;p=thirdparty%2Fgcc.git md.texi (cmpstr): Document additional restrictions. gcc: * doc/md.texi (cmpstr): Document additional restrictions. testsuite: * gcc.c-torture/execute/string-opt-8.c: Don't perform cmpstr checks for __pj__, but do them for !__OPTIMIZE__ and __s390__. From-SVN: r66116 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f96ea7014405..0f83a2bdd4e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2003-04-26 Kaveh R. Ghazi + + * doc/md.texi (cmpstr): Document additional restrictions. + 2003-04-26 Neil Booth * flags.h (time_report): Remove. diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index da7e38b0eab0..c808d494e9ab 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -2788,9 +2788,12 @@ The use for multiple @code{clrstr@var{m}} is as for @code{movstr@var{m}}. Block compare instruction, with five operands. Operand 0 is the output; it has mode @var{m}. The remaining four operands are like the operands of @samp{movstr@var{m}}. 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. +byte by byte in lexicographic order starting at the beginning of each +string. 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. The +effect of the instruction is to store a value in operand 0 whose sign +indicates the result of the comparison. @cindex @code{strlen@var{m}} instruction pattern @item @samp{strlen@var{m}} diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2590adf336a4..9c0ef12870c2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-04-26 Kaveh R. Ghazi + + * gcc.c-torture/execute/string-opt-8.c: Don't perform cmpstr + checks for __pj__, but do them for !__OPTIMIZE__ and __s390__. + 2003-04-25 Mark Mitchell * g++.old-deja/g++.pt/instantiate12.C: Explicit instantiate diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-8.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-8.c index 8fef5b53734e..5ab3a99c5e00 100644 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-8.c +++ b/gcc/testsuite/gcc.c-torture/execute/string-opt-8.c @@ -65,8 +65,9 @@ int main () s2 = s1; s3 = s1+4; if (strncmp (++s2, ++s3+2, 1) >= 0 || s2 != s1+1 || s3 != s1+5) abort(); -#if defined(__i386__) || defined (__pj__) || defined (__i370__) - /* These tests work on platforms which support cmpstrsi. */ +#if !defined(__OPTIMIZE__) || defined(__i386__) || defined (__i370__) || defined (__s390__) + /* These tests work on platforms which support cmpstrsi. We test it + at -O0 on all platforms to ensure the strncmp logic is correct. */ s2 = s1; if (strncmp (++s2, "ello", 3) != 0 || s2 != s1+1) abort();