From nobody Tue Feb 10 04:17:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1605823362; cv=none; d=zohomail.com; s=zohoarc; b=alXtFbOaDjz+QES4+d5wHWWIbyUCsEA1MgEBrFdKIYDq6Ig4aMxX1boScTfTCj9zJlPUMCYHw25/zs6A/gJ0/CgFycq0H/wkKcE1aDy3U5M399f9nTcU7TwrhrFL3NODAM3OBe3wN91C6d3ENTEgR87zaX46rXTrKTIG0XVCXUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605823362; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Geuo7aDlDntl9E+BThf4Sp6VC9Xi1ojKJ4sXKRlUeWo=; b=AV9sGGuJUN0XzrtgEVQnMjp3VnOVXEQEXWPXsXjNFCUN0wX+LyViM/H+N4vXrjulY4QJsMMFvRT0lYonO4j5I3wytKJuF3o7QqHOd1B+UIzyq5c+0SY3HOW1z8vxT4v8OYNlHZwCqG3JZmXxE5MOQnJlKnlUYX4VFRFfPllgngU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605823362343916.9935484508115; Thu, 19 Nov 2020 14:02:42 -0800 (PST) Received: from localhost ([::1]:57752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfs0m-0007PR-MH for importer@patchew.org; Thu, 19 Nov 2020 17:02:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfrun-0000d2-Da for qemu-devel@nongnu.org; Thu, 19 Nov 2020 16:56:29 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:44046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kfrul-00048W-72 for qemu-devel@nongnu.org; Thu, 19 Nov 2020 16:56:29 -0500 Received: by mail-wr1-x42f.google.com with SMTP id c17so7955045wrc.11 for ; Thu, 19 Nov 2020 13:56:26 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 13:56:25 -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=Geuo7aDlDntl9E+BThf4Sp6VC9Xi1ojKJ4sXKRlUeWo=; b=JdH587DAedQ+MR5KaQmfLjoDSs7/agOQHmuT6/EJfhzf3xwW81Flu2A2OHxY/6vEGK vVN18Dkgbr0yVm9hNdJ3xW5KgbxKAt27xtXNje7GiCEpBByB1uZo2E+xB2yQ40UDZfKD kTQX9PB8f3vBdyEk4GX4nmtmwp6N63jLk++9eM5VXmIngflVEKOStewieoNvpRmjzDcM BCeHDEAUkjpb6/Hbh3OB/f8OITAq+CjOtdXirDCuGUw4Ypd9vr1hWI1qAew/p+uNHA6z fARb183/ML4PDu+9Q7e1KNh1aOh3Cknsxn+3IHLELwbQTjbw6orE8MToU9Ne0zB2Xs9F SCTQ== 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=Geuo7aDlDntl9E+BThf4Sp6VC9Xi1ojKJ4sXKRlUeWo=; b=eo7czMOUb6CUhViiQrBGlGuvVv4fjO9z8EG00YULajPd7bmcWyORk7BBlQiJ9I6ibE TZgEca5HkzaBZiZ5LRt0JJnAoOvlMpf8IlzGyP902R7pQezmHfe8vvC90+WLpXyEEZM1 dqLz94u038yMbYFurKJqbn1yhES2gWHrDFd+qs4vurzRcbC45ehx4pLft1ztT8hDUL07 2nDfcLa5PZAP4p7rWLar1mjNyv2sxGjea+H/Y/CjUt9aqnvbsh86VJwtcVIJjTblWn6z KyJpvfiYBEJZla/ax8EN7VhCPKi/HBJTE2a3IlnuKHe9JVaEe+4ArpMQNDL0YWR4JctC AxoA== X-Gm-Message-State: AOAM53002tdxYJkwoNE3cDNDnwnNWyJFXw6sUZ7YLhHX7sp5UnRp6YNZ kNOIYFROjKAzJRTyGBzDBvHlGw== X-Google-Smtp-Source: ABdhPJyCdxkj3DFBUYd1D3h/aiunzKZaf4sOByuhQg1u8wES0KZxL7nPVrurSkllNvqZg182neTbQg== X-Received: by 2002:a5d:4802:: with SMTP id l2mr12095180wrq.424.1605822985894; Thu, 19 Nov 2020 13:56:25 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 05/28] target/arm: Implement CLRM instruction Date: Thu, 19 Nov 2020 21:55:54 +0000 Message-Id: <20201119215617.29887-6-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: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" In v8.1M the new CLRM instruction allows zeroing an arbitrary set of the general-purpose registers and APSR. Implement this. The encoding is a subset of the LDMIA T2 encoding, using what would be Rn=3D0b1111 (which UNDEFs for LDMIA). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/t32.decode | 6 +++++- target/arm/translate.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/target/arm/t32.decode b/target/arm/t32.decode index cfcc71bfb0a..f045eb62c84 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -609,7 +609,11 @@ UXTAB 1111 1010 0101 .... 1111 .... 10.. ..= .. @rrr_rot =20 STM_t32 1110 1000 10.0 .... ................ @ldstm i=3D1= b=3D0 STM_t32 1110 1001 00.0 .... ................ @ldstm i=3D0= b=3D1 -LDM_t32 1110 1000 10.1 .... ................ @ldstm i=3D1= b=3D0 +{ + # Rn=3D15 UNDEFs for LDM; M-profile CLRM uses that encoding + CLRM 1110 1000 1001 1111 list:16 + LDM_t32 1110 1000 10.1 .... ................ @ldstm i=3D1= b=3D0 +} LDM_t32 1110 1001 00.1 .... ................ @ldstm i=3D0= b=3D1 =20 &rfe !extern rn w pu diff --git a/target/arm/translate.c b/target/arm/translate.c index 9f2b6018a21..47a1a5739c8 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7968,6 +7968,44 @@ static bool trans_LDM_t16(DisasContext *s, arg_ldst_= block *a) return do_ldm(s, a, 1); } =20 +static bool trans_CLRM(DisasContext *s, arg_CLRM *a) +{ + int i; + TCGv_i32 zero; + + if (!dc_isar_feature(aa32_m_sec_state, s)) { + return false; + } + + if (extract32(a->list, 13, 1)) { + return false; + } + + if (!a->list) { + /* UNPREDICTABLE; we choose to UNDEF */ + return false; + } + + zero =3D tcg_const_i32(0); + for (i =3D 0; i < 15; i++) { + if (extract32(a->list, i, 1)) { + /* Clear R[i] */ + tcg_gen_mov_i32(cpu_R[i], zero); + } + } + if (extract32(a->list, 15, 1)) { + /* + * Clear APSR (by calling the MSR helper with the same argument + * as for "MSR APSR_nzcvqg, Rn": mask =3D 0b1100, SYSM=3D0) + */ + TCGv_i32 maskreg =3D tcg_const_i32(0xc << 8); + gen_helper_v7m_msr(cpu_env, maskreg, zero); + tcg_temp_free_i32(maskreg); + } + tcg_temp_free_i32(zero); + return true; +} + /* * Branch, branch with link */ --=20 2.20.1