From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61444 invoked by alias); 5 Jul 2016 14:01:23 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 61429 invoked by uid 89); 5 Jul 2016 14:01:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=beq, Tulio X-HELO: mx0a-001b2d01.pphosted.com X-IBM-Helo: d24dlp01.br.ibm.com X-IBM-MailFrom: tuliom@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org From: "Tulio Magno Quites Machado Filho" To: Rajalakshmi Srinivasaraghavan , Florian Weimer , libc-alpha@sourceware.org, Adhemerval Zanella Cc: Subject: Re: [PATCH] powerpc: strcasecmp/strncasecmp optmization for power8 [BZ 20327] In-Reply-To: <577BA36D.5060601@linux.vnet.ibm.com> References: <1461919871-30348-1-git-send-email-raji@linux.vnet.ibm.com> <87eg809a1i.fsf@totoro.br.ibm.com> <575FD251.7010705@linux.vnet.ibm.com> <6b38e864-0607-0bba-ff18-617f536f4146@redhat.com> <577BA36D.5060601@linux.vnet.ibm.com> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.4.51.1 (x86_64-unknown-linux-gnu) Date: Tue, 05 Jul 2016 14:01:00 -0000 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070514-0032-0000-0000-000002623053 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070514-0033-0000-0000-00000E9A19D9 Message-Id: <87vb0kfal3.fsf@totoro.br.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-05_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607050127 X-SW-Source: 2016-07/txt/msg00129.txt.bz2 Rajalakshmi Srinivasaraghavan writes: > On 07/04/2016 07:46 PM, Florian Weimer wrote: >> On 06/14/2016 11:45 AM, Rajalakshmi Srinivasaraghavan wrote: > Subject: [PATCH] POWER8: Fix return code of strcasecmp for unaligned inputs Could you replace POWER8 by powerpc, please? > If the input values are unaligned and if there are null characters in the > memory before the starting address of the input values, strcasecmp > gives incorrect return code. Fixed it by adding mask the bits that > are not part of the string. > > Tested on ppc64 and ppc64le. Despite this being a bug fix, I believe we need the approval from Adhemerval before integrating it during the freeze window. > [BZ #20327] > * sysdeps/powerpc/powerpc64/power8/strcasecmp.S: Mask bits that > are not part of the string. This is a very important case. Can we improve the current testcase to validate this scenario too? > --- > sysdeps/powerpc/powerpc64/power8/strcasecmp.S | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/sysdeps/powerpc/powerpc64/power8/strcasecmp.S b/sysdeps/powerpc/powerpc64/power8/strcasecmp.S > index 63f6217..d6a4df2 100644 > --- a/sysdeps/powerpc/powerpc64/power8/strcasecmp.S > +++ b/sysdeps/powerpc/powerpc64/power8/strcasecmp.S > @@ -44,7 +44,9 @@ > #ifdef __LITTLE_ENDIAN__ > #define GET16BYTES(reg1, reg2, reg3) \ > lvx reg1, 0, reg2; \ > - vcmpequb. v8, v0, reg1; \ > + vspltisb v8, -1; \ > + vperm v8, v8, reg1, reg3; \ > + vcmpequb. v8, v0, v8; \ > beq cr6, 1f; \ > vspltisb v9, 0; \ > b 2f; \ > @@ -57,7 +59,9 @@ > #else > #define GET16BYTES(reg1, reg2, reg3) \ > lvx reg1, 0, reg2; \ > - vcmpequb. v8, v0, reg1; \ > + vspltisb v8, -1; \ > + vperm v8, reg1, v8, reg3; \ > + vcmpequb. v8, v0, v8; \ > beq cr6, 1f; \ > vspltisb v9, 0; \ > b 2f; \ Although this code is simple, I believe this macro is missing more comments. I suggest to explain the following: - How does this macro use reg1, reg2, reg3 and v8? - Why is it setting v9 to 0? -- Tulio Magno