From patchwork Tue Jun 23 14:53:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Randolph Chung X-Patchwork-Id: 31986 X-Patchwork-Delegate: kyle@mcmartin.ca Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5NF2tIo003132 for ; Tue, 23 Jun 2009 15:02:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757364AbZFWPBk (ORCPT ); Tue, 23 Jun 2009 11:01:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757643AbZFWPBk (ORCPT ); Tue, 23 Jun 2009 11:01:40 -0400 Received: from wf-out-1314.google.com ([209.85.200.169]:32166 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757364AbZFWPBj convert rfc822-to-8bit (ORCPT ); Tue, 23 Jun 2009 11:01:39 -0400 Received: by wf-out-1314.google.com with SMTP id 26so35477wfd.4 for ; Tue, 23 Jun 2009 08:01:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.34.20 with SMTP id m20mr35986wfj.347.1245768806654; Tue, 23 Jun 2009 07:53:26 -0700 (PDT) In-Reply-To: <4A10BD1A.3060208@tausq.org> References: <4A0DC131.8020606@gmail.com> <4A0E3D95.5090404@tausq.org> <4A10BD1A.3060208@tausq.org> Date: Tue, 23 Jun 2009 22:53:26 +0800 Message-ID: <1e3eba760906230753l4e14a025y6bc07a753999483e@mail.gmail.com> Subject: Re: [PATCH] misplaced parenthesis? From: Randolph Chung To: Roel Kluin , kyle@mcmartin.ca, linux-parisc@vger.kernel.org, Andrew Morton Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org Here's an updated patch: Reported-by: Roel Kluin Signed-off-by: Randolph Chung On Mon, May 18, 2009 at 9:42 AM, Randolph Chung wrote: > The wrong version of course produces different code.... > > the original and the corrected one may produce different code depending on > how the compiler schedules things. > > randolph > > Matt Turner wrote: >> >> Does gcc produce different code for the three variations? >> >> Matt >> >> On Sat, May 16, 2009 at 12:14 AM, Randolph Chung >> wrote: >> >>> >>> This is a bit confusingly written, but your patch does not appear to be >>> correct. >>> >>> == has higher precedence than &, so you are basically changing it to: >>> if (likely(t1 & 1)) >>> >>> it really should be >>> >>> -       if (likely(t1 & (sizeof(unsigned int)-1)) == 0) { >>> +       if (likely((t1 & (sizeof(unsigned int)-1)) == 0)) { >>> >>> randolph >>> >>> >>> Roel Kluin wrote: >>> >>>> >>>> Fix misplaced parenthesis. >>>> >>>> Signed-off-by: Roel Kluin >>>> --- >>>> I think this is what was intended? Note that this patch may affect >>>> profiling. >>>> >>>> diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c >>>> index bbda909..30207b0 100644 >>>> --- a/arch/parisc/lib/memcpy.c >>>> +++ b/arch/parisc/lib/memcpy.c >>>> @@ -405,7 +405,7 @@ byte_copy: >>>>  unaligned_copy: >>>>       /* possibly we are aligned on a word, but not on a double... */ >>>> -       if (likely(t1 & (sizeof(unsigned int)-1)) == 0) { >>>> +       if (likely(t1 & (sizeof(unsigned int)-1) == 0)) { >>>>               t2 = src & (sizeof(unsigned int) - 1); >>>>                 if (unlikely(t2 != 0)) { >>>> -- >>>> To unsubscribe from this list: send the line "unsubscribe linux-parisc" >>>> in >>>> the body of a message to majordomo@vger.kernel.org >>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html >>>> >>>> >>> >>> -- >>> To unsubscribe from this list: send the line "unsubscribe linux-parisc" >>> in >>> the body of a message to majordomo@vger.kernel.org >>> More majordomo info at  http://vger.kernel.org/majordomo-info.html >>> >>> >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at  http://vger.kernel.org/majordomo-info.html >> > > --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c index 2d68431..827e535 100644 --- a/arch/parisc/lib/memcpy.c +++ b/arch/parisc/lib/memcpy.c @@ -405,7 +405,7 @@ byte_copy: unaligned_copy: /* possibly we are aligned on a word, but not on a double... */ - if (likely(t1 & (sizeof(unsigned int)-1)) == 0) { + if (likely((t1 & (sizeof(unsigned int)-1)) == 0)) { t2 = src & (sizeof(unsigned int) - 1); if (unlikely(t2 != 0)) {