From patchwork Fri Jul 8 15:14:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 588512 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp753097mab; Fri, 8 Jul 2022 08:18:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v8s+25W5rZ38IYulpUXVl0WCOJXGpgOE3ZxJi7bOzIr+rfYsjklkU1APpxL5aGS6W0/CKW X-Received: by 2002:a05:620a:4449:b0:6b2:83d3:2e13 with SMTP id w9-20020a05620a444900b006b283d32e13mr2850456qkp.658.1657293480299; Fri, 08 Jul 2022 08:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657293480; cv=none; d=google.com; s=arc-20160816; b=lxwbMXzss/PjGB2GmVsaWG5rqO9v8R7nCRauh2IPZCmnvFpo4XiLJvsv65czAY4UrU F2oklWaZ/bVHsy2AuSVqn8BVsW2/KDxwP1TaSxthY6CDh7aZdj+SVckc9ERVj06GjAkX V/Ru3RX8d7pddXn0h+h/LrX8EfR/k1GRRdefuEc1wrHvOSdfcHNt7uiBCp4h2F82ou+Y LyjQrPuICirRHRo9h58mxaMEfvHDBhYzLiDHGXIfPfdFT2ZP+SssVPehhFn3Fvzisu6t DhLJGx5OVSJsx6MMGYnCtgGGZgRBvxNPeyVv9q+0F5I5PwVE8ky8dvOzW6wfGxBPLzAL nJSQ== 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:cc:to :from:dkim-signature; bh=Zt0iFWR3qz21z3bSyJ1iuT1OyELXtc2hbyVwv56j1M4=; b=dUiEkUELdNnIlB1eTKhpxTORRQZPPfUslTlX4SH8vSAJyi225jiwHAGPj+Soubnl58 bgJnyXQ50SHTCLlQPsBIs28aote6nxhv4IN6HPSgp1xA1Ov3FGLYu7X4qyLn2q/JPL2Q Vy+VVuCpQSNRi3uHKeN1i8O89vq5xWbWnHRU3Gl21OwkgufUU4GitEUnBtzOV8U/b2zn N5bm8m6+8BgxauLOXFmFzILgM/JCPYYN+b7uLw4b6adruRMzJ0fOB7qAbYpA1L8Ryz9N ik+CIxz969ix4k1XPaoh+X2m/escuvOra4+1fx7sQJt7FECWJlYr2kYGyPyIYtW7sOo3 Dpyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r1il2+o3; 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=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 fq1-20020a056214258100b00473315761desi3007795qvb.335.2022.07.08.08.18.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jul 2022 08:18:00 -0700 (PDT) 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=pass header.i=@linaro.org header.s=google header.b=r1il2+o3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9pjz-00029Z-S5 for patch@linaro.org; Fri, 08 Jul 2022 11:17:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9pi6-00027r-Ap for qemu-devel@nongnu.org; Fri, 08 Jul 2022 11:16:02 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:33399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9pi0-000256-M9 for qemu-devel@nongnu.org; Fri, 08 Jul 2022 11:16:02 -0400 Received: by mail-pj1-x102a.google.com with SMTP id j1-20020a17090aeb0100b001ef777a7befso1839728pjz.0 for ; Fri, 08 Jul 2022 08:15:53 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=Zt0iFWR3qz21z3bSyJ1iuT1OyELXtc2hbyVwv56j1M4=; b=r1il2+o3ugblql6EWta8flVXEwTReZW7f/a30BLJ9P94aEumoCWLym/GL8pkesWTA5 yP41MNabkthP6f3GbOFe6yG3M6DniiFpG/+91GJllmwpUu6PmG80qNit8E32RG4TshLH C/G3f5jrIAIw8EWND8Vnv0st3ZMhoztS+N4arhM5A5z3OD1jTO94BjfWi5C+hXbEglIc VGY/HXwqct1/Ia2HjH8zKk4vS3Uo43SwYULZsEjydo0Z22b8VnH3BEv/6FL4sq0ADgDj aoIokctejPwacTK3wFuYYCAQBSUlvItub75xd8DfizU5egowfbC+WOCn5xj8S3LJ48Iw fYKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zt0iFWR3qz21z3bSyJ1iuT1OyELXtc2hbyVwv56j1M4=; b=6SXNRxOgYlPevW/FrKwkLZAhIwS7VLZsLGhqjFSU2oZwzwuHP4e8TSmIm8Oiz4KHzs yVv2FUwyp0p5jC5TurLaDjGFoxh0wJ3sxcoboVVvywEMyKbcgbVfKTbgn0zqIXCstKH3 +LrE4jPLnWtXDZbkJY9Wr3CYf9ygTB12icuB7mOwfqtIDquWcg5NaXvnCwsJpiPVxQuR EPhuQWN300O7ldsZ4FHcT4z/mhvtm4s2VmOgqsKcvXSuaGCtfljUSq/HQ/PPDHsVCyG/ S1rSmj0vTggNvQpigj9y40LoD51Q4MtGgLITZ+sv0f3XePa/a7NIq/g+rK/pVP5iGdX+ lqTQ== X-Gm-Message-State: AJIora8yoHmpgwRwRdKEgcjSuxL+mTfk+RBkuR4HaXut2DYZfA7xfeNK bX5Tc4VcJoG1XlVs3bExB1LBwq9Zjmn47y2w X-Received: by 2002:a17:902:e752:b0:16a:4515:b2f2 with SMTP id p18-20020a170902e75200b0016a4515b2f2mr4187537plf.140.1657293352716; Fri, 08 Jul 2022 08:15:52 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id n17-20020a056a0007d100b0051bada81bc7sm29085774pfu.161.2022.07.08.08.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 08:15:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v6 02/45] target/arm: Add infrastructure for disas_sme Date: Fri, 8 Jul 2022 20:44:57 +0530 Message-Id: <20220708151540.18136-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220708151540.18136-1-richard.henderson@linaro.org> References: <20220708151540.18136-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This includes the build rules for the decoder, and the new file for translation, but excludes any instructions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.h | 1 + target/arm/sme.decode | 20 ++++++++++++++++++++ target/arm/translate-a64.c | 7 ++++++- target/arm/translate-sme.c | 35 +++++++++++++++++++++++++++++++++++ target/arm/meson.build | 2 ++ 5 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 target/arm/sme.decode create mode 100644 target/arm/translate-sme.c diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index f0970c6b8c..789b6e8e78 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -146,6 +146,7 @@ static inline int pred_gvec_reg_size(DisasContext *s) } bool disas_sve(DisasContext *, uint32_t); +bool disas_sme(DisasContext *, uint32_t); void gen_gvec_rax1(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); diff --git a/target/arm/sme.decode b/target/arm/sme.decode new file mode 100644 index 0000000000..c25c031a71 --- /dev/null +++ b/target/arm/sme.decode @@ -0,0 +1,20 @@ +# AArch64 SME instruction descriptions +# +# Copyright (c) 2022 Linaro, Ltd +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +# +# This file is processed by scripts/decodetree.py +# diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c86b97b1d4..a5f8a6c771 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14806,7 +14806,12 @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) } switch (extract32(insn, 25, 4)) { - case 0x0: case 0x1: case 0x3: /* UNALLOCATED */ + case 0x0: + if (!extract32(insn, 31, 1) || !disas_sme(s, insn)) { + unallocated_encoding(s); + } + break; + case 0x1: case 0x3: /* UNALLOCATED */ unallocated_encoding(s); break; case 0x2: diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c new file mode 100644 index 0000000000..786c93fb2d --- /dev/null +++ b/target/arm/translate-sme.c @@ -0,0 +1,35 @@ +/* + * AArch64 SME translation + * + * Copyright (c) 2022 Linaro, Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "cpu.h" +#include "tcg/tcg-op.h" +#include "tcg/tcg-op-gvec.h" +#include "tcg/tcg-gvec-desc.h" +#include "translate.h" +#include "exec/helper-gen.h" +#include "translate-a64.h" +#include "fpu/softfloat.h" + + +/* + * Include the generated decoder. + */ + +#include "decode-sme.c.inc" diff --git a/target/arm/meson.build b/target/arm/meson.build index 43dc600547..6dd7e93643 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -1,5 +1,6 @@ gen = [ decodetree.process('sve.decode', extra_args: '--decode=disas_sve'), + decodetree.process('sme.decode', extra_args: '--decode=disas_sme'), decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'), decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'), decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'), @@ -50,6 +51,7 @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'sme_helper.c', 'translate-a64.c', 'translate-sve.c', + 'translate-sme.c', )) arm_softmmu_ss = ss.source_set()