From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6070 invoked by alias); 8 Apr 2003 01:16:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 6056 invoked by uid 71); 8 Apr 2003 01:16:00 -0000 Date: Tue, 08 Apr 2003 01:16:00 -0000 Message-ID: <20030408011600.6052.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Alan Modra Subject: Re: c/10339: [sparc] Invalid optimization: replacing strncmp by memcmp Reply-To: Alan Modra X-SW-Source: 2003-04/txt/msg00324.txt.bz2 List-Id: The following reply was made to PR optimization/10339; it has been noted by GNATS. From: Alan Modra To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, ubell@sleepycat.com, gcc-gnats@gcc.gnu.org Cc: Subject: Re: c/10339: [sparc] Invalid optimization: replacing strncmp by memcmp Date: Tue, 08 Apr 2003 10:43:36 +0930 On Mon, Apr 07, 2003 at 06:42:47PM -0000, bangerth@dealii.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