From patchwork Wed Apr 11 21:16:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 133172 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1037314ljb; Wed, 11 Apr 2018 14:16:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx49yMjdPQrji6tcAR6xfm3Fxvw+Pg9TepFGMNRt3ZKV5/y5xCQ86qHVpvPY7pp0J0lbC+NJx X-Received: by 10.99.186.26 with SMTP id k26mr3255684pgf.39.1523481401052; Wed, 11 Apr 2018 14:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523481401; cv=none; d=google.com; s=arc-20160816; b=dJuTbegs9WAi0thbMYoysN3+5+L/8PtX3v6oWM0Qdi1qUujzFF+wh3joYRzpt8Fy1h Sg3uQk6JsAv50Ao9U28LcNcIK3OK0++5cmsRm9Um3XNFOBZ4XPQmGsRgQFxM1aiDIwrU hYwiGf3Xtr6lzsRuBiWUd5AZn3uTGz/okmrwaXzzXgv5qUDk8foOx1wuuDEJrK4fDb0A c+qrklKYoSC/PsKrJ4r+TmAcFNeEN7q7bOimM/AnI/6HK5b2/po/EfceiIy/Hw2SEW31 0PXLIZmoEI85QHESqNRxZ5dBDJGJjAL1JSMhDTCcRTmMyVelLoiWBcYPqh+oMu2BkPtW CsNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:delivered-to:sender:list-help :list-post:list-archive:list-subscribe:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=/58BtFjtASY33cpSfVmiwgP6rfD1BfvlfF+4gZiXpwM=; b=eX3kMK++IvPlwmcjLj3z0Xde9GUhWdPls3ioWZTdwO+U/Qwzfolkq7/07/+DP2gcEM cb1ypmPRBtzZGnPkrk068PdAQdoLCa0M+PWXQ+mAn3Hc8bOZcBmoYe52bUoA7DUhkE/q pSmv9KPAXky5G0/uazBwp9Q7hM3YzU/Lm91lYlBarxzOniFI+8BZ5bSZhDLCkBGtZY4E AGk1H3/zfbFyjkDAweFsgni2pCQUbdMcx0xwjBYlZC1QJFIGoPu2CpJ7m6nrch8pYr/3 UwK7SurVF879CAXJXJIbszC5mKsd8NAyaSgBW77Exh69bw6nkvGoSgJUVMzrp4CI43+B y4ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=RdZrascw; spf=pass (google.com: domain of libc-alpha-return-91503-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91503-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id i63si1320071pge.219.2018.04.11.14.16.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 14:16:41 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91503-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=RdZrascw; spf=pass (google.com: domain of libc-alpha-return-91503-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91503-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=UvZvUVpCsb/2cZmviK8aDljqHMzn8jg//7sjdguY0CWQnVOJ+d7g1 OXnxJItRnUulwVEvgYrr8O2KSb8Z+5M+yTKOKbuFR6K+6oafFCGEyj1NXw0zkzDJ tOrtHqD1LRfoJ4uYiIp3+FkTwtsI7tyOs7ottLrr4b68ITq8/h36Q8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=aiJeB/048WUdfWF7LfrPWN4Ypmg=; b=RdZrascwDxeQLdy1ADjLL6Z20p+h dBpcXFPuONfcdhNd9n9jQJDa4itHdFsID2Q0cvKt/EdQZezaWZITU8WofW9lrp16 mQ+UfIO1KjXuumqaOLEHMyYbQCMo0T7qgfPMLPOv9htKwQUjdE0QXWDlqXrEuko1 lq8urS030lExCyQ= Received: (qmail 117516 invoked by alias); 11 Apr 2018 21:16:30 -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 117501 invoked by uid 89); 11 Apr 2018 21:16:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f177.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=/58BtFjtASY33cpSfVmiwgP6rfD1BfvlfF+4gZiXpwM=; b=Kyer78jRfTC/PMXgYiIorVaDaKkyGvk2Nuc6XD+gBwRlWUprvU//OBJxBJLyR7o3sq jRf1W11VdD5IQB1NNBT2unvd1UVR+KVjstbfP9BlYsIi2EMytdruaOv3gUw8ZBJdPOY9 FYjtJxGM+Ga8utoZXPeinVbafqOdYEkuC2BgPnrEja/wb4JCucJlih20hWKXexv+UXIQ VmVxeYRmROmwkkQA8dqCr4UeLe1coTmwecqlofllsTTIWv2RXMZ7gItwKzNio+Vl1rOe Yj4lKNAFW4vF+COXdfamuI4FeUfZsQS1XyNr1p/tCxFTMayOvCYXNXq3hhyERhRVSYFU zcKA== X-Gm-Message-State: ALQs6tAUk1n6nLzo1NvisrNeiAngpvBh7V6kFlm5Owpj1Y86CmqB7ykk fC5t+QBrvMctPyI3wLVg7+41+vHVl5s= X-Received: by 10.200.4.9 with SMTP id v9mr9642389qtg.69.1523481385978; Wed, 11 Apr 2018 14:16:25 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/4] arm: Fix armv7 neon memchr on ARM mode Date: Wed, 11 Apr 2018 18:16:15 -0300 Message-Id: <1523481378-16290-1-git-send-email-adhemerval.zanella@linaro.org> Current optimized armv7 neon memchr uses the NO_THUMB wrongly to conditionalize thumb instruction usage. The flags is meant to be defined before sysdep.h inclusion and to indicate the assembly requires to build in ARM mode, not to check whether thumb is enable or not. This patch fixes it by using the GCC provided '__thumb__' instead. Also, even if the implementation is fixed to not use thumb instructions it was clearly not proper checked in ARM mode: the carry bit flag will be reset in previous 'cmp synd, #0' and thus the 'bhi cntin, #0' won't be able to branch correctly if the loop finishes with 'cntin' being negative (indicating that some bytes still require to be checked). This patch also fixes it by checking the carry flag in previous loop iteration directly (in ARM mode it will run both '.Lmasklast' and '.Ltail' even if no byte is found in last loop iteration). Checked on arm-linux-gnueabihf (with -marm and -mthumb mode). [BZ #23031] * sysdeps/arm/armv7/multiarch/memchr_neon.S (memchr): Fix tail check on ARM mode. (NO_THUMB): Check __thumb__ instead. --- ChangeLog | 7 +++++++ sysdeps/arm/armv7/multiarch/memchr_neon.S | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/sysdeps/arm/armv7/multiarch/memchr_neon.S b/sysdeps/arm/armv7/multiarch/memchr_neon.S index 1b2ae75..1b2a69d 100644 --- a/sysdeps/arm/armv7/multiarch/memchr_neon.S +++ b/sysdeps/arm/armv7/multiarch/memchr_neon.S @@ -68,7 +68,7 @@ * allows to identify exactly which byte has matched. */ -#ifndef NO_THUMB +#ifdef __thumb__ .thumb_func #else .arm @@ -132,7 +132,7 @@ ENTRY(memchr) /* The first block can also be the last */ bls .Lmasklast /* Have we found something already? */ -#ifndef NO_THUMB +#ifdef __thumb__ cbnz synd, .Ltail #else cmp synd, #0 @@ -176,14 +176,11 @@ ENTRY(memchr) vpadd.i8 vdata0_0, vdata0_0, vdata1_0 vpadd.i8 vdata0_0, vdata0_0, vdata0_0 vmov synd, vdata0_0[0] -#ifndef NO_THUMB +#ifdef __thumb__ cbz synd, .Lnotfound bhi .Ltail /* Uses the condition code from subs cntin, cntin, #32 above. */ #else - cmp synd, #0 - beq .Lnotfound - cmp cntin, #0 bhi .Ltail #endif