md.texi (cmpstr): Document additional restrictions.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Sat, 26 Apr 2003 20:44:30 +0000 (20:44 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Sat, 26 Apr 2003 20:44:30 +0000 (20:44 +0000)
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

gcc/ChangeLog
gcc/doc/md.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/string-opt-8.c

index f96ea7014405464e3f35192b264cfae0e8de63e8..0f83a2bdd4e14881fa18677f25d9d9610057b4ab 100644 (file)
@@ -1,3 +1,7 @@
+2003-04-26  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * doc/md.texi (cmpstr): Document additional restrictions.
+
 2003-04-26  Neil Booth  <neil@daikokuya.co.uk>
 
        * flags.h (time_report): Remove.
index da7e38b0eab0c2ef0962b030af0b427b1e41e710..c808d494e9aba68722e6baad1b1b31a1c0054788 100644 (file)
@@ -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}}
index 2590adf336a4bbc703ee24982cf4cf538bcf421e..9c0ef12870c281000f40bf7dc02f919bb2d59887 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-26  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * 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  <mark@codesourcery.com>
 
        * g++.old-deja/g++.pt/instantiate12.C: Explicit instantiate
index 8fef5b53734e0de492f867b9b57b125ac0dea2e6..5ab3a99c5e0041692af099cdf08cb702f40b985e 100644 (file)
@@ -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();