From patchwork Mon Feb 4 05:27:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 157376 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3515718jaa; Sun, 3 Feb 2019 21:37:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IbZqF/sTlEPxvZnoQvchxMp2alUD/16vgk4OdI/RirHPdiCYxGAiAP9rahE71HcFV9CPIqo X-Received: by 2002:a25:d896:: with SMTP id p144mr34454800ybg.225.1549258670339; Sun, 03 Feb 2019 21:37:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549258670; cv=none; d=google.com; s=arc-20160816; b=qKzD8v9YAyV8h2n1u0gHMxg3gpqWCtjPdZMjO2EQjLffBdAoR3b7rOHuF/zx6ye9Rn 5P3teicVA+R0FvtqK8aBbTTpRP79YbY/p3LksSuw1+TJn44D95f30p2gdOyGgD4OQAWn jyc/QaYVDt0aZT1RpBL2zkNpwCPmZfcdKuLYqX4BMJo3C3tXDNFOz9NNb3S4Sekooaa5 fI79pv+JPKawkLNQ3xiKTOeqKx28cScGXlmRlyVcsh+uKv+YTdBadxb8xAcdYMkp0W6n b7kXB7lwGtIhsJV9dHXPrGxAF2KtmgdDvmrrCht+dFd/DZhTqmw4Yt2SbZtU/YauEwhk oCLQ== 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=bp56cEa4XjKsG9OQbdTUT00/i8slI/Xfj491IKRrqgU=; b=ZfA+gpwAQWfTm+9+AaerKEUCIM3UFWr2gvh4mzXu85HNwCKNjbofpCGmh82+CTcJLA vXBht4OwQzxvpDWv1waJknmtRStiRVs/DA4Cdli7QGk5uc0X3NcTzi0vfQ32vRBajxVH sqsqM6qVIbNAdSGusPRgw8tXkXkJrV9LlSg9BdgfCHc64Bv9GW3bjccCMqP5yu2O8AoH sLu4zlHOlvxY90NUljykPHcuSFQhtpvLq0++7QaVe57jydo8913A226BczIUBqeyC5Ls lz9UTkvYFFzw3aI5VZnnizHMmKLAvHP0715Zbxiwd7lhrKczMf3lKVBAjaYqcE4qSyDF BK8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=E9CJMcRZ; 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 j21si1304065ywj.231.2019.02.03.21.37.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 03 Feb 2019 21:37:50 -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=E9CJMcRZ; 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]:36260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqWx3-0001EJ-PP for patch@linaro.org; Mon, 04 Feb 2019 00:37:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqWwc-00017n-Vd for qemu-devel@nongnu.org; Mon, 04 Feb 2019 00:37:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gqWn2-0002gn-41 for qemu-devel@nongnu.org; Mon, 04 Feb 2019 00:27:28 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:40090) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gqWmy-0002Xn-1W for qemu-devel@nongnu.org; Mon, 04 Feb 2019 00:27:26 -0500 Received: by mail-wm1-x344.google.com with SMTP id f188so11914287wmf.5 for ; Sun, 03 Feb 2019 21:27:19 -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=bp56cEa4XjKsG9OQbdTUT00/i8slI/Xfj491IKRrqgU=; b=E9CJMcRZMeS/MW4XeShcBwPT86MFToFyCTxErl7xipiKdb0O1z8CbzJfZkKf/DoDTo Dj9N+NvRIYdLc7sUwpU8cFLf73nC+y6SWYYXHJ5rs897idX8ksEfzXz2rxpHjHww9/oK mfyjvZMZyn9jrog4Ci+9w9lOiqpS+AB++aURs= 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=bp56cEa4XjKsG9OQbdTUT00/i8slI/Xfj491IKRrqgU=; b=kmpSv2bde3F/Ku407DxbDaWwABab1e3/dsCHUI9KNSg6so/TGRAQCB86cDbluVPUi6 4u6PO4gf9uK3p4MmpbB36BpixjlPIp1R9600V+8LX5hEeS8XlUQ0L6tE1Cl94GBeKIC6 GHbfuY9lnjvR/0VRrWKGY/5/Hp1lbMuNDB4JTGrS5FyoZlJioUH0ThIplQR1F8/KyHom +279mZRvBr4Q9eNi7ernfWv97vz7pxHLfIfnmhQGL9lQ4J7jKcV5smZz8yrPXxEO10+O 8KiGI/NRXBfsLdbEXgZ1y7VofW/OxuivPBip/IQ3Jf1+ZdeOrhfup7gNJFrn6z5kbD8s ch+w== X-Gm-Message-State: AHQUAubp0mkGUEmgaNYFtnZrN4C94vVpIvfHPj+aD+IWXT1/aD2cspSk WX8cRgETEm60Syp68YtrqLpZkurmaUJ+0g== X-Received: by 2002:a7b:c854:: with SMTP id c20mr5529178wml.153.1549258038346; Sun, 03 Feb 2019 21:27:18 -0800 (PST) Received: from cloudburst.twiddle.net (host81-133-38-158.in-addr.btopenworld.com. [81.133.38.158]) by smtp.gmail.com with ESMTPSA id r9sm25149962wmb.27.2019.02.03.21.27.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Feb 2019 21:27:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 4 Feb 2019 05:27:10 +0000 Message-Id: <20190204052712.30833-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190204052712.30833-1-richard.henderson@linaro.org> References: <20190204052712.30833-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH 1/3] target/arm: Force result size into dp after operation 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, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Rather than a complex set of cases testing for writeback, adjust DP after performing the operation. Signed-off-by: Richard Henderson --- target/arm/translate.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) -- 2.17.2 Reviewed-by: Peter Maydell diff --git a/target/arm/translate.c b/target/arm/translate.c index 66cf28c8cb..eb25895876 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3970,6 +3970,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); gen_vfp_msr(tmp); + dp = 0; /* always a single precision result */ break; } case 7: /* vcvtt.f16.f32, vcvtt.f16.f64 */ @@ -3993,20 +3994,25 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); gen_vfp_msr(tmp); + dp = 0; /* always a single precision result */ break; } case 8: /* cmp */ gen_vfp_cmp(dp); + dp = -1; /* no write back */ break; case 9: /* cmpe */ gen_vfp_cmpe(dp); + dp = -1; /* no write back */ break; case 10: /* cmpz */ gen_vfp_cmp(dp); + dp = -1; /* no write back */ break; case 11: /* cmpez */ gen_vfp_F1_ld0(dp); gen_vfp_cmpe(dp); + dp = -1; /* no write back */ break; case 12: /* vrintr */ { @@ -4047,10 +4053,12 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) break; } case 15: /* single<->double conversion */ - if (dp) + if (dp) { gen_helper_vfp_fcvtsd(cpu_F0s, cpu_F0d, cpu_env); - else + } else { gen_helper_vfp_fcvtds(cpu_F0d, cpu_F0s, cpu_env); + } + dp = !dp; /* result size is opposite */ break; case 16: /* fuito */ gen_vfp_uito(dp, 0); @@ -4084,15 +4092,19 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) break; case 24: /* ftoui */ gen_vfp_toui(dp, 0); + dp = 0; /* always an integer result */ break; case 25: /* ftouiz */ gen_vfp_touiz(dp, 0); + dp = 0; /* always an integer result */ break; case 26: /* ftosi */ gen_vfp_tosi(dp, 0); + dp = 0; /* always an integer result */ break; case 27: /* ftosiz */ gen_vfp_tosiz(dp, 0); + dp = 0; /* always an integer result */ break; case 28: /* ftosh */ if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { @@ -4126,20 +4138,8 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; } - /* Write back the result. */ - if (op == 15 && (rn >= 8 && rn <= 11)) { - /* Comparison, do nothing. */ - } else if (op == 15 && dp && ((rn & 0x1c) == 0x18 || - (rn & 0x1e) == 0x6)) { - /* VCVT double to int: always integer result. - * VCVT double to half precision is always a single - * precision result. - */ - gen_mov_vreg_F0(0, rd); - } else if (op == 15 && rn == 15) { - /* conversion */ - gen_mov_vreg_F0(!dp, rd); - } else { + /* Write back the result, if any. */ + if (dp >= 0) { gen_mov_vreg_F0(dp, rd); }