From patchwork Tue Jul 5 12:09:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajalakshmi S X-Patchwork-Id: 13634 Received: (qmail 48095 invoked by alias); 5 Jul 2016 12:09:29 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 48063 invoked by uid 89); 5 Jul 2016 12:09:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=beq, H*m:linux, Hx-languages-length:1901, H*MI:5060601 X-HELO: mx0a-001b2d01.pphosted.com X-IBM-Helo: d23dlp01.au.ibm.com X-IBM-MailFrom: raji@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org Subject: Re: [PATCH] powerpc: strcasecmp/strncasecmp optmization for power8 [BZ 20327] To: Florian Weimer , libc-alpha@sourceware.org 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> From: Rajalakshmi Srinivasaraghavan Date: Tue, 5 Jul 2016 17:39:17 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <6b38e864-0607-0bba-ff18-617f536f4146@redhat.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070512-0044-0000-0000-000001BDB596 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070512-0045-0000-0000-000005105FA5 Message-Id: <577BA36D.5060601@linux.vnet.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-1607050113 On 07/04/2016 07:46 PM, Florian Weimer wrote: > On 06/14/2016 11:45 AM, Rajalakshmi Srinivasaraghavan wrote: > >> Committed as c8376f3e07602aaef9cb843bb73cb5f2b860634a >> after removing those lines. > > This appears to have caused bug 20327. > > Could you have a look? > > Thanks, > Florian > > I have fixed it in the attached patch. From 42c2aeecdb371b7544b81cb09cfcb12c2f873c72 Mon Sep 17 00:00:00 2001 From: Rajalakshmi Srinivasaraghavan Date: Tue, 5 Jul 2016 04:41:51 -0400 Subject: [PATCH] POWER8: Fix return code of strcasecmp for unaligned inputs 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. [BZ #20327] * sysdeps/powerpc/powerpc64/power8/strcasecmp.S: Mask bits that are not part of the string. --- 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; \ -- 1.8.3.1