This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/10339: [sparc] Invalid optimization: replacing strncmp by memcmp
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, ubell at sleepycat dot com, gcc-gnats at gcc dot gnu dot org
- Date: Tue, 8 Apr 2003 10:43:36 +0930
- Subject: Re: c/10339: [sparc] Invalid optimization: replacing strncmp by memcmp
- References: <20030407184247.12988.qmail@sources.redhat.com>
On Mon, Apr 07, 2003 at 06:42:47PM -0000, bangerth at dealii dot org wrote:
> Old Synopsis: strncmp generates imPure code
> New Synopsis: [sparc] Invalid optimization: replacing strncmp by memcmp
Also happens on powerpc-linux and powerpc64-linux. Incidentally,
I think Andreas' suggestion that memcmp is allowed to compare from
the upper end of the arrays is not very likely to happen given
memcmp's return value. A more reasonable objection to the
strncmp -> memcmp transformation is that a memcmp implementation
might load multiple words into registers (say a cache-line worth),
before comparing.
--
Alan Modra
IBM OzLabs - Linux Technology Centre