Received: by 2002:adf:c793:0:0:0:0:0 with SMTP id l19csp1563041wrg; Sat, 8 Jun 2019 13:02:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyas15/Dmu/hTBSClUGFgdic9pqT0gwNRAnTYvv6nZ69+cGiOJG7LJCsw+xLzBNsKf4NKXd X-Received: by 2002:aed:3686:: with SMTP id f6mr30741677qtb.30.1560024163413; Sat, 08 Jun 2019 13:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560024163; cv=none; d=google.com; s=arc-20160816; b=t205Wdf0NnGABtEs8dpjl+a/Ddy6QwA339qkwnM+Q+3pLdly9GnsQ82cwVaPTNMGsd DO8biX3yp4mcGeWFJa9tGkUFhfBJfphf7TW9Fv4JEg2zyNudFfgmjpbhr07SeCoKjJy2 L0cQiuwiC9TnlNaEf0GOxgJyYY3/REobvsVAzGyW21UJOH/zrG1JecqK7qSt0rjyMStN WCenU7mfxTqjNsZafe3t9/LMTU9Di1QtQOFy5TyjhFhYNJPkHRiVcayN15hISEfz8lnH ph4U5VlBSDk7ikTx2W8b29sIKMQpFkUWHBIYpN5dFVkJrYO/Zj3TOp7KYlIGa/adqcon gUUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:openpgp:from:references:to :dkim-signature; bh=OmR05geqhI+CrTiQe1FRjXamoiDOgmToTEUoLNtYb+U=; b=J6tMJ/LWqNrCL7DWXPyjLCmEbCtFdsZ9Zm8z8xCNpj979EiSqSfkHakhA7quzzHXTV wWZQAMU1AiKOHV1CR9tjMYUliaipuDLaRT4Wsfnns4gWW9yyJMp6tEoFLxjydUyGntC6 klRjqIiGR3X+JGJr+PneqrTxvFGlq5Bvq7At/OdkKqYRqw4AUCeJ91dNsy3QFLXdNC+r fSUGxWxNrKNUFCJiSaLmyOu3GDImRELR+aU5ODl3C6zJZQkSCwgqZPBtcRup7AvqF2ig x2wuG10YYq5aC2D07ghvyagb0rs6fSEDNxN/KWHXirYmHt2zuqNOyIz+qu/kJWWtz3Hu A/sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="MA/rJ2gl"; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l12si3662596qtl.231.2019.06.08.13.02.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 08 Jun 2019 13:02:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="MA/rJ2gl"; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZhY3-0000mt-0R for alex.bennee@linaro.org; Sat, 08 Jun 2019 16:02:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39116) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZh44-0001Cw-Cl for qemu-devel@nongnu.org; Sat, 08 Jun 2019 15:31:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZh41-00015t-T3 for qemu-devel@nongnu.org; Sat, 08 Jun 2019 15:31:44 -0400 Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]:46296) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZh41-0000rA-Dx for qemu-devel@nongnu.org; Sat, 08 Jun 2019 15:31:41 -0400 Received: by mail-ot1-x344.google.com with SMTP id z23so4893962ote.13 for ; Sat, 08 Jun 2019 12:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:openpgp:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OmR05geqhI+CrTiQe1FRjXamoiDOgmToTEUoLNtYb+U=; b=MA/rJ2gl9EHfwsBa4iQetLIZ2zMp/qbcytrZR5kBCqhBB9qCm1kMhpOyYz94z49KWy IRtmXnZzm06NmQh/JDDlciz1246eJ0UdPb+jMwKDdC9z5dfK5ldetNZPTycotLfQPJkm FmKc/gyhQfDIMQCCZWbnXfGa5I9aS60mxPslvP9DfXo6U1QWS1m+nu8aE5LAhJ4FV/et RYccBC3B0hEoaYOW9p7ltwCCKvKGxKt1VxqfV0cgGi6sheCFAKlVqbyHTx/oS1OV4+Uf Xiac/fLp/cZX+MxF44n5XD1ivMShK4Fl8AG/nRQzfACtyJ//Wn+xCstATbuDWUDSByyG oNCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OmR05geqhI+CrTiQe1FRjXamoiDOgmToTEUoLNtYb+U=; b=G5+e3KaWQZyR5xprK/RC4kmI0JiIaL2CbtcJoFfaGUf1urQPpuSc9gq9nbrekxol7n 1dUod51C/y10vP6QSBK1gIUsHynSrV8qm5ZbA7LHeBvhvUu2Oa8mYfAeUTcW498zQdc0 B0EkMiE8Rez4Ol3jtDcAlb6AYXtGEKN7T8Z0oarmvrZcPrt/6UNPO+k5u1Aq1RdPOaDl Lt5nwzA1dDSwrsJ48/u6GHz/HjCXWMC7fJD1YpQElt4NmCStrO4fiAcORz5u7gnV9GjA pVPH//IUeKUQvleziI46Vr3LiUtwSpr5gXmkTM5lGd8JLAtmJU76fhMiuW5mAfqPCUFH hOVA== X-Gm-Message-State: APjAAAXycojKXWZWF1s3oyS5NNlwgyEl7vnvzNSAqCt3iQ6pNpQX8pHH bHsFYJ/cSxeOt4eScOZahlDapQnWkOEoGQ== X-Received: by 2002:a9d:7d83:: with SMTP id j3mr24830060otn.191.1560022281963; Sat, 08 Jun 2019 12:31:21 -0700 (PDT) Received: from [10.219.49.199] ([187.217.230.84]) by smtp.gmail.com with ESMTPSA id v20sm2023351otk.66.2019.06.08.12.31.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Jun 2019 12:31:21 -0700 (PDT) To: Peter Maydell , qemu-arm@nongnu.org, qemu-devel@nongnu.org References: <20190606174609.20487-1-peter.maydell@linaro.org> <20190606174609.20487-43-peter.maydell@linaro.org> From: Richard Henderson Openpgp: preference=signencrypt Message-ID: Date: Sat, 8 Jun 2019 14:26:13 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190606174609.20487-43-peter.maydell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::344 Subject: Re: [Qemu-devel] [PATCH 42/42] target/arm: Fix short-vector increment behaviour X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-devel" X-TUID: JhYWxVpkgfk9 On 6/6/19 12:46 PM, Peter Maydell wrote: > For VFP short vectors, the VFP registers are divided into a > series of banks: for single-precision these are s0-s7, s8-s15, > s16-s23 and s24-s31; for double-precision they are d0-d3, > d4-d7, ... d28-d31. Some banks are "scalar" meaning that > use of a register within them triggers a pure-scalar or > mixed vector-scalar operation rather than a full vector > operation. The scalar banks are s0-s7, d0-d3 and d16-d19. > When using a bank as part of a vector operation, we > iterate through it, increasing the register number by > the specified stride each time, and wrapping around to > the beginning of the bank. > > Unfortunately our calculation of the "increment" part of this > was incorrect: > vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask) > will only do the intended thing if bank_mask has exactly > one set high bit. For instance for doubles (bank_mask = 0xc), > if we start with vd = 6 and delta_d = 2 then vd is updated > to 12 rather than the intended 4. > > This only causes problems in the unlikely case that the > starting register is not the first in its bank: if the > register number doesn't have to wrap around then the > expression happens to give the right answer. > > Fix this bug by abstracting out the "check whether register > is in a scalar bank" and "advance register within bank" > operations to utility functions which use the right > bit masking operations. > > Signed-off-by: Peter Maydell > --- > target/arm/translate-vfp.inc.c | 100 ++++++++++++++++++++------------- > 1 file changed, 60 insertions(+), 40 deletions(-) Reviewed-by: Richard Henderson r~