Received: by 2002:a19:ee0a:0:0:0:0:0 with SMTP id g10csp754179lfb; Thu, 19 Nov 2020 14:03:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJ2K+4C+Me1vlmH+MZbp+KMoZR5+9B8gW50yA9vgFw5jOBu4uuf5V6fHVckPbzsNhzoFjp X-Received: by 2002:a25:c711:: with SMTP id w17mr20986322ybe.132.1605823408562; Thu, 19 Nov 2020 14:03:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605823408; cv=none; d=google.com; s=arc-20160816; b=tqKfk79LCANcCILourJ+jWqeH1v0l5Om4PWBB7idk730VicCZHH8cYMVGqf6zfNLSC unWK9wyG7ftXFLqrk6lJnYHhfT+CclZQETxWYFi0Rr1GaKI4gYfnSzFRPcf3LXLrLCKz /bNg33pnOeVWtoXp2T0aX93Rw/w0GYgKRYsuFsp1N0pmEYw2iknza8eHekpimmCI03Kx HWCfnov5Xz39MzRzbBYxyk3vGZSMBDNR3oHyudy+NJ5nD+CGP6RqbUmAIGBJBxKY66Py M+V47mNXPjQUnkALkDX4KQYEm2ALXzQoDhOrLeHUiLtnRDDTtQDi7MdmUIvOvjLkb+1A w0FQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=opCzeDjiGx7OhE/oRP6OxBZouGB0q+W7fnmO9TQA2f8=; b=uE8hi0rqU7xIK0N06SsK1mB0vWR4/hPEnAyHGONRfbFMJP0iMGKaCN90Ntc9UB/bDx P/oJA3zhr1IKRo+LFzaGJ1FiwBmHb3TVaCuNxwtdlIuk8WGUyYpSMji+SKK1/amho3s9 0TdZvh38wCsjh79fUaGbEFgrsBhC4BmZsqBQH2I5wDO/kNuXLnnZZLuOzApMAOPhq/c4 NcaoKowjfv/ZmLPm/OBqfH7pe/kqF42MGbYcdLBxniorXQtqVeO17fJvjh7qnmk/fBFK M8MsARjF4IgRLH8AZ18q4ZVTwsQZ4A+YI/1wfTo6B0E8dZnTiZ2FhmEzRQVSYTC5Y7qA zu6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DnyxAwOt; 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=pass (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 9si720945ybb.399.2020.11.19.14.03.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Nov 2020 14:03:28 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=DnyxAwOt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfs1X-0008QA-Qv for alex.bennee@linaro.org; Thu, 19 Nov 2020 17:03:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfruy-0000kG-St for qemu-devel@nongnu.org; Thu, 19 Nov 2020 16:56:41 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51452) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kfruq-0004Az-CS for qemu-devel@nongnu.org; Thu, 19 Nov 2020 16:56:35 -0500 Received: by mail-wm1-x344.google.com with SMTP id a186so5772143wme.1 for ; Thu, 19 Nov 2020 13:56:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=opCzeDjiGx7OhE/oRP6OxBZouGB0q+W7fnmO9TQA2f8=; b=DnyxAwOt3qo/5R8xN/DI/1otRLHGaffGampfIR2NhhRfk5rcGxtz9gu5Vv4dSZXWFk AA03zyxijF9rnmIVVHEztuBInt55RxSvWLeKkFlDtf+pzptR2RC4JrA1HF1w72vxrBDv rCYaY5NUJ8rxOpuotB0YV6Wa0QCjLsSuVI9YbwVHlyRyGASf9oXXbVavdn/H35yQYakc owd7hW5daN9Y4wDKhNTFUVbMs1+5IpEYxwVRx0WOW2timUlkYZhiSLjs2Rd0C0LwofCh SDz3vHZKP3fOCDqcK3gDUbDXf/+i/1lifTCNRWWKN3s/7va41XRWJP/Ww+415eyHCBlP 2cKw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=opCzeDjiGx7OhE/oRP6OxBZouGB0q+W7fnmO9TQA2f8=; b=phllxMN1Q6PsDnC4zQS3Hb7l1KQ0ufdBYQyGWJdYSduYPgZsrYnaYlJ2nmCQVF//4l ICE/KnagJY3B53nRCWtL/bUpZIcCJ9/+x5bEPc0YtqKfms6aeMfW1MdtcSnjcILqg4Ao kotyMIPvyHNuu6I1prVC7XQGfDPMIDI9TCwcGGUYukV5p1DG81Unm9cycCm4WLra3fZb ZLIhqtXPgSug9Iyc8JnOzNH7xZAb4W1Pq0xeOHAaXdKubKYBZ+B4P2ujc/n9SwzdhQ56 GkVrloH96WxDyXvaX2a7ZYQn3wcnu4vURQjPOU2Aiw+LeX3kDw7baC4RK+5rLz+8sJDu zSaQ== X-Gm-Message-State: AOAM533UBTkY5m6+pBPzBJ5p9xYtAZx1e+OlLwwKbSHDSPkUMb1Xmks7 4O7ylncdnonY53uk7KwxmM94SNGISbdBdw== X-Received: by 2002:a1c:e907:: with SMTP id q7mr6607945wmc.161.1605822990883; Thu, 19 Nov 2020 13:56:30 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id j15sm1934851wrm.62.2020.11.19.13.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 13:56:29 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 09/28] target/arm: Implement VLDR/VSTR system register Date: Thu, 19 Nov 2020 21:55:58 +0000 Message-Id: <20201119215617.29887-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201119215617.29887-1-peter.maydell@linaro.org> References: <20201119215617.29887-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: pqicfMlywlmo Implement the new-in-v8.1M VLDR/VSTR variants which directly read or write FP system registers to memory. Signed-off-by: Peter Maydell --- target/arm/vfp.decode | 14 ++++++ target/arm/translate-vfp.c.inc | 89 ++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 1300ba045dd..6f7f28f9a46 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -84,6 +84,20 @@ VLDR_VSTR_hp ---- 1101 u:1 .0 l:1 rn:4 .... 1001 imm:8 vd=%vd_sp VLDR_VSTR_sp ---- 1101 u:1 .0 l:1 rn:4 .... 1010 imm:8 vd=%vd_sp VLDR_VSTR_dp ---- 1101 u:1 .0 l:1 rn:4 .... 1011 imm:8 vd=%vd_dp +# M-profile VLDR/VSTR to sysreg +%vldr_sysreg 22:1 13:3 +%imm7_0x4 0:7 !function=times_4 + +&vldr_sysreg rn reg imm a w p +@vldr_sysreg .... ... . a:1 . . . rn:4 ... . ... .. ....... \ + reg=%vldr_sysreg imm=%imm7_0x4 &vldr_sysreg + +# P=0 W=0 is SEE "Related encodings", so split into two patterns +VLDR_sysreg ---- 110 1 . . w:1 1 .... ... 0 111 11 ....... @vldr_sysreg p=1 +VLDR_sysreg ---- 110 0 . . 1 1 .... ... 0 111 11 ....... @vldr_sysreg p=0 w=1 +VSTR_sysreg ---- 110 1 . . w:1 0 .... ... 0 111 11 ....... @vldr_sysreg p=1 +VSTR_sysreg ---- 110 0 . . 1 0 .... ... 0 111 11 ....... @vldr_sysreg p=0 w=1 + # We split the load/store multiple up into two patterns to avoid # overlap with other insns in the "Advanced SIMD load/store and 64-bit move" # grouping: diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc index 2d201ad0888..dc26759ab95 100644 --- a/target/arm/translate-vfp.c.inc +++ b/target/arm/translate-vfp.c.inc @@ -912,6 +912,95 @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a) return true; } +static void fp_sysreg_to_memory(DisasContext *s, void *opaque, TCGv_i32 value) +{ + arg_vldr_sysreg *a = opaque; + uint32_t offset = a->imm; + TCGv_i32 addr; + + if (!a->a) { + offset = - offset; + } + + addr = load_reg(s, a->rn); + if (a->p) { + tcg_gen_addi_i32(addr, addr, offset); + } + + if (s->v8m_stackcheck && a->rn == 13 && a->w) { + gen_helper_v8m_stackcheck(cpu_env, addr); + } + + gen_aa32_st32(s, value, addr, get_mem_index(s)); + tcg_temp_free_i32(value); + + if (a->w) { + /* writeback */ + if (!a->p) { + tcg_gen_addi_i32(addr, addr, offset); + } + store_reg(s, a->rn, addr); + } else { + tcg_temp_free_i32(addr); + } +} + +static TCGv_i32 memory_to_fp_sysreg(DisasContext *s, void *opaque) +{ + arg_vldr_sysreg *a = opaque; + uint32_t offset = a->imm; + TCGv_i32 addr; + TCGv_i32 value = tcg_temp_new_i32(); + + if (!a->a) { + offset = - offset; + } + + addr = load_reg(s, a->rn); + if (a->p) { + tcg_gen_addi_i32(addr, addr, offset); + } + + if (s->v8m_stackcheck && a->rn == 13 && a->w) { + gen_helper_v8m_stackcheck(cpu_env, addr); + } + + gen_aa32_ld32u(s, value, addr, get_mem_index(s)); + + if (a->w) { + /* writeback */ + if (!a->p) { + tcg_gen_addi_i32(addr, addr, offset); + } + store_reg(s, a->rn, addr); + } else { + tcg_temp_free_i32(addr); + } + return value; +} + +static bool trans_VLDR_sysreg(DisasContext *s, arg_vldr_sysreg *a) +{ + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { + return false; + } + if (a->rn == 15) { + return false; + } + return gen_M_fp_sysreg_write(s, a->reg, memory_to_fp_sysreg, a); +} + +static bool trans_VSTR_sysreg(DisasContext *s, arg_vldr_sysreg *a) +{ + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { + return false; + } + if (a->rn == 15) { + return false; + } + return gen_M_fp_sysreg_read(s, a->reg, fp_sysreg_to_memory, a); +} + static bool trans_VMOV_half(DisasContext *s, arg_VMOV_single *a) { TCGv_i32 tmp; -- 2.20.1