From patchwork Sat Feb 9 03:38:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 157910 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp241087jaa; Fri, 8 Feb 2019 19:45:52 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibxw3drrODAbUOZTCe8L1Z5Te5ieit8y5Jlc6AhizQZIWLhW/NZbinxMDizC4rHWz6fr8Pm X-Received: by 2002:a5d:6b09:: with SMTP id v9mr19951498wrw.304.1549683952141; Fri, 08 Feb 2019 19:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549683952; cv=none; d=google.com; s=arc-20160816; b=xqWjYYRFeFz9B0doAJYEhZPqTjptHlM2gZohdDay9DQBRTeZqBI19FpHIQdAl1Og5Q cZ0IUJAVLtBmZPMYlhlQkLmpT4XTGMZHNUkDCyhUHdAvpv1PgQTbm1xxSiLyStwtmxwr w2VF3tMSIMX94GTYE26rQMJQTNfcBkgauXeFO17lMhGGxJ+dR0JuYOk7zuFpPFnn7XIE kBUyzrZ1j/lmTTQMF4GYDwNqC9am/LMNPWvJcptxN+HgU6fG3Rq+GfTTIQ4QO/ToTiTM AaKXZbvL8v4C3ihBQCqUAmZjc6XlqWloSwu3wAz/GMgtePylXsoVAI3gOLMPVs1xcONt /EZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=io0Q8vKcg32ZslzsokBprL4UTtWvNRVBn1H6HUdOh9Q=; b=XMKWDOHRXyBFJoThwnZ+uXg3MvGAlSZnv1Umy2AE8g9vBYGVD6yl0EJKmOrI+YCamh S9IWo84rRwaajWS+X4Gdg6XysBXq3xB+OsjgnO5O13gqaFAUk/xI22PaVztjp1E3pD2m CUMOCVRIXpeJFEUrboi0rA7f2AsLDMmDlLFkhHY+QfncZbKIqzb+cSigOfE5sGs+TG8Q /gHpuVYhqIqDUfTwRYVjdy9twyzxSU3/BYzemFia8rMSBmOffZdje73jXpYRQQy+/Foz u9t2K5ycKRBExkk2nsfE8IOsldAk6uGmmDuBsSdVexmWTbjh25TQ9SKmhfpFFgnGclzx GPUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Qvlrwxqp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=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 m3si2845243wrj.401.2019.02.08.19.45.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 08 Feb 2019 19:45:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=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=Qvlrwxqp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:39105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsJaR-0002tW-4p for patch@linaro.org; Fri, 08 Feb 2019 22:45:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsJUI-00079t-B9 for qemu-devel@nongnu.org; Fri, 08 Feb 2019 22:39:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gsJUB-0000bu-A2 for qemu-devel@nongnu.org; Fri, 08 Feb 2019 22:39:25 -0500 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:47021) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gsJU5-0000W4-Fp for qemu-devel@nongnu.org; Fri, 08 Feb 2019 22:39:19 -0500 Received: by mail-pl1-x641.google.com with SMTP id o6so2584385pls.13 for ; Fri, 08 Feb 2019 19:39:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=io0Q8vKcg32ZslzsokBprL4UTtWvNRVBn1H6HUdOh9Q=; b=QvlrwxqpHxMIlTbfeVwY1ExLXe7f7PeexPxZP7h9XqoiYBsqAmmRDya+49OWDH1oIo xWWRU63DyCTbna2LnjPqaUV+31KWXeJkFsGQfdtxYWv0rV5cVqUf4JAjTE//BRfS+zM4 L4zCtlB6XMZoI5q3reoRZLRsjYvyhj1VOJe99ygRuTQP7/fbW+HjLRT7tBM5x1h5CMxp 7Tx1/ryUo5IJkCV1dSMqpbI1tn+AR2Kq7VfgE55kl5Yf6FZDpBxECgChuHS7c52S4rsc R/CR8JAtjMzlS80k+duyMqUeP4wUjzFuliwYX0/zsPTeu0sSWN/cV8aF4uywk9fBAOr2 CJkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=io0Q8vKcg32ZslzsokBprL4UTtWvNRVBn1H6HUdOh9Q=; b=nVXKECcCf6xAfFO3Zlp79gp10zIEjPj/naO/xIC5CAyJj1xnAkFXqFZnazVi1K2otP TLUy5mFD1naPXMMYUtptzSHo2W4eamqe4Z2XOw00Tq7sJq1kwK4RYGDT+2DW+0vkuDE6 +mo+QTtme9Oq+EhkM2jHXUTfhbkAuY1wkEkj2Jc26i+rbeN9j6RYvg8WgIOisJLc2VW/ 237jI/7LbLGc64XEBwfmhWKgXIxTVgJ4jR4jxcwnafbnRE4md0LanHJlWJVoWMNQJSot LpTDpb3G+f9NpaEnO8I5eWE0xydcm1E8treetfWrUCHq8ZgMtaJWKMGG6kZvQJ0UfaY6 RySQ== X-Gm-Message-State: AHQUAubsxORSa4w/lwmaU/LYoU36TBHxVbWsoIPwcpc5AXb7Asyeme4l r2bDgoTSzhmyOchFBU8Ml4RCY/t6nQE= X-Received: by 2002:a17:902:2969:: with SMTP id g96mr26289085plb.295.1549683544372; Fri, 08 Feb 2019 19:39:04 -0800 (PST) Received: from cloudburst.twiddle.net (97-126-115-157.tukw.qwest.net. [97.126.115.157]) by smtp.gmail.com with ESMTPSA id s84sm6340737pfi.15.2019.02.08.19.39.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Feb 2019 19:39:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 8 Feb 2019 19:38:44 -0800 Message-Id: <20190209033847.9014-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190209033847.9014-1-richard.henderson@linaro.org> References: <20190209033847.9014-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v3 09/12] target/arm: Fix set of bits kept in xregs[ARM_VFP_FPSCR] X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Given that we mask bits properly on set, there is no reason to mask them again on get. We failed to clear the exception status bits, 0x9f, which means that the wrong value would be returned on get. Except in the (probably normal) case in which the set clears all of the bits. Simplify the code in set to also clear the RES0 bits. Signed-off-by: Richard Henderson --- target/arm/helper.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.17.2 diff --git a/target/arm/helper.c b/target/arm/helper.c index 51be3fa16f..af22274bd9 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12588,7 +12588,7 @@ uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env) int i; uint32_t fpscr; - fpscr = (env->vfp.xregs[ARM_VFP_FPSCR] & 0xffc8ffff) + fpscr = env->vfp.xregs[ARM_VFP_FPSCR] | (env->vfp.vec_len << 16) | (env->vfp.vec_stride << 20); @@ -12630,7 +12630,7 @@ static inline int vfp_exceptbits_to_host(int target_bits) void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val) { int i; - uint32_t changed; + uint32_t changed = env->vfp.xregs[ARM_VFP_FPSCR]; /* When ARMv8.2-FP16 is not supported, FZ16 is RES0. */ if (!cpu_isar_feature(aa64_fp16, arm_env_get_cpu(env))) { @@ -12639,12 +12639,13 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val) /* * We don't implement trapped exception handling, so the - * trap enable bits are all RAZ/WI (not RES0!) + * trap enable bits, IDE|IXE|UFE|OFE|DZE|IOE are all RAZ/WI (not RES0!) + * + * If we exclude the exception flags, IOC|DZC|OFC|UFC|IXC|IDC + * (which are stored in fp_status), and the other RES0 bits + * in between, then we clear all of the low 16 bits. */ - val &= ~(FPCR_IDE | FPCR_IXE | FPCR_UFE | FPCR_OFE | FPCR_DZE | FPCR_IOE); - - changed = env->vfp.xregs[ARM_VFP_FPSCR]; - env->vfp.xregs[ARM_VFP_FPSCR] = (val & 0xffc8ffff); + env->vfp.xregs[ARM_VFP_FPSCR] = val & 0xffc80000; env->vfp.vec_len = (val >> 16) & 7; env->vfp.vec_stride = (val >> 20) & 3;