From nobody Sat May 4 02:50:20 2024 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=1631527143; cv=none; d=zohomail.com; s=zohoarc; b=llFQU2kn+FUM0YUBT07Naj00MQA1BlzEX4aMg6aogQ7rSwSfrjZQ6SGzdDzv8k9GrriL9yJcl7WeN5rHp+4A+JVtWjXggJrA4jpBttjtSdYCwLlCL4HAZkAbUVeoKMNs1nB2g3eadAxRi9pbDBHhu4dMeLe5YthL0Yn3brVOktA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527143; h=Content-Transfer-Encoding:Cc: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=F+tOIS44awXR5yx0CVgSMzZ11FU347XCqr0ZLojmfiM=; b=J5/DZg0YQC91Yk1zdVQ1PAcShzDhmmq0BHp0WFE10SgQ3D9YeGZ3Trf6bCDDQjrvqo4xz13S2m8tIIkY+dJUBnPpNQRD5EvPPIdjWpKZLqQWr8vT2OaAK27I89cbFcl56RM8L4yGqJMSdMg5eRew7nOL7lNADoVpzWevRxr/h3Y= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631527143359822.8594317457093; Mon, 13 Sep 2021 02:59:03 -0700 (PDT) Received: from localhost ([::1]:57372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPiju-0005lF-0z for importer@patchew.org; Mon, 13 Sep 2021 05:59:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPifp-00079D-IE for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:49 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:34326) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifk-0001q3-KK for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:49 -0400 Received: by mail-wr1-x42e.google.com with SMTP id m9so13710840wrb.1 for ; Mon, 13 Sep 2021 02:54:44 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:43 -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=F+tOIS44awXR5yx0CVgSMzZ11FU347XCqr0ZLojmfiM=; b=JzIG3PDAodo95EfbQpz3FTxnJoJHthvKIa83sSxdb5aDocx/on3dj4EnF8CPb34CwK ATFN8g/DPNwrDS9TjoP0xnfsmtrR884jrEgQA+bBJ/jHQENgRqyluDfmZiDamP1/iCuV dWFIhJ7lRB/SeXOq0rc6ziQ9h7sVXD64r3WK0UP6C4MdUJ7yOkASPYCC0MGca6WTfs0S HaoHNBVYkV1ky4Bpkfv6KQkbGvxPuxvdVhSMGBn67SfHxgZdqTIYVSAwBj72NKqpRGVb /PiGvihYNwZJL2BTT2NSq4DTZv5n/gud8KNLP5J7M5NY0Ac21fx3MDDcqxWDhpFL/Qn3 vXtQ== 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=F+tOIS44awXR5yx0CVgSMzZ11FU347XCqr0ZLojmfiM=; b=AzeWefH0uz5Y90W1IAD5iPtqV9NmbhTUsU3kq4s1H4i1jOClLeqX3nZcaaSJXKa5KW htbdWEOQQ/NCj5HsaYBGCV2EilxK9lEVMubnw9n/P7etYgamZtZ6/CGicylmp6/eJk9y J34DPjK23qnkoBFDSqBMD1ib4Ci51Jznx1Im2SOgB3GvSaZpiRRq21i3B5f+uCZtAwEt TTKsbZJt+P6T1WHWgsU3xwQ6h8A5y3mE9D66+EoYhbcI8gWZQKb5KcN1ACXkpiZVlhDK YGRij1LUMQLnNaWzps6Nr80h57Jbtm6A1zGGfdUV9GQf6DPGUqokVuGknSNeA0NzBxK1 HhMw== X-Gm-Message-State: AOAM531xIJW2oI3iRrOzloL57qDHQca4TJZXVNlseD4Gwm7rzl6KKKpK qoHRPbj24na4X/KOEWoip9Z9Z3lf6JLRVw== X-Google-Smtp-Source: ABdhPJybrYDKus1OgcrcnBgx3tBYF4Dm/e5sqDfvc0Q8JG6e+bYoksglZDdllr54X5v8MEVKefBfuw== X-Received: by 2002:adf:d216:: with SMTP id j22mr11773359wrh.295.1631526883242; Mon, 13 Sep 2021 02:54:43 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 01/12] target/arm: Avoid goto_tb if we're trying to exit to the main loop Date: Mon, 13 Sep 2021 10:54:29 +0100 Message-Id: <20210913095440.13462-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-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::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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=unavailable 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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527143704100002 Content-Type: text/plain; charset="utf-8" Currently gen_jmp_tb() assumes that if it is called then the jump it is handling is the only reason that we might be trying to end the TB, so it will use goto_tb if it can. This is usually the case: mostly "we did something that means we must end the TB" happens on a non-branch instruction. However, there are cases where we decide early in handling an instruction that we need to end the TB and return to the main loop, and then the insn is a complex one that involves gen_jmp_tb(). For instance, for M-profile FP instructions, in gen_preserve_fp_state() which is called from vfp_access_check() we want to force an exit to the main loop if lazy state preservation is active and we are in icount mode. Make gen_jmp_tb() look at the current value of is_jmp, and only use goto_tb if the previous is_jmp was DISAS_NEXT or DISAS_TOO_MANY. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 24b7f49d767..3d1ff8ba951 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -2610,8 +2610,40 @@ static inline void gen_jmp_tb(DisasContext *s, uint3= 2_t dest, int tbno) /* An indirect jump so that we still trigger the debug exception. = */ gen_set_pc_im(s, dest); s->base.is_jmp =3D DISAS_JUMP; - } else { + return; + } + switch (s->base.is_jmp) { + case DISAS_NEXT: + case DISAS_TOO_MANY: + case DISAS_NORETURN: + /* + * The normal case: just go to the destination TB. + * NB: NORETURN happens if we generate code like + * gen_brcondi(l); + * gen_jmp(); + * gen_set_label(l); + * gen_jmp(); + * on the second call to gen_jmp(). + */ gen_goto_tb(s, tbno, dest); + break; + case DISAS_UPDATE_NOCHAIN: + case DISAS_UPDATE_EXIT: + /* + * We already decided we're leaving the TB for some other reason. + * Avoid using goto_tb so we really do exit back to the main loop + * and don't chain to another TB. + */ + gen_set_pc_im(s, dest); + gen_goto_ptr(); + s->base.is_jmp =3D DISAS_NORETURN; + break; + default: + /* + * We shouldn't be emitting code for a jump and also have + * is_jmp set to one of the special cases like DISAS_SWI. + */ + g_assert_not_reached(); } } =20 --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527736; cv=none; d=zohomail.com; s=zohoarc; b=jTrSMzwNVRr2hPMBluGwIO9WMpoh8sJpvBXJLzhhjAXIDfRfIzi1dBR2GHOsMJ5RST0yRSStAFic6EZKMq87s5iR/NKqAd1tJQ7h7TusNv1Q9ds4B8kxPfbyye4BAIf5i7RNVHMUSi+dL5tUGMZwkQQVlXoT1aF6xCC5dS3mKfM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527736; h=Content-Transfer-Encoding:Cc: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=jxk3ue8j1WrvxC+M7fUY505W445uGju5w3RgNRmMwPM=; b=MVOZcsICuG8ED2aOp0OlyeZ8ZXSH5Rrex+sycMz2PibqRvi4+9ZRdTMKyF2binGZb3D2anl05iM2sFk6ceJSdaBRyjpof1XvN1dnjSH2RFts70cnkmcg1KKkP7e3XgmElorE3A8Tx/xzT5BtkLscWB0y/km9C+L3GaSkB+ZsQKs= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631527736165369.3475567241577; Mon, 13 Sep 2021 03:08:56 -0700 (PDT) Received: from localhost ([::1]:48136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPitT-0001t2-3b for importer@patchew.org; Mon, 13 Sep 2021 06:08:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPifq-00078Z-BT for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:50 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:41813) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifl-0001r3-7F for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:48 -0400 Received: by mail-wm1-x331.google.com with SMTP id g19-20020a1c9d13000000b003075062d4daso991257wme.0 for ; Mon, 13 Sep 2021 02:54:44 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:43 -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=jxk3ue8j1WrvxC+M7fUY505W445uGju5w3RgNRmMwPM=; b=iZjrwq8iq+1dDlWPQUUp4J1hTSQyUB+PPBj9QQEW5nMA9yxScNQIPr7dMbDL64T9Br DKEQ97ScI5sMxxVPRlRryIWXroHgDqkDXKL7RvpgRQrBibtNjiJO9fE/QNx/x9vYfb6r STtJZZUDfgg6v1BGAXX1vsXHfMeJbt4CYynQd8ec56gDBPZF3Iz6WwpKCrDWOJtRjmrR jZI00O/n8gGWYs8hHC5zY/VA+WPNcRvK+i6YObvzgwwbow7UfhOgikvsSrrOJDxMdQom 9nOOb59E++qaMDm9Fce04SZ3ODOf1P2hXB+4eSjPLS8L9kTTN1CtBDZcqVIOBdC4Gyih uX2A== 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=jxk3ue8j1WrvxC+M7fUY505W445uGju5w3RgNRmMwPM=; b=VhOVM7fGa4ZtJyUxojhnUQbhDE0OTcfaDLLq5LGTAKxMfAPPTggu3OJqSQl0C9nMOd Vt2CYpesU68kIDeE3mCckt1eNr3XULA3wokS26TY7z/NK9+2oN+Za3CmGQKSTMQqqaJj cYTVjk3prDCghEOHeRpM+NpJNQKmIirxl8Cll31Wv/kOGCrfc/GmFQvLUnRrPD6rx+h/ frXApFQzq60gYkdwBl7jNEXRh4snfZfzDJe6F4PwryfkzhrP1tWsApstLhzXo+2vooQm ktHkifu/6zopiGWdSlpOufeY/ivmyPVUFBf62CLOQaqZEXbCk7xXQPeBqVzSXqMphvIE AxfQ== X-Gm-Message-State: AOAM533qs3XD6A5H1CGgtYjHoVjXbcRjG/6zClBLnpxsiGRvkuE6BEi6 giQepu2MG9R1mKBGWNPXeWaWlThqmP4Y9A== X-Google-Smtp-Source: ABdhPJwwkJdWBI/fH8AnuSmcYqvFGSxBH0AdM/XZuPYN/AumPttdnLS1jDjQ36T/DI1EfO4cniRJmw== X-Received: by 2002:a05:600c:281:: with SMTP id 1mr10111903wmk.151.1631526883871; Mon, 13 Sep 2021 02:54:43 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 02/12] target/arm: Enforce that FPDSCR.LTPSIZE is 4 on inbound migration Date: Mon, 13 Sep 2021 10:54:30 +0100 Message-Id: <20210913095440.13462-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-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::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527738273100001 Content-Type: text/plain; charset="utf-8" Architecturally, for an M-profile CPU with the LOB feature the LTPSIZE field in FPDSCR is always constant 4. QEMU's implementation enforces this everywhere, except that we don't check that it is true in incoming migration data. We're going to add come in gen_update_fp_context() which relies on the "always 4" property. Since this is TCG-only, we don't actually need to be robust to bogus incoming migration data, and the effect of it being wrong would be wrong code generation rather than a QEMU crash; but if it did ever happen somehow it would be very difficult to track down the cause. Add a check so that we fail the inbound migration if the FPDSCR.LTPSIZE value is incorrect. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/machine.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target/arm/machine.c b/target/arm/machine.c index 81e30de8243..c74d8c3f4b3 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -781,6 +781,19 @@ static int cpu_post_load(void *opaque, int version_id) hw_breakpoint_update_all(cpu); hw_watchpoint_update_all(cpu); =20 + /* + * TCG gen_update_fp_context() relies on the invariant that + * FPDSCR.LTPSIZE is constant 4 for M-profile with the LOB extension; + * forbid bogus incoming data with some other value. + */ + if (arm_feature(env, ARM_FEATURE_M) && cpu_isar_feature(aa32_lob, cpu)= ) { + if (extract32(env->v7m.fpdscr[M_REG_NS], + FPCR_LTPSIZE_SHIFT, FPCR_LTPSIZE_LENGTH) !=3D 4 || + extract32(env->v7m.fpdscr[M_REG_S], + FPCR_LTPSIZE_SHIFT, FPCR_LTPSIZE_LENGTH) !=3D 4) { + return -1; + } + } if (!kvm_enabled()) { pmu_op_finish(&cpu->env); } --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527486; cv=none; d=zohomail.com; s=zohoarc; b=EXSheqdvLfNLEUsO0Y6hvm829azVC//p9pHVT2I0DBz5KpYOes97w4tp0j9eI0GQVzyqiOw/xLRHYuZDMb6ZxYf36Jeme06AqfgmksjhpbDE6ujp6g/DOpUIoC2YPX0ZnSOIgDbMvpDssNhuSMlu5MY1FSjPLlahn1vaaM0U6gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527486; h=Content-Transfer-Encoding:Cc: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=wdKuKhvstPpd89dW4hhsxGes6H2FSQ0P7XNiWFH2WBQ=; b=lMNM97fM1ob/8Eq6cFZMofYSHIdW728UzaJ1pibXweUk0ilyTuLQQBttz6efHYkJqfyU3Y9AyruVRnahphwHbzn+KXOfhPcTaAIztrDhfJJ1J4efw7js5ahr15KMitt7WrB+fTJD+LQ10vvhkZHClDcy96No3S5GwxaIlF68jkc= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631527486224800.8733794689514; Mon, 13 Sep 2021 03:04:46 -0700 (PDT) Received: from localhost ([::1]:39598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPipR-0004RZ-2L for importer@patchew.org; Mon, 13 Sep 2021 06:04:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPifq-0007Aw-5J for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:50 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:37405) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifm-0001s3-LF for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:49 -0400 Received: by mail-wm1-x329.google.com with SMTP id c8-20020a7bc008000000b002e6e462e95fso6463012wmb.2 for ; Mon, 13 Sep 2021 02:54:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:44 -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=wdKuKhvstPpd89dW4hhsxGes6H2FSQ0P7XNiWFH2WBQ=; b=XW4KAgADdgIM6pcPzzQEXduR1TyJX0YyyKUQu8TaAt/e/LzTNYGIskvDn4NPPVK5RO X+fbibFL3va0SPVENn/abxek5p5ALz1G6FiQ0RbKVEfam9c5flLVJ7DcfIKRfMNFWO+l u5bulpWhALNrtJsR4TSXtAGJJxomxev06Gnt0WFuZxAKGjAGIYqEF8GaN/Pu7MtN5ku3 p2oINZi6MDsORfnRaGIYFtIwCX4el9EdISjx1GSomZCxPFKNpeJT24UhRvdBJX5as+gB 3j74FtVYlgpzkgoqnLMTchoHSca7AWaxY0J0Eh2pGPeWQ6CVw66QbFBYqVGM7iMzw4o3 Te6g== 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=wdKuKhvstPpd89dW4hhsxGes6H2FSQ0P7XNiWFH2WBQ=; b=kdC+kukCiNufRFnrjmtaiwxvEyTpGIJHfYEp8rF4YKhYz4YqmtnQtN/0B8TUI+WbZq +eAdKbJbjJhAi4om0r7zMUIMY6fFOi7c4F+ONwBRkSZaKTcaLpJJcZI+vFU6rP7TIZ8I Rx2iVqn1ArM8kEXG3f98TZMe/xIc86c6h23Acc6kj1F7Ct65Ob+2EY6qJUbQ8E/EhjcQ cqXDbOlGjckQPybIcs/kx8Umm5xSm+RZEA31M009F/6t5OpmGlhwX1s+PQsDs3kEvy2M CfhnnTKFf+/GfLj912cA7uULGO+rTiNNI1YdHveKyI17NkJx8nRkRh+6dGT1sYpXjRG8 FnDg== X-Gm-Message-State: AOAM533nQux0FiOKdgDGOTz9vUXWnTwisRe5JmpeeBTtHkRpWqHhycun E9kxk5jqpsoxE4ZYrb4fRtKYow== X-Google-Smtp-Source: ABdhPJxLkjE+W/KZiZ4ldkwBhNl22kcXfV/XFhifYMFVffZ6nxN6X7Wfjn7sQh6d/RliJqNQ+faOnA== X-Received: by 2002:a05:600c:219:: with SMTP id 25mr10067581wmi.157.1631526884900; Mon, 13 Sep 2021 02:54:44 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 03/12] target/arm: Add TB flag for "MVE insns not predicated" Date: Mon, 13 Sep 2021 10:54:31 +0100 Message-Id: <20210913095440.13462-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-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::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527488268100001 Content-Type: text/plain; charset="utf-8" Our current codegen for MVE always calls out to helper functions, because some byte lanes might be predicated. The common case is that in fact there is no predication active and all lanes should be updated together, so we can produce better code by detecting that and using the TCG generic vector infrastructure. Add a TB flag that is set when we can guarantee that there is no active MVE predication, and a bool in the DisasContext. Subsequent patches will use this flag to generate improved code for some instructions. In most cases when the predication state changes we simply end the TB after that instruction. For the code called from vfp_access_check() that handles lazy state preservation and creating a new FP context, we can usually avoid having to try to end the TB because luckily the new value of the flag following the register changes in those sequences doesn't depend on any runtime decisions. We do have to end the TB if the guest has enabled lazy FP state preservation but not automatic state preservation, but this is an odd corner case that is not going to be common in real-world code. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- I renamed the mve_no_predication() function to mve_no_pred() because I want to use the former name in patch 2 for the translate-time "no predication of any kind including ECI", and wanted to distinguish it from this function that is just determining the value of the TB flag bit. Better naming suggestions welcome. --- target/arm/cpu.h | 4 +++- target/arm/translate.h | 2 ++ target/arm/helper.c | 33 +++++++++++++++++++++++++++++++++ target/arm/translate-m-nocp.c | 8 +++++++- target/arm/translate-mve.c | 13 ++++++++++++- target/arm/translate-vfp.c | 33 +++++++++++++++++++++++++++------ target/arm/translate.c | 8 ++++++++ 7 files changed, 92 insertions(+), 9 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 6a987f65e41..a235d21c233 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3440,7 +3440,7 @@ typedef ARMCPU ArchCPU; * | TBFLAG_AM32 | +-----+----------+ * | | |TBFLAG_M32| * +-------------+----------------+----------+ - * 31 23 5 4 0 + * 31 23 6 5 0 * * Unless otherwise noted, these bits are cached in env->hflags. */ @@ -3497,6 +3497,8 @@ FIELD(TBFLAG_M32, LSPACT, 2, 1) /* No= t cached. */ FIELD(TBFLAG_M32, NEW_FP_CTXT_NEEDED, 3, 1) /* Not cached. */ /* Set if FPCCR.S does not match current security state */ FIELD(TBFLAG_M32, FPCCR_S_WRONG, 4, 1) /* Not cached. */ +/* Set if MVE insns are definitely not predicated by VPR or LTPSIZE */ +FIELD(TBFLAG_M32, MVE_NO_PRED, 5, 1) /* Not cached. */ =20 /* * Bit usage when in AArch64 state diff --git a/target/arm/translate.h b/target/arm/translate.h index 8636c20c3b4..f3cc820d071 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -98,6 +98,8 @@ typedef struct DisasContext { bool hstr_active; /* True if memory operations require alignment */ bool align_mem; + /* True if MVE insns are definitely not predicated by VPR or LTPSIZE */ + bool mve_no_pred; /* * >=3D 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. * < 0, set by the current instruction. diff --git a/target/arm/helper.c b/target/arm/helper.c index a7ae78146d4..6f8cf67d895 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -13673,6 +13673,35 @@ static inline void assert_hflags_rebuild_correctly= (CPUARMState *env) #endif } =20 +static bool mve_no_pred(CPUARMState *env) +{ + /* + * Return true if there is definitely no predication of MVE + * instructions by VPR or LTPSIZE. (Returning false even if there + * isn't any predication is OK; generated code will just be + * a little worse.) + * If the CPU does not implement MVE then this TB flag is always 0. + * + * NOTE: if you change this logic, the "recalculate s->mve_no_pred" + * logic in gen_update_fp_context() needs to be updated to match. + * + * We do not include the effect of the ECI bits here -- they are + * tracked in other TB flags. This simplifies the logic for + * "when did we emit code that changes the MVE_NO_PRED TB flag + * and thus need to end the TB?". + */ + if (cpu_isar_feature(aa32_mve, env_archcpu(env))) { + return false; + } + if (env->v7m.vpr) { + return false; + } + if (env->v7m.ltpsize < 4) { + return false; + } + return true; +} + void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { @@ -13712,6 +13741,10 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) { DP_TBFLAG_M32(flags, LSPACT, 1); } + + if (mve_no_pred(env)) { + DP_TBFLAG_M32(flags, MVE_NO_PRED, 1); + } } else { /* * Note that XSCALE_CPAR shares bits with VECSTRIDE. diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c index 5eab04832cd..d9e144e8eb3 100644 --- a/target/arm/translate-m-nocp.c +++ b/target/arm/translate-m-nocp.c @@ -95,7 +95,10 @@ static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM= _VLSTM *a) =20 clear_eci_state(s); =20 - /* End the TB, because we have updated FP control bits */ + /* + * End the TB, because we have updated FP control bits, + * and possibly VPR or LTPSIZE. + */ s->base.is_jmp =3D DISAS_UPDATE_EXIT; return true; } @@ -397,6 +400,7 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int = regno, store_cpu_field(control, v7m.control[M_REG_S]); tcg_gen_andi_i32(tmp, tmp, ~FPCR_NZCV_MASK); gen_helper_vfp_set_fpscr(cpu_env, tmp); + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; tcg_temp_free_i32(tmp); tcg_temp_free_i32(sfpa); break; @@ -409,6 +413,7 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int = regno, } tmp =3D loadfn(s, opaque, true); store_cpu_field(tmp, v7m.vpr); + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; break; case ARM_VFP_P0: { @@ -418,6 +423,7 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int = regno, tcg_gen_deposit_i32(vpr, vpr, tmp, R_V7M_VPR_P0_SHIFT, R_V7M_VPR_P0_LENGTH); store_cpu_field(vpr, v7m.vpr); + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; tcg_temp_free_i32(tmp); break; } diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 2ed91577ec8..0eca96e29cf 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -810,7 +810,12 @@ DO_LOGIC(VORR, gen_helper_mve_vorr) DO_LOGIC(VORN, gen_helper_mve_vorn) DO_LOGIC(VEOR, gen_helper_mve_veor) =20 -DO_LOGIC(VPSEL, gen_helper_mve_vpsel) +static bool trans_VPSEL(DisasContext *s, arg_2op *a) +{ + /* This insn updates predication bits */ + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; + return do_2op(s, a, gen_helper_mve_vpsel); +} =20 #define DO_2OP(INSN, FN) \ static bool trans_##INSN(DisasContext *s, arg_2op *a) \ @@ -1366,6 +1371,8 @@ static bool trans_VPNOT(DisasContext *s, arg_VPNOT *a) } =20 gen_helper_mve_vpnot(cpu_env); + /* This insn updates predication bits */ + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; mve_update_eci(s); return true; } @@ -1852,6 +1859,8 @@ static bool do_vcmp(DisasContext *s, arg_vcmp *a, MVE= GenCmpFn *fn) /* VPT */ gen_vpst(s, a->mask); } + /* This insn updates predication bits */ + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; mve_update_eci(s); return true; } @@ -1883,6 +1892,8 @@ static bool do_vcmp_scalar(DisasContext *s, arg_vcmp_= scalar *a, /* VPT */ gen_vpst(s, a->mask); } + /* This insn updates predication bits */ + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; mve_update_eci(s); return true; } diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index e2eb797c829..59bcaec5beb 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -109,7 +109,7 @@ static inline long vfp_f16_offset(unsigned reg, bool to= p) * Generate code for M-profile lazy FP state preservation if needed; * this corresponds to the pseudocode PreserveFPState() function. */ -static void gen_preserve_fp_state(DisasContext *s) +static void gen_preserve_fp_state(DisasContext *s, bool skip_context_updat= e) { if (s->v7m_lspact) { /* @@ -128,6 +128,20 @@ static void gen_preserve_fp_state(DisasContext *s) * any further FP insns in this TB. */ s->v7m_lspact =3D false; + /* + * The helper might have zeroed VPR, so we do not know the + * correct value for the MVE_NO_PRED TB flag any more. + * If we're about to create a new fp context then that + * will precisely determine the MVE_NO_PRED value (see + * gen_update_fp_context()). Otherwise, we must: + * - set s->mve_no_pred to false, so this instruction + * is generated to use helper functions + * - end the TB now, without chaining to the next TB + */ + if (skip_context_update || !s->v7m_new_fp_ctxt_needed) { + s->mve_no_pred =3D false; + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; + } } } =20 @@ -169,12 +183,19 @@ static void gen_update_fp_context(DisasContext *s) TCGv_i32 z32 =3D tcg_const_i32(0); store_cpu_field(z32, v7m.vpr); } - /* - * We don't need to arrange to end the TB, because the only - * parts of FPSCR which we cache in the TB flags are the VECLEN - * and VECSTRIDE, and those don't exist for M-profile. + * We just updated the FPSCR and VPR. Some of this state is cached + * in the MVE_NO_PRED TB flag. We want to avoid having to end the + * TB here, which means we need the new value of the MVE_NO_PRED + * flag to be exactly known here and the same for all executions. + * Luckily FPDSCR.LTPSIZE is always constant 4 and the VPR is + * always set to 0, so the new MVE_NO_PRED flag is always 1 + * if and only if we have MVE. + * + * (The other FPSCR state cached in TB flags is VECLEN and VECSTRI= DE, + * but those do not exist for M-profile, so are not relevant here.) */ + s->mve_no_pred =3D dc_isar_feature(aa32_mve, s); =20 if (s->v8m_secure) { bits |=3D R_V7M_CONTROL_SFPA_MASK; @@ -238,7 +259,7 @@ bool vfp_access_check_m(DisasContext *s, bool skip_cont= ext_update) /* Handle M-profile lazy FP state mechanics */ =20 /* Trigger lazy-state preservation if necessary */ - gen_preserve_fp_state(s); + gen_preserve_fp_state(s, skip_context_update); =20 if (!skip_context_update) { /* Update ownership of FP context and create new FP context if nee= ded */ diff --git a/target/arm/translate.c b/target/arm/translate.c index 3d1ff8ba951..3a59de208d5 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8496,6 +8496,7 @@ static bool trans_DLS(DisasContext *s, arg_DLS *a) /* DLSTP: set FPSCR.LTPSIZE */ tmp =3D tcg_const_i32(a->size); store_cpu_field(tmp, v7m.ltpsize); + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; } return true; } @@ -8561,6 +8562,10 @@ static bool trans_WLS(DisasContext *s, arg_WLS *a) assert(ok); tmp =3D tcg_const_i32(a->size); store_cpu_field(tmp, v7m.ltpsize); + /* + * LTPSIZE updated, but MVE_NO_PRED will always be the same thing = (0) + * when we take this upcoming exit from this TB, so gen_jmp_tb() i= s OK. + */ } gen_jmp_tb(s, s->base.pc_next, 1); =20 @@ -8743,6 +8748,8 @@ static bool trans_VCTP(DisasContext *s, arg_VCTP *a) gen_helper_mve_vctp(cpu_env, masklen); tcg_temp_free_i32(masklen); tcg_temp_free_i32(rn_shifted); + /* This insn updates predication bits */ + s->base.is_jmp =3D DISAS_UPDATE_NOCHAIN; mve_update_eci(s); return true; } @@ -9402,6 +9409,7 @@ static void arm_tr_init_disas_context(DisasContextBas= e *dcbase, CPUState *cs) dc->v7m_new_fp_ctxt_needed =3D EX_TBFLAG_M32(tb_flags, NEW_FP_CTXT_NEEDED); dc->v7m_lspact =3D EX_TBFLAG_M32(tb_flags, LSPACT); + dc->mve_no_pred =3D EX_TBFLAG_M32(tb_flags, MVE_NO_PRED); } else { dc->debug_target_el =3D EX_TBFLAG_ANY(tb_flags, DEBUG_TARGET_EL); dc->sctlr_b =3D EX_TBFLAG_A32(tb_flags, SCTLR__B); --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527620; cv=none; d=zohomail.com; s=zohoarc; b=WSSlE8WzsADDygR67Lug2uxxkMBvu6CVloB2pA/e7ekUcMiEId2Ixlx+QhQKoT0H/J2Q2g/IOQYM6KT6Y/HfHNKTq/F2n2Vomoh4HQ8/CDBDkvg678cKrYbSddPtbfUNZ3llP2ByvC26IRP9E3Ms3IA8sxmN3JqOqhQG0JAeexU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527620; h=Content-Type:Content-Transfer-Encoding:Cc: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=JC4vSsgRJG98HE/fQrzJfWYreBbSmRKMA++s1R3fyBA=; b=GXwj89snyo2RUz8rFGApBvnGT7BAOS1yXsAA8fyNSdSL0myLMaID+uKWbOEb9ELmqc6ChWYhPRNazMMwiuJ1mjMiRV/6SVq0aAN34k0PrKRUHDqS1J4TBmXbfrFL8apyuGY60oXAtvhubWWMuUSE0Lgp02o5QWKZoes6SZqgxlo= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631527620765564.3955000794458; Mon, 13 Sep 2021 03:07:00 -0700 (PDT) Received: from localhost ([::1]:43620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPirb-0007Dw-OW for importer@patchew.org; Mon, 13 Sep 2021 06:06:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPift-0007KP-3J for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:53 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:36688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifp-0001sD-5M for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:52 -0400 Received: by mail-wr1-x430.google.com with SMTP id g16so13725390wrb.3 for ; Mon, 13 Sep 2021 02:54:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:45 -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=JC4vSsgRJG98HE/fQrzJfWYreBbSmRKMA++s1R3fyBA=; b=P1xfNYtdDUUUnfklfMmYa4pISsjDOMRaGQN7x+32BnKCAhuyPoQ5rXfeELQZNSSvts yZ3KlCdjR5Y/Q1Mt4yQQtFcqJVX9TJnddS75uykcc/olwBmby3bk+ggyKysIeIwKsesd Ko1pk5IVzSmhaC4jmNAgL0SEkcRkoG75W59Fkfu5CuHD7vUac+iS1TkhHLRW+63IE1Tw wU9d6DL96HXumRs5vA+enoVB6L0a2l49wYZHNRopBiaPS4F/yMY+7I+9IxEJRTHW1uXi RD3lzjWwlP0kzwS4PvmG8LF3U54bjfBxS1n00BRfyDFoAfYN1m8P7is8YYlpHWEyHtdQ 2W/w== 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=JC4vSsgRJG98HE/fQrzJfWYreBbSmRKMA++s1R3fyBA=; b=aDou/gG25neMQFx0KdRkGxdXxjpAUgzujbHQyfCnJ71UXnNW54FyPxMr9BnO+wS8AU GiX/BcgOlwDow1RNcNqivEFgdcxgmQLk7jgw0123o2+PhI5KBR+gcHjhiJf1d91Gc1En 7TxrF4G1bmhK/TxuL1HI3bdqUFZGlArIUq9/PqxIiekBEgytENAzVgdNiakGuME5nffZ rNgzH8rjVaQW3KDDO/yDDQqzfLxNIlfgQGd1qdxPH6ALdILmwjdjLlT6/LeRgYlQ8Xol hjeVA0k74VouOKwFVaKjuBC5DOzvQfoGvXI06UQbmjQx39Mgx6ru+8pQw1GYRhNmoUie CBmg== X-Gm-Message-State: AOAM5314DxtVLFQqaXE1Iqq9wfXFCG2n/JonmeTPt6x2+XlcDR3Pyp5o 7fKP4EFpH0fdoAz2e+9A+mih/w== X-Google-Smtp-Source: ABdhPJw8u4EYoY7B5JSLn3U/rrDyyEQxfjmjfseZTBAZU6NgY9pb8bBDsDiyCLmH46FVu4DO9lXNcw== X-Received: by 2002:adf:fb07:: with SMTP id c7mr11255044wrr.399.1631526885613; Mon, 13 Sep 2021 02:54:45 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 04/12] target/arm: Optimize MVE logic ops Date: Mon, 13 Sep 2021 10:54:32 +0100 Message-Id: <20210913095440.13462-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527621486100001 When not predicating, implement the MVE bitwise logical insns directly using TCG vector operations. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- v1->v2: new mve_no_predication() function --- target/arm/translate-mve.c | 51 +++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 0eca96e29cf..77b9f0db334 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -64,6 +64,16 @@ static TCGv_ptr mve_qreg_ptr(unsigned reg) return ret; } =20 +static bool mve_no_predication(DisasContext *s) +{ + /* + * Return true if we are executing the entire MVE instruction + * with no predication or partial-execution, and so we can safely + * use an inline TCG vector implementation. + */ + return s->eci =3D=3D 0 && s->mve_no_pred; +} + static bool mve_check_qreg_bank(DisasContext *s, int qmask) { /* @@ -774,7 +784,8 @@ static bool trans_VNEG_fp(DisasContext *s, arg_1op *a) return do_1op(s, a, fns[a->size]); } =20 -static bool do_2op(DisasContext *s, arg_2op *a, MVEGenTwoOpFn fn) +static bool do_2op_vec(DisasContext *s, arg_2op *a, MVEGenTwoOpFn fn, + GVecGen3Fn *vecfn) { TCGv_ptr qd, qn, qm; =20 @@ -787,28 +798,38 @@ static bool do_2op(DisasContext *s, arg_2op *a, MVEGe= nTwoOpFn fn) return true; } =20 - qd =3D mve_qreg_ptr(a->qd); - qn =3D mve_qreg_ptr(a->qn); - qm =3D mve_qreg_ptr(a->qm); - fn(cpu_env, qd, qn, qm); - tcg_temp_free_ptr(qd); - tcg_temp_free_ptr(qn); - tcg_temp_free_ptr(qm); + if (vecfn && mve_no_predication(s)) { + vecfn(a->size, mve_qreg_offset(a->qd), mve_qreg_offset(a->qn), + mve_qreg_offset(a->qm), 16, 16); + } else { + qd =3D mve_qreg_ptr(a->qd); + qn =3D mve_qreg_ptr(a->qn); + qm =3D mve_qreg_ptr(a->qm); + fn(cpu_env, qd, qn, qm); + tcg_temp_free_ptr(qd); + tcg_temp_free_ptr(qn); + tcg_temp_free_ptr(qm); + } mve_update_eci(s); return true; } =20 -#define DO_LOGIC(INSN, HELPER) \ +static bool do_2op(DisasContext *s, arg_2op *a, MVEGenTwoOpFn *fn) +{ + return do_2op_vec(s, a, fn, NULL); +} + +#define DO_LOGIC(INSN, HELPER, VECFN) \ static bool trans_##INSN(DisasContext *s, arg_2op *a) \ { \ - return do_2op(s, a, HELPER); \ + return do_2op_vec(s, a, HELPER, VECFN); \ } =20 -DO_LOGIC(VAND, gen_helper_mve_vand) -DO_LOGIC(VBIC, gen_helper_mve_vbic) -DO_LOGIC(VORR, gen_helper_mve_vorr) -DO_LOGIC(VORN, gen_helper_mve_vorn) -DO_LOGIC(VEOR, gen_helper_mve_veor) +DO_LOGIC(VAND, gen_helper_mve_vand, tcg_gen_gvec_and) +DO_LOGIC(VBIC, gen_helper_mve_vbic, tcg_gen_gvec_andc) +DO_LOGIC(VORR, gen_helper_mve_vorr, tcg_gen_gvec_or) +DO_LOGIC(VORN, gen_helper_mve_vorn, tcg_gen_gvec_orc) +DO_LOGIC(VEOR, gen_helper_mve_veor, tcg_gen_gvec_xor) =20 static bool trans_VPSEL(DisasContext *s, arg_2op *a) { --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527727; cv=none; d=zohomail.com; s=zohoarc; b=BRqRRe68+v5aVnUgDlUtQqrdhdG8qTUyJKJDHSXJpFlyCrSJxuOYT2Ve1kQQg67SLAKzqSp0OP0o92NKvauLngSfIE5wKhcJYR00yCB5+sRIwX8esFC+HrAvQP1tfUUTueQKAbovSgm6x1HuOVIy4HB1kU8DV7VhKXqRo0xHoJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527727; h=Content-Type:Content-Transfer-Encoding:Cc: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=zir4X0mMBHe1fXRJ/2xzGzZwDp6YizXAS8FXTu1+ZDc=; b=bXdzDxyM3uW8fXBO6zs9sGgR6tmiaW6SInYyPWa21L+3uMcNoP8jHSl04rVgV4sI0l7dBJZ3PMdLrXF0S17yuC4QDL4kQOVVkr5Fs4qEJIiY38sXnLpa7/iCy7uVi2DZ19Ivx8M9y+ZHkzeZqfrluZXMxh7YK+Faks4hMjFRZ1I= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631527727246683.4135157933897; Mon, 13 Sep 2021 03:08:47 -0700 (PDT) Received: from localhost ([::1]:47368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPitK-0001N7-4S for importer@patchew.org; Mon, 13 Sep 2021 06:08:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPifv-0007R5-4r for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:55 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:44609) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifn-0001sg-OM for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:54 -0400 Received: by mail-wr1-x432.google.com with SMTP id d6so13665355wrc.11 for ; Mon, 13 Sep 2021 02:54:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:46 -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=zir4X0mMBHe1fXRJ/2xzGzZwDp6YizXAS8FXTu1+ZDc=; b=BRfK0I+Rujz3EMKYKGnthHaUPJYBEEMMO+rHWn+0FPQfFOVQgOZt9P1dLDnb9rMdy7 U9hmaA08tcXshFCs1jCqOcmSshByZdzMPRFv1e1+hw3STCD9W/qJgz1m/fmYGWSjsbtj CD+/+tjKJnSl9fMLfgT2pWsA9vBk88YoQNvLEf3xY29JxOA9GivqVlFVkYTp3r4UVOe+ FQ1ZGY9FLQ0du5TsfW0ZwPslnBT/ChGnhTPNVHS5mnQfiM5zX9PDdIjPF0qrNDMBSMOU Ci06oXTGHWLqEgPYXlAGkChfCfhLpTScUbsKjuST3JloR+MJsXYiPaV18Nl3Nt+GOsSw vuBQ== 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=zir4X0mMBHe1fXRJ/2xzGzZwDp6YizXAS8FXTu1+ZDc=; b=oexpYISn/qQJQBdwgfbEDgfFdf/PuanXBm09FCQFguGgsB7nbpBxzOQGHEx9KbUxd+ TRrMC4B1JGhjU2nC6fG+IV6vfjb8N9dsweSea97hRtVgt5dJ9RNRozrvFoec6EAGdx3W ybTrlNKB9+vxnR26XTFmXCVn1m7omK0vVeziF+qkvbi9utXo0d/wi8mbygaGgTDyZdjl Cs8CIVjbCucWPD4RAANHRGGWWj5NddD49fChz+pr78YkQ3SlNP4VkqWSpfohPhJWQbvp oAIEg4mod0S4a/KHYR4WUbleeBdqHbgrV3U2ocfXhB76uLJcxoyAz00eIthChyfrfOXG jZfA== X-Gm-Message-State: AOAM532+AfYn9vQDZlRzcw9jtW29DNi87nGBJJrvRN4XH/gqeQHiN2sK E2C1byOnnNxnyN/EoxKUIfVg+A== X-Google-Smtp-Source: ABdhPJwCYBmMBrhTpCdXuUtw2uuViXVBUxCuYbKCzhzKR68HBO7tqx7r1dvsCB/qR1RjgfwhSJppgg== X-Received: by 2002:a5d:4810:: with SMTP id l16mr11482628wrq.3.1631526886276; Mon, 13 Sep 2021 02:54:46 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 05/12] target/arm: Optimize MVE arithmetic ops Date: Mon, 13 Sep 2021 10:54:33 +0100 Message-Id: <20210913095440.13462-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527729446100001 Optimize MVE arithmetic ops when we have a TCG vector operation we can use. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/translate-mve.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 77b9f0db334..255cb860fec 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -838,7 +838,7 @@ static bool trans_VPSEL(DisasContext *s, arg_2op *a) return do_2op(s, a, gen_helper_mve_vpsel); } =20 -#define DO_2OP(INSN, FN) \ +#define DO_2OP_VEC(INSN, FN, VECFN) \ static bool trans_##INSN(DisasContext *s, arg_2op *a) \ { \ static MVEGenTwoOpFn * const fns[] =3D { \ @@ -847,20 +847,22 @@ static bool trans_VPSEL(DisasContext *s, arg_2op *a) gen_helper_mve_##FN##w, \ NULL, \ }; \ - return do_2op(s, a, fns[a->size]); \ + return do_2op_vec(s, a, fns[a->size], VECFN); \ } =20 -DO_2OP(VADD, vadd) -DO_2OP(VSUB, vsub) -DO_2OP(VMUL, vmul) +#define DO_2OP(INSN, FN) DO_2OP_VEC(INSN, FN, NULL) + +DO_2OP_VEC(VADD, vadd, tcg_gen_gvec_add) +DO_2OP_VEC(VSUB, vsub, tcg_gen_gvec_sub) +DO_2OP_VEC(VMUL, vmul, tcg_gen_gvec_mul) DO_2OP(VMULH_S, vmulhs) DO_2OP(VMULH_U, vmulhu) DO_2OP(VRMULH_S, vrmulhs) DO_2OP(VRMULH_U, vrmulhu) -DO_2OP(VMAX_S, vmaxs) -DO_2OP(VMAX_U, vmaxu) -DO_2OP(VMIN_S, vmins) -DO_2OP(VMIN_U, vminu) +DO_2OP_VEC(VMAX_S, vmaxs, tcg_gen_gvec_smax) +DO_2OP_VEC(VMAX_U, vmaxu, tcg_gen_gvec_umax) +DO_2OP_VEC(VMIN_S, vmins, tcg_gen_gvec_smin) +DO_2OP_VEC(VMIN_U, vminu, tcg_gen_gvec_umin) DO_2OP(VABD_S, vabds) DO_2OP(VABD_U, vabdu) DO_2OP(VHADD_S, vhadds) --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527428; cv=none; d=zohomail.com; s=zohoarc; b=gaZ/oW4xHnkIxc8J4CjesahQJHHlKc+i7gjm+l/aq3vxRiEQJAnMBsNrH0sTxFdGRp6Kf5zDVPmxBxGokeyFs4wK99wG4tp49WlhY0lWtcZouHVMP3GgMGDrgoI77HSNELDkw7wdqNHEdIB/xJyDoKi7WYKw9TbL7DtJ91Nv9Fg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527428; h=Content-Type:Content-Transfer-Encoding:Cc: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=MPPFBEMAEyXetbowqu2rGA84XzkvyjzYzL/hwkj6xh0=; b=LX3Y/3XTsxgKDYqaVU1qORrIFYTxP479rnG1ciu5cEMEXYqSUxsfhml8bzCcd2rbdt9AlW3otQLArCC2vU/n9ubbrXwzHyXwAB5VtH5WIOXMBq7p3y2mZ4OOi3sl6fPz7YceCORRoXSfGIzi14COtXY4HGp7aq1kMi/KjL5H7aA= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631527428014153.8355752570527; Mon, 13 Sep 2021 03:03:48 -0700 (PDT) Received: from localhost ([::1]:37744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPioU-0003Dv-NZ for importer@patchew.org; Mon, 13 Sep 2021 06:03:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPifr-0007El-D2 for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:51 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:54828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifo-0001tl-8B for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:51 -0400 Received: by mail-wm1-x329.google.com with SMTP id s24so6166353wmh.4 for ; Mon, 13 Sep 2021 02:54:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:46 -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=MPPFBEMAEyXetbowqu2rGA84XzkvyjzYzL/hwkj6xh0=; b=g/yqQ8jt9rUB05QDNocQsHw/tUugWBRveLtysQIdBTlXTm/VAqfZJJgeTjpUvsAJaS g6KoJD1puCY+sg3YDdhPvVuXT+Y5/E1/eloQpCPqczaFMBSQAX9DhHZLbl8PI34eqvci c/hFU9BfXUkyN7ygplcMwkZASyE05uyB/6ZwpXlriQlyph4732C/UmBZlRID1CX2pgY2 xE+4Bh7jmEv4ohuJUXzquW5z4LaL/Dwsr7N9zjXtDx9lZkVsw5jBM0ZnW6zJW7V/fc8W Fpzp1sL6l73MDpCb4XGjgkZRnqrzCtG+WacBRpERloKD8DNPBcVE25/3scqJUKFAHZFd M/JA== 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=MPPFBEMAEyXetbowqu2rGA84XzkvyjzYzL/hwkj6xh0=; b=DfueGBQqVkUbQ62duorJ/09l6j1PjnUoz3ZkLsUIT1TkH+U0z/RWgN+CE/7OlX68KS kQJN2VBFEo3yr6LBTUxqTw9IGrjPWpbVKfpItaJ739QyyNGbddWy2tm3cte3SX5R4XdX J6FaVhDu/u22nE9OpNJqZcnFAv7q4mjrdjlMasQ5OuyczBpGbUCn/P8Jbc71+/MqmaJC lgb8hsryUaYMQqJDI8S1qqQxGIQ4fMQyDCzq2e/1WwKCnGbhN9fx3YMgxEBgfHQ08Jkf Su1tYAvpNp9wx05lPMlIM0EG02jmA/8LqPG167BafMZdqbqnJBb7EdAZnj7zlh6/O/PP TuLw== X-Gm-Message-State: AOAM531CcsKgMQ/E8KPawTzPpqBPZZviPpP52wtWdwh82qoE8fzN/F2E bROoI3ITgD75T8aKt2E5QTR0ag== X-Google-Smtp-Source: ABdhPJwdQJ1ktZhq4L+5Alg3Cz0C6MmhYqwN8/W11Y/jhI9ueJgy2PgaPKvZiwwKL/7vJRJ+VjbnYQ== X-Received: by 2002:a1c:1f09:: with SMTP id f9mr10097119wmf.58.1631526886904; Mon, 13 Sep 2021 02:54:46 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 06/12] target/arm: Optimize MVE VNEG, VABS Date: Mon, 13 Sep 2021 10:54:34 +0100 Message-Id: <20210913095440.13462-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527430024100001 Optimize the MVE VNEG and VABS insns by using TCG vector ops when possible. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/translate-mve.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 255cb860fec..d30c7e57ea3 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -510,7 +510,8 @@ static bool trans_VDUP(DisasContext *s, arg_VDUP *a) return true; } =20 -static bool do_1op(DisasContext *s, arg_1op *a, MVEGenOneOpFn fn) +static bool do_1op_vec(DisasContext *s, arg_1op *a, MVEGenOneOpFn fn, + GVecGen2Fn vecfn) { TCGv_ptr qd, qm; =20 @@ -524,16 +525,25 @@ static bool do_1op(DisasContext *s, arg_1op *a, MVEGe= nOneOpFn fn) return true; } =20 - qd =3D mve_qreg_ptr(a->qd); - qm =3D mve_qreg_ptr(a->qm); - fn(cpu_env, qd, qm); - tcg_temp_free_ptr(qd); - tcg_temp_free_ptr(qm); + if (vecfn && mve_no_predication(s)) { + vecfn(a->size, mve_qreg_offset(a->qd), mve_qreg_offset(a->qm), 16,= 16); + } else { + qd =3D mve_qreg_ptr(a->qd); + qm =3D mve_qreg_ptr(a->qm); + fn(cpu_env, qd, qm); + tcg_temp_free_ptr(qd); + tcg_temp_free_ptr(qm); + } mve_update_eci(s); return true; } =20 -#define DO_1OP(INSN, FN) \ +static bool do_1op(DisasContext *s, arg_1op *a, MVEGenOneOpFn fn) +{ + return do_1op_vec(s, a, fn, NULL); +} + +#define DO_1OP_VEC(INSN, FN, VECFN) \ static bool trans_##INSN(DisasContext *s, arg_1op *a) \ { \ static MVEGenOneOpFn * const fns[] =3D { \ @@ -542,13 +552,15 @@ static bool do_1op(DisasContext *s, arg_1op *a, MVEGe= nOneOpFn fn) gen_helper_mve_##FN##w, \ NULL, \ }; \ - return do_1op(s, a, fns[a->size]); \ + return do_1op_vec(s, a, fns[a->size], VECFN); \ } =20 +#define DO_1OP(INSN, FN) DO_1OP_VEC(INSN, FN, NULL) + DO_1OP(VCLZ, vclz) DO_1OP(VCLS, vcls) -DO_1OP(VABS, vabs) -DO_1OP(VNEG, vneg) +DO_1OP_VEC(VABS, vabs, tcg_gen_gvec_abs) +DO_1OP_VEC(VNEG, vneg, tcg_gen_gvec_neg) DO_1OP(VQABS, vqabs) DO_1OP(VQNEG, vqneg) DO_1OP(VMAXA, vmaxa) --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527918; cv=none; d=zohomail.com; s=zohoarc; b=lVTg35RvPuZrnTlQMO+Brjgx9kBly2lkehze2GX5Qbrs/yhgMF6EDtOarD0LvARZo0v25AbpkwVEGVOsW5agayrSj6AF7gmOJJQ3EUCSyo6ACqqfPk/ravPJeE42kTuSN97UcVNNA3T1qAlzSQt4dYyEnFYiASyRGwP/SRH60vA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527918; h=Content-Transfer-Encoding:Cc: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=PsqyvwVa655omQdFIHqiDmLC7YzT5aRUDOlK0c8rs+c=; b=YFlCePK55zVbwPcS0KVi1zhhUQLS0GHp9XJkA+AkPXM0M2lVUECd4bA5sNx/rw5ineuzntK9hw1v8i4+uB2GfkhMFz1LgBF9PzygTxZUVT0vmePgLzV/eHZuZgCOKvqsYK1kATbdJUFJfWRUVndRWdFj2ZpUBIYknYMhCtZ+7tM= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631527918648816.2503024401757; Mon, 13 Sep 2021 03:11:58 -0700 (PDT) Received: from localhost ([::1]:54996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPiwP-0006VY-G9 for importer@patchew.org; Mon, 13 Sep 2021 06:11:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPifs-0007Io-KL for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:52 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:56044) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifo-0001uQ-OA for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:52 -0400 Received: by mail-wm1-x331.google.com with SMTP id g128so1737018wma.5 for ; Mon, 13 Sep 2021 02:54:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:47 -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=PsqyvwVa655omQdFIHqiDmLC7YzT5aRUDOlK0c8rs+c=; b=cEEkTQd2laaceVcbDBsnMVz7KuOGiVK1Z+EN0pjb6S4xob5tUd36jqka/iwdlyGqRa jUmvMG72mcLBGdlRwwFcOuHTUZCmnj3oCrLYhZ5Yihm9zpj/c3fMDOAWreV9GBMz87wP k1w5Hp4wqkczGpBRnjDvesErT0GNOr1Unmdc8dyYK5TVpCHwJ38PCerNRz/hESIu6a4n dnINQztDhO96iK63wDXeR8f1xcoiiW1klqSS/LzEbMzmJADgEfz7yU1q0Xwu2UrXVFL0 N9r5/1SF76LvnSAya4INQcLzTmpxP0UEm/nRJ8CC8pmPsHPjjQnNm6mQH9lgPr2gfH8R Owhw== 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=PsqyvwVa655omQdFIHqiDmLC7YzT5aRUDOlK0c8rs+c=; b=Ixqt4t3+qpWi+IsCaIx47fJIeE6y2oe6haxYLFpTUCgna8szBp0ltuIjG2J/SX/nYV OxBq8htod7SdDoPccQ0UL8vCeKhdFK/uKH+/jmnAsGYR358/GMH2bXSJ9bVITggneh4y Gac9Y8OBSKCb/4g8tZ9P22RktmTlvTBQi+qFgHjtRy8JzO9j7dAX/EcksYcnzAH6gYQq 5NRbSuWsLzoiVQtwlJYZwGtx55Pity7GiNqnaN9AmWsflzYMgtGUp0jQxojrOB/Fk17y DIp4hw/lkeYj+nRn32swWaBaMoDZ6/2Oyd1uYWU5E5F+oy2PL8ffdt6V0R1ymvnDm8Qd NCvQ== X-Gm-Message-State: AOAM5317anI0LrvFvrEe4CzIR1Qnu4VdsehoZTunr1wA0MjdxKUAgUF4 ie+4cteytXOJOg7a0Cen5ReNZGUYRxP5Yw== X-Google-Smtp-Source: ABdhPJywCsgHx6HAofFC0+1X0qjgwQmgB+o/2+IOCbVIFHhvuK6XEVkR+tCnBIvX4HMfykyK3zJfFw== X-Received: by 2002:a05:600c:3392:: with SMTP id o18mr9259153wmp.92.1631526887472; Mon, 13 Sep 2021 02:54:47 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 07/12] target/arm: Optimize MVE VDUP Date: Mon, 13 Sep 2021 10:54:35 +0100 Message-Id: <20210913095440.13462-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-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::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527920700100001 Content-Type: text/plain; charset="utf-8" Optimize the MVE VDUP insns by using TCG vector ops when possible. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-mve.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index d30c7e57ea3..13de55242e2 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -500,11 +500,15 @@ static bool trans_VDUP(DisasContext *s, arg_VDUP *a) return true; } =20 - qd =3D mve_qreg_ptr(a->qd); rt =3D load_reg(s, a->rt); - tcg_gen_dup_i32(a->size, rt, rt); - gen_helper_mve_vdup(cpu_env, qd, rt); - tcg_temp_free_ptr(qd); + if (mve_no_predication(s)) { + tcg_gen_gvec_dup_i32(a->size, mve_qreg_offset(a->qd), 16, 16, rt); + } else { + qd =3D mve_qreg_ptr(a->qd); + tcg_gen_dup_i32(a->size, rt, rt); + gen_helper_mve_vdup(cpu_env, qd, rt); + tcg_temp_free_ptr(qd); + } tcg_temp_free_i32(rt); mve_update_eci(s); return true; --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527044; cv=none; d=zohomail.com; s=zohoarc; b=V4ObxuroKeifvw7u+xDPKv5GvYNc8V+FM1W4yXGpCNG28unCKjsEv53LSeg8UBy24pUWeubfXnv93DoCsnIxEv/VGFUlaBYzUu6b6moB30fejNfo49Z5SOg/ISNpXLiobgFhZBOqxIQfgVRMZGXY4bUu6YXwQy/PC4TLVHZ3OZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527044; h=Content-Transfer-Encoding:Cc: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=yVP8w884M7PsuH2MFKMpdcPSHj37im3UZvS2k+7d9X0=; b=Ypqy7U0y3PhI3CiG/ZB4SX9I++8dGTVecgubmWn7SRrVhLc2bgpDb+9RfjYGQC/Q6jtc8kSVaBpUJWzZSt/rzJ9X6KfHzuYzCc74FiKPG5zlhI5qu55qMcQ8z8w9zFNvijgrabTfzvmuGD3YHDWUPqxosVLVih+UPPOU0u2NN4k= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631527044869182.73312196751908; Mon, 13 Sep 2021 02:57:24 -0700 (PDT) Received: from localhost ([::1]:51782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPiiJ-00021a-RA for importer@patchew.org; Mon, 13 Sep 2021 05:57:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPifu-0007OZ-FI for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:54 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:40545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifp-0001ua-KO for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:54 -0400 Received: by mail-wm1-x334.google.com with SMTP id b21-20020a1c8015000000b003049690d882so3629758wmd.5 for ; Mon, 13 Sep 2021 02:54:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:47 -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=yVP8w884M7PsuH2MFKMpdcPSHj37im3UZvS2k+7d9X0=; b=zQZplLa2SUhwBPaKoUqDdKUDr51+HQ394FcWsUkX18x0wlqAhb3i2BNRnrgeguyDpz u95nGqtzcF2zLcc+7Mi3/4R0fHPtzx02llrASivRkSLpZVF8sXH4j7bghPBq2YOiGWWF X65dzKu4noU+IxAgsElc/vIzlBoHOFx0OfiKIJ6Pp/6lHuigXFvaZ4DiA3SUZ2Z2wogO SjPpyf4k4VgrpDZvj29JtUL0F1Mrq8o6dqZC77Oeys4wkZgjnfArA9hJS7MUUDT6S14A OLngv91iRPeRrNUmF9Y5L9VDHvPQjsiWsrrZhAhDXu8gDExUEGKOD3qtetb1NZO44mZZ lKHA== 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=yVP8w884M7PsuH2MFKMpdcPSHj37im3UZvS2k+7d9X0=; b=eDtVBa1+9qatTek5sm53k/d7GcGifKnhrfYjO1MY38PIwHZ6rLN3wjlozN/p1rgzyA SyC2+E6jWDkbaAtSqoaWGxAS2GkiOgdfDKNGxV+Sc/fc/2bNxfDitQ5UZhdFJkw72wjY DbfOWfdPkt4hLmUy8fZAa+g03KQbG7MxU818wtzc0ag5ryfD4+lkjRSRlIriNX2EAN0L rEOLBW/xjpnP1P5pCoH8bBF4xAPAHvlMqNcsfif+6q70HYJS6i/M9fqvBfpsmH5VRAtI 2CMdZsSsjmLtqYy88J7VRxeVrkm532kJtr5iP0rWwIJcuEbpeOxx4yQ2+sEU9srwSeHv 4bSQ== X-Gm-Message-State: AOAM530vUazCLlJdKQZ67kU4vLPOhZkYjYXrWgNA8ntcg27r7OatrUgR ScvFRxfpgdN/45Tuwgg+6WvQPYBJ7e7sHw== X-Google-Smtp-Source: ABdhPJz367Mz7t0RAk0T/4HxilO1EDRqX2WwFsr6BrI+wCErdDNNgXNcoQYLn/5u7VAfkUKmP/jMlw== X-Received: by 2002:a05:600c:1c9a:: with SMTP id k26mr1230272wms.106.1631526888081; Mon, 13 Sep 2021 02:54:48 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 08/12] target/arm: Optimize MVE VMVN Date: Mon, 13 Sep 2021 10:54:36 +0100 Message-Id: <20210913095440.13462-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-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::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527045682100001 Content-Type: text/plain; charset="utf-8" Optimize the MVE VMVN insn by using TCG vector ops when possible. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-mve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 13de55242e2..4583e22f21c 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -769,7 +769,7 @@ static bool trans_VREV64(DisasContext *s, arg_1op *a) =20 static bool trans_VMVN(DisasContext *s, arg_1op *a) { - return do_1op(s, a, gen_helper_mve_vmvn); + return do_1op_vec(s, a, gen_helper_mve_vmvn, tcg_gen_gvec_not); } =20 static bool trans_VABS_fp(DisasContext *s, arg_1op *a) --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527889; cv=none; d=zohomail.com; s=zohoarc; b=Ze/ZRbmw4qvKm8l6KO8iOWUxEFTyrfTvl7LsJxstNYoBgkKtmrimRhHu9m18h4WuwHkt6H+6GfUD8fYXoRvLnEgXHf83BZDzucn1JfhoHydg9gg8O7srdn695ensT9y2kbSNYaKSdk3av76yjiqPGi0q9IxO1eWPXor3tYWaLDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527889; h=Content-Transfer-Encoding:Cc: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=U3CtlRUa2Pflsx0SilrWyUarKoRlgAOB6ic9qq7mvCY=; b=aNOtodOzJ61tDlvw9OWOkovcg9A616/vqLiXCTo5BaP3r0My6SukLLACYJeldkSDdta3rj/NDk3UdbfS+xfFBTJWZKyzZJFyLd5nSr1BWdbiaCFhFAjl2NS6fWKZSkkqVRMo1N5EVFBrGGb+MOWqcaKb7SB9VBEr5Zxwxva3MDY= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16315278891187.302337216089313; Mon, 13 Sep 2021 03:11:29 -0700 (PDT) Received: from localhost ([::1]:54442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPivv-00063o-TZ for importer@patchew.org; Mon, 13 Sep 2021 06:11:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPifx-0007Vv-6b for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:57 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:36688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifq-0001vN-77 for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:55 -0400 Received: by mail-wr1-x42f.google.com with SMTP id g16so13725670wrb.3 for ; Mon, 13 Sep 2021 02:54:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:48 -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=U3CtlRUa2Pflsx0SilrWyUarKoRlgAOB6ic9qq7mvCY=; b=tTShjKmCAJ3kxiBWpWRxGckXKlXC8lu0libaEs+REwWKMpNYnWaePVKsI3HpRx2QOE ibjzan6iX2FvoSwMZg8OqTqanNfozUSDLeaVfRYakmw5tudQmQLk2voSP5a7oKhuEqTZ LGGa0sEbtRzFa9Xw57CETuKLQbNvICLhb79AmxCxLRrsgPhMps/v06WhTSmb6Roflbsf cXwCzydX7AypCuohY2m8PtlzDzaoSWoYo50IZ4UdjVNzIFgLYC65L6SsFSEINr88TobA PIbQK5d82XDu/UpyPE86WdsPpgrg2YFZ/mA/Rn0IRdRD4AFZimUYQ+jncTd70E/ln1D0 6DDA== 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=U3CtlRUa2Pflsx0SilrWyUarKoRlgAOB6ic9qq7mvCY=; b=4/EQ/fYALAO25CsdISk5qGx0HqQn+qda5dZuctaF0FWassf+zU2D8z9Zv2uCVbst8u NXe1Pz6y9HcZMujZ1KyIkJRM6535yUFbwTrtV2jKbVK478FKXyIcMJO9XgYjdhSVlT8A ebtK5cn2nGbj8nLBMkyVM28eIYl+wkTYq4u8fS1hdW90BQ8OMMlY+N2OnbeA4hcf9HXi IZtKa+0cpkjSAdIpM8fietYxqNPBfH84hGkRJj0dISU3EjBtlsZo+pnmGd7S7i1ahIxf ORL+fhsm/nFSfKwjVwYpxjQrX41HeJLZI3UTeU2l6FDEYWsPJ0AM8M8iLawCH8JCXDcs eEXg== X-Gm-Message-State: AOAM531007TmnIzcXSyYW1SGxc8ph7hlQ3Vz17LjxakIQ3Zhrm1FnM4j aaOe91utcV0834/Jcu/Dnt4Zsw== X-Google-Smtp-Source: ABdhPJymGhuL1a7Jps2kaRiEDklsBUdTUJgT0HKdKGLtLzJYtKVGkkEhzFgnZ411ovEwINFKwAB7+Q== X-Received: by 2002:a5d:44d1:: with SMTP id z17mr2563253wrr.187.1631526888781; Mon, 13 Sep 2021 02:54:48 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 09/12] target/arm: Optimize MVE VSHL, VSHR immediate forms Date: Mon, 13 Sep 2021 10:54:37 +0100 Message-Id: <20210913095440.13462-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527890738100001 Content-Type: text/plain; charset="utf-8" Optimize the MVE VSHL and VSHR immediate forms by using TCG vector ops when possible. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-mve.c | 83 +++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 20 deletions(-) diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 4583e22f21c..00fa4379a74 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -1570,8 +1570,8 @@ static bool trans_Vimm_1r(DisasContext *s, arg_1imm *= a) return do_1imm(s, a, fn); } =20 -static bool do_2shift(DisasContext *s, arg_2shift *a, MVEGenTwoOpShiftFn f= n, - bool negateshift) +static bool do_2shift_vec(DisasContext *s, arg_2shift *a, MVEGenTwoOpShift= Fn fn, + bool negateshift, GVecGen2iFn vecfn) { TCGv_ptr qd, qm; int shift =3D a->shift; @@ -1594,34 +1594,77 @@ static bool do_2shift(DisasContext *s, arg_2shift *= a, MVEGenTwoOpShiftFn fn, shift =3D -shift; } =20 - qd =3D mve_qreg_ptr(a->qd); - qm =3D mve_qreg_ptr(a->qm); - fn(cpu_env, qd, qm, tcg_constant_i32(shift)); - tcg_temp_free_ptr(qd); - tcg_temp_free_ptr(qm); + if (vecfn && mve_no_predication(s)) { + vecfn(a->size, mve_qreg_offset(a->qd), mve_qreg_offset(a->qm), + shift, 16, 16); + } else { + qd =3D mve_qreg_ptr(a->qd); + qm =3D mve_qreg_ptr(a->qm); + fn(cpu_env, qd, qm, tcg_constant_i32(shift)); + tcg_temp_free_ptr(qd); + tcg_temp_free_ptr(qm); + } mve_update_eci(s); return true; } =20 -#define DO_2SHIFT(INSN, FN, NEGATESHIFT) \ - static bool trans_##INSN(DisasContext *s, arg_2shift *a) \ - { \ - static MVEGenTwoOpShiftFn * const fns[] =3D { \ - gen_helper_mve_##FN##b, \ - gen_helper_mve_##FN##h, \ - gen_helper_mve_##FN##w, \ - NULL, \ - }; \ - return do_2shift(s, a, fns[a->size], NEGATESHIFT); \ +static bool do_2shift(DisasContext *s, arg_2shift *a, MVEGenTwoOpShiftFn f= n, + bool negateshift) +{ + return do_2shift_vec(s, a, fn, negateshift, NULL); +} + +#define DO_2SHIFT_VEC(INSN, FN, NEGATESHIFT, VECFN) \ + static bool trans_##INSN(DisasContext *s, arg_2shift *a) \ + { \ + static MVEGenTwoOpShiftFn * const fns[] =3D { \ + gen_helper_mve_##FN##b, \ + gen_helper_mve_##FN##h, \ + gen_helper_mve_##FN##w, \ + NULL, \ + }; \ + return do_2shift_vec(s, a, fns[a->size], NEGATESHIFT, VECFN); \ } =20 -DO_2SHIFT(VSHLI, vshli_u, false) +#define DO_2SHIFT(INSN, FN, NEGATESHIFT) \ + DO_2SHIFT_VEC(INSN, FN, NEGATESHIFT, NULL) + +static void do_gvec_shri_s(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz) +{ + /* + * We get here with a negated shift count, and we must handle + * shifts by the element size, which tcg_gen_gvec_sari() does not do. + */ + shift =3D -shift; + if (shift =3D=3D (8 << vece)) { + shift--; + } + tcg_gen_gvec_sari(vece, dofs, aofs, shift, oprsz, maxsz); +} + +static void do_gvec_shri_u(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz) +{ + /* + * We get here with a negated shift count, and we must handle + * shifts by the element size, which tcg_gen_gvec_shri() does not do. + */ + shift =3D -shift; + if (shift =3D=3D (8 << vece)) { + tcg_gen_gvec_dup_imm(vece, dofs, oprsz, maxsz, 0); + } else { + tcg_gen_gvec_shri(vece, dofs, aofs, shift, oprsz, maxsz); + } +} + +DO_2SHIFT_VEC(VSHLI, vshli_u, false, tcg_gen_gvec_shli) DO_2SHIFT(VQSHLI_S, vqshli_s, false) DO_2SHIFT(VQSHLI_U, vqshli_u, false) DO_2SHIFT(VQSHLUI, vqshlui_s, false) /* These right shifts use a left-shift helper with negated shift count */ -DO_2SHIFT(VSHRI_S, vshli_s, true) -DO_2SHIFT(VSHRI_U, vshli_u, true) +DO_2SHIFT_VEC(VSHRI_S, vshli_s, true, do_gvec_shri_s) +DO_2SHIFT_VEC(VSHRI_U, vshli_u, true, do_gvec_shri_u) DO_2SHIFT(VRSHRI_S, vrshli_s, true) DO_2SHIFT(VRSHRI_U, vrshli_u, true) =20 --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527617; cv=none; d=zohomail.com; s=zohoarc; b=d4n7Qbzp8ha2tl1nWc12sn/lckTZ9eyLjQE/kEIEyR5oFBE0pAwKJPCetZpTjC04DzeANd/t+fcwF7utesverqluEX4DTzdwLk2yygukFAARqhs21Tiz1aEqOfA9l7SpEY+cLRkBlpkIEpybHRqazAZoPqUxFupryXbE5pv9enY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527617; h=Content-Transfer-Encoding:Cc: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=hMgDnJrlLts//MTlwriTo0UqSckqctPz2j1pbkrNwIc=; b=PjV6JSbdGICilUKZfX+p2d8qtbTos1pklXJ7PQTNa3Slf2WHFvsUM2k84WAR8CR81MZxts4MmBcIEaAyJpwTl0GriEIrPjG7eU4Pvy4684/8a8pMDDrlYL1yWXdTDOArAXUKdsx2AdqpjDMn7s1dvtFkWFkotYaxihrycBX1NAE= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163152761700316.38506741580113; Mon, 13 Sep 2021 03:06:57 -0700 (PDT) Received: from localhost ([::1]:43268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPirX-0006zu-S1 for importer@patchew.org; Mon, 13 Sep 2021 06:06:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPigE-0008ER-Ir for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:55:17 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:41979) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifq-0001vp-V3 for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:55:11 -0400 Received: by mail-wr1-x42a.google.com with SMTP id w29so12924762wra.8 for ; Mon, 13 Sep 2021 02:54:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:49 -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=hMgDnJrlLts//MTlwriTo0UqSckqctPz2j1pbkrNwIc=; b=IGP6FhdhvMrkE7Nl1ueiFXbpSZiLfB2AUZpcwS1kqDtVBWBix2GKotMcQR3NYZCQB5 BtdWAbYE/DGVaRusHA6ZAz/2LdOLeoV9toQBeXKZHHEgCZP1VC31ndh/nFZDPUvIPULm mvAdmdLoWz1hxrfBc3uVsL+kWxbKGApeSxwlsud11GvKftf+mj9HUGZn5mgQyvnizjR+ w0h60pcOj8a3vtEpTqh/IT6kFY56ZJgSq2U8I7cayKg2j7RYl7assSVR4nyMmIV8EZu3 +84HrjwnVsjL3KJXarZ6WNDYNVXlCLyQX9SLAWLUSj3Vh0dlFBFHfYneGKG/sPAGXY7I S7Sg== 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=hMgDnJrlLts//MTlwriTo0UqSckqctPz2j1pbkrNwIc=; b=X+uDvVJbQ6iKHXg6LjNI/6AJ34e2MQgKPXpLTqE13OS2YxhUG5KL5QwkvY6X3u/Krr HQ9l59Y7O/K0VdgUEjoEFxeitTaDRECz3cBp2oZ+zhePZeEW5yrAFcH+83um1zBhxAHO D6s3j6aHT6r+lEiJ2qkxKBLGjHr56ZtPTk9ElD8btZJScmfWzcWONve6K7U6F5fYT8pL Kj9V+YcFZcSunn1c8RrwHa8nLO+kNm9lbL75HvtROKSVUKW4Z07Jasyo9eLV9Sb6rDQ+ 2hz1xEmflj7he1kXw8gXlC/y1ajqYCfsL27itYDudZyulDCQLMsyM57/iSB0OIHVPlsA hJTA== X-Gm-Message-State: AOAM532HfAlj8XgVSdI62W0T2P0rMmK94IJ3caxDEAlXNGQz77KiWcCk SqT0IUMjf+XvHDLEcok6wCCWWA== X-Google-Smtp-Source: ABdhPJzaqAwcSP1YhVruLSBFO97DxflKg/outPjKfqZVYPyJvdZ7WrNICdSbVpD+QJ8AArgBeTuizA== X-Received: by 2002:a5d:5408:: with SMTP id g8mr11654100wrv.34.1631526889418; Mon, 13 Sep 2021 02:54:49 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 10/12] target/arm: Optimize MVE VSHLL and VMOVL Date: Mon, 13 Sep 2021 10:54:38 +0100 Message-Id: <20210913095440.13462-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-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::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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, 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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527619005100001 Content-Type: text/plain; charset="utf-8" Optimize the MVE VSHLL insns by using TCG vector ops when possible. This includes the VMOVL insn, which we handle in mve.decode as "VSHLL with zero shift count". Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- The cases here that I've implemented with ANDI then shift could also be implemented as shift-then-shift. Is one better than another? --- target/arm/translate-mve.c | 67 +++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 00fa4379a74..5d66f70657e 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -1735,16 +1735,67 @@ DO_2SHIFT_SCALAR(VQSHL_U_scalar, vqshli_u) DO_2SHIFT_SCALAR(VQRSHL_S_scalar, vqrshli_s) DO_2SHIFT_SCALAR(VQRSHL_U_scalar, vqrshli_u) =20 -#define DO_VSHLL(INSN, FN) \ - static bool trans_##INSN(DisasContext *s, arg_2shift *a) \ - { \ - static MVEGenTwoOpShiftFn * const fns[] =3D { \ - gen_helper_mve_##FN##b, \ - gen_helper_mve_##FN##h, \ - }; \ - return do_2shift(s, a, fns[a->size], false); \ +#define DO_VSHLL(INSN, FN) \ + static bool trans_##INSN(DisasContext *s, arg_2shift *a) \ + { \ + static MVEGenTwoOpShiftFn * const fns[] =3D { \ + gen_helper_mve_##FN##b, \ + gen_helper_mve_##FN##h, \ + }; \ + return do_2shift_vec(s, a, fns[a->size], false, do_gvec_##FN); \ } =20 +/* + * For the VSHLL vector helpers, the vece is the size of the input + * (ie MO_8 or MO_16); the helpers want to work in the output size. + * The shift count can be 0.., inclusive. (0 is VMOVL.) + */ +static void do_gvec_vshllbs(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz) +{ + unsigned ovece =3D vece + 1; + unsigned ibits =3D vece =3D=3D MO_8 ? 8 : 16; + tcg_gen_gvec_shli(ovece, dofs, aofs, ibits, oprsz, maxsz); + tcg_gen_gvec_sari(ovece, dofs, dofs, ibits - shift, oprsz, maxsz); +} + +static void do_gvec_vshllbu(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz) +{ + unsigned ovece =3D vece + 1; + tcg_gen_gvec_andi(ovece, dofs, aofs, + ovece =3D=3D MO_16 ? 0xff : 0xffff, oprsz, maxsz); + tcg_gen_gvec_shli(ovece, dofs, dofs, shift, oprsz, maxsz); +} + +static void do_gvec_vshllts(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz) +{ + unsigned ovece =3D vece + 1; + unsigned ibits =3D vece =3D=3D MO_8 ? 8 : 16; + if (shift =3D=3D 0) { + tcg_gen_gvec_sari(ovece, dofs, aofs, ibits, oprsz, maxsz); + } else { + tcg_gen_gvec_andi(ovece, dofs, aofs, + ovece =3D=3D MO_16 ? 0xff00 : 0xffff0000, oprsz,= maxsz); + tcg_gen_gvec_sari(ovece, dofs, dofs, ibits - shift, oprsz, maxsz); + } +} + +static void do_gvec_vshlltu(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t shift, uint32_t oprsz, uint32_t maxsz) +{ + unsigned ovece =3D vece + 1; + unsigned ibits =3D vece =3D=3D MO_8 ? 8 : 16; + if (shift =3D=3D 0) { + tcg_gen_gvec_shri(ovece, dofs, aofs, ibits, oprsz, maxsz); + } else { + tcg_gen_gvec_andi(ovece, dofs, aofs, + ovece =3D=3D MO_16 ? 0xff00 : 0xffff0000, oprsz,= maxsz); + tcg_gen_gvec_shri(ovece, dofs, dofs, ibits - shift, oprsz, maxsz); + } +} + DO_VSHLL(VSHLL_BS, vshllbs) DO_VSHLL(VSHLL_BU, vshllbu) DO_VSHLL(VSHLL_TS, vshllts) --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631528088; cv=none; d=zohomail.com; s=zohoarc; b=Chqq7zDdoW9QnFQBJspsMJ+EG+nDHnA2xg8NabQ1LZ1OY7EFIoezDZFGekZBYGkPsrA/+JfG8vLJh4Ax874MyXzJm20AKWZfDvj8txOX78U1XDqUeSoAqsmtrKxnczNn7yjSPJFXC1+K/KbogB/sBeLNOEOTMWGnqTBd3kyYu3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631528088; h=Content-Transfer-Encoding:Cc: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=d0zWOUJgsCXe3Z17gWKDqIbTwVvMvDtAMTrMvlaEcgQ=; b=iFaLqw5lODqH3WVhQvF7EHYLFDYeqv5wbvlSAB1e6dACuVZfJVQnBLmqDVl05xu13ja4JpgNCBzjfXHlp4viAbTA537EJoUHbcNHDFdnWLfo9wEePL3W7SCL2Arkqa6/a8V07gAJqgf5nuAFDRZRCYzQp0W8ABaJthnd0epU6AQ= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631528088898153.6011487672938; Mon, 13 Sep 2021 03:14:48 -0700 (PDT) Received: from localhost ([::1]:35888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPiz9-000481-U4 for importer@patchew.org; Mon, 13 Sep 2021 06:14:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPify-0007b6-Eb for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:58 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:33395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifr-0001w3-HF for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:58 -0400 Received: by mail-wr1-x436.google.com with SMTP id t18so13737326wrb.0 for ; Mon, 13 Sep 2021 02:54:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:49 -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=d0zWOUJgsCXe3Z17gWKDqIbTwVvMvDtAMTrMvlaEcgQ=; b=i3raDPP3ROErZO2ZQCAIci5druwMNjWwIYOlvxTVXLZaXk71UVE0TIG9IzB9YuKT0U o/x+PuPFAToxqhazA+9KzX0/Crfpy4jzWKLQrpvAIqtrZvDhO6wXYBmg4wFuFauNFPPv JuYqhc43dlb+6f76C9wWd3IUA1YJYx84+GN3+JNzNAkK+RYHUzu8OzZrAkE9UYKWB7QJ 3Z8eMiruLyWqKtXvTDlpinTAdGHc5F5bdfcfIZJFaz38ypsgfUnnKi4y4ib7CF09Cdow pVTUR94DKjX71kuWrKhYEG/5RnEiPFQvE4LiGlqn+Q+VVgfyyqUgmE97e/V1EcyZCj5G Duug== 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=d0zWOUJgsCXe3Z17gWKDqIbTwVvMvDtAMTrMvlaEcgQ=; b=iNQDFqCTJyitOq/jKyzCKv3TEKgrzHLOvinDrmOCFHrNcHydg4tFwEkxERhLGcb5bL gxEwN2snq9LCSPFEamzS2myKn91LwQjkyAsJ7s2n7xM0xVz0R5L2ZRBxOTTpQ1SZcJDp 2oJfCy0/xrolZfW2kJVUasVB6sXaPxfEjhhtuZKSuXxw0bW0qYHo51BtY66vqHAVIWWG OhLnyhxwcNfon5w5urhDUvvSJMSTI2OGZdrips9BOHwM7AUgSkWcvv9Jjocbw9oCQr7g PhGF7MEASk2OhXvO2TnjMnulBEUomul3MGiLpgV5zVy7X7v3a9rXr3udiibO0XZFEeFz 1bVQ== X-Gm-Message-State: AOAM530t8IgE6My7SJ2O+GGrjVahflomnh6GR21XG2vPsYZBiC98krvi uJiPyfNRWaUQOj/mHCcZTjqlUw== X-Google-Smtp-Source: ABdhPJwS8BjCAHremkOeqYmEnVr1BZQWdqTM935g8NH5s6525P9icwBdQj4IxTxQlZFfqACbscd7QA== X-Received: by 2002:a05:6000:188d:: with SMTP id a13mr11254674wri.99.1631526890123; Mon, 13 Sep 2021 02:54:50 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 11/12] target/arm: Optimize MVE VSLI and VSRI Date: Mon, 13 Sep 2021 10:54:39 +0100 Message-Id: <20210913095440.13462-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-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::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631528089938100001 Content-Type: text/plain; charset="utf-8" Optimize the MVE shift-and-insert insns by using TCG vector ops when possible. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-mve.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 5d66f70657e..1fd71c9a1ee 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -1668,8 +1668,8 @@ DO_2SHIFT_VEC(VSHRI_U, vshli_u, true, do_gvec_shri_u) DO_2SHIFT(VRSHRI_S, vrshli_s, true) DO_2SHIFT(VRSHRI_U, vrshli_u, true) =20 -DO_2SHIFT(VSRI, vsri, false) -DO_2SHIFT(VSLI, vsli, false) +DO_2SHIFT_VEC(VSRI, vsri, false, gen_gvec_sri) +DO_2SHIFT_VEC(VSLI, vsli, false, gen_gvec_sli) =20 #define DO_2SHIFT_FP(INSN, FN) \ static bool trans_##INSN(DisasContext *s, arg_2shift *a) \ --=20 2.20.1 From nobody Sat May 4 02:50:20 2024 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=1631527279; cv=none; d=zohomail.com; s=zohoarc; b=Knu8MHZevcpyzbIln/oWVKVh4iy8PmeNDlqWqjJeBzAuPm2B1uQ4qAJhgyNWiiXcN+iy2M0eulOt+y/FnZt722Qe74eNB3RU+bTwsL8X2ZlFDcPhIouTArWhEfharxmx5r/ImGhiIWhjt7T/6YYWfGbokSsnZ+jeNgJaH5weZWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631527279; h=Content-Transfer-Encoding:Cc: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=87t4rKj87r3v4XMYvFAJ7w7HoQP6mKOaE1QysWiPQ9g=; b=Y3cg2mIMAXHQS6kHFNy4EdAybtRvgMPXSE2FBVJ3LHiiyqpgN6y38Y+Jwu3YzrGGj7Ntg/6kkvVUsFL+UUkLzdiAlChtvESS/DsOP1KvYnQLGyRKDm2jh5DZtjUrV+XtFSxXdNZEK08Xjd97aplbXlDNFod4A7EKtaA1S3ggztA= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631527279044411.83326071827753; Mon, 13 Sep 2021 03:01:19 -0700 (PDT) Received: from localhost ([::1]:33456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPim2-0000AA-PO for importer@patchew.org; Mon, 13 Sep 2021 06:01:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPifz-0007gn-Q8 for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:59 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:43820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPifs-0001xm-9l for qemu-devel@nongnu.org; Mon, 13 Sep 2021 05:54:59 -0400 Received: by mail-wr1-x435.google.com with SMTP id b6so13665827wrh.10 for ; Mon, 13 Sep 2021 02:54:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m184sm6475338wmm.3.2021.09.13.02.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:54:50 -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=87t4rKj87r3v4XMYvFAJ7w7HoQP6mKOaE1QysWiPQ9g=; b=EFLvzQ9I/ftC2bUF14n8CIgeX2hjZmI9bAmqlHjO2muVwOq20C1ceJzyM/NoGfZ/5I kKxx1D7ooQQDVJgCZvo6xl5chH3NYtQmFab0irpMholTduqaBMAPfP3ntRhLptuBmivy 3O2u/F0cSFRLr3zKTUEyxIQKt3vXnd1RlJnhIX7dxJpkW3R3dS1KSDEo/EkhQm9VAATL SUSwUGGLSbJrf0qPm+h7brfi3gB8k1syMNU/AvR5MhAPqz3dRhjEfK0/QWMhUsqMNwy4 d2oiVaU37X76ul2Al3ayBCbC63+7O6o2O0MPhUR5TTovQEQArSx3bSi0NL5MoArN+DS7 /MBA== 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=87t4rKj87r3v4XMYvFAJ7w7HoQP6mKOaE1QysWiPQ9g=; b=iYUL++oR3Y9N4qp6hDhsxmiA15F7pMr5XeAk/7insM0CWDLU2BFKPbVfX/IDGvXdmX Y1Hrjx5KeHGEM3iMNVWAm7q8qi1RT/grArV01Fja1KNEhj7gfePmVkK8ZkqQL9oIPJeI twGnx8I18ikplc7AIbWEgBWtSw75VlZDlWys6rD+Qa/AUrLq9nov4YuOIzKZBUM0W7Qu foFV28QV6uE9JIElxny9R70uOjkmD74p83rPBbuCCAWAWAxZSFoCzIt+gNvvuaOCKwZi hoKBr9gPCOcantv/g7OBuhaQRNCku5xfMrWHsSLCJXlXudpqRJ48DGDIMHqu/cu9XCE/ FGZw== X-Gm-Message-State: AOAM530tNpIvnNMFFfLwaMu+V+dCyuMm836uOWgdAaAbuetlt3G1xokd ikFNPhBMqvFhquRpyKgydrK/TQ== X-Google-Smtp-Source: ABdhPJz2EH4Dew01IspYPDwWcOWbobgMYjBupV5dAdWWJBLa9Y+DgDaXiYaPVwHbB8IEBWtW18kNcA== X-Received: by 2002:adf:80c8:: with SMTP id 66mr11667685wrl.65.1631526890808; Mon, 13 Sep 2021 02:54:50 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 12/12] target/arm: Optimize MVE 1op-immediate insns Date: Mon, 13 Sep 2021 10:54:40 +0100 Message-Id: <20210913095440.13462-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913095440.13462-1-peter.maydell@linaro.org> References: <20210913095440.13462-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::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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: , Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631527279706100001 Content-Type: text/plain; charset="utf-8" Optimize the MVE 1op-immediate insns (VORR, VBIC, VMOV) to use TCG vector ops when possible. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-mve.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 1fd71c9a1ee..4267d43cc7c 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -1521,7 +1521,8 @@ static bool trans_VADDLV(DisasContext *s, arg_VADDLV = *a) return true; } =20 -static bool do_1imm(DisasContext *s, arg_1imm *a, MVEGenOneOpImmFn *fn) +static bool do_1imm(DisasContext *s, arg_1imm *a, MVEGenOneOpImmFn *fn, + GVecGen2iFn *vecfn) { TCGv_ptr qd; uint64_t imm; @@ -1537,17 +1538,29 @@ static bool do_1imm(DisasContext *s, arg_1imm *a, M= VEGenOneOpImmFn *fn) =20 imm =3D asimd_imm_const(a->imm, a->cmode, a->op); =20 - qd =3D mve_qreg_ptr(a->qd); - fn(cpu_env, qd, tcg_constant_i64(imm)); - tcg_temp_free_ptr(qd); + if (vecfn && mve_no_predication(s)) { + vecfn(MO_64, mve_qreg_offset(a->qd), mve_qreg_offset(a->qd), + imm, 16, 16); + } else { + qd =3D mve_qreg_ptr(a->qd); + fn(cpu_env, qd, tcg_constant_i64(imm)); + tcg_temp_free_ptr(qd); + } mve_update_eci(s); return true; } =20 +static void gen_gvec_vmovi(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t c, uint32_t oprsz, uint32_t maxsz) +{ + tcg_gen_gvec_dup_imm(vece, dofs, oprsz, maxsz, c); +} + static bool trans_Vimm_1r(DisasContext *s, arg_1imm *a) { /* Handle decode of cmode/op here between VORR/VBIC/VMOV */ MVEGenOneOpImmFn *fn; + GVecGen2iFn *vecfn; =20 if ((a->cmode & 1) && a->cmode < 12) { if (a->op) { @@ -1556,8 +1569,10 @@ static bool trans_Vimm_1r(DisasContext *s, arg_1imm = *a) * so the VBIC becomes a logical AND operation. */ fn =3D gen_helper_mve_vandi; + vecfn =3D tcg_gen_gvec_andi; } else { fn =3D gen_helper_mve_vorri; + vecfn =3D tcg_gen_gvec_ori; } } else { /* There is one unallocated cmode/op combination in this space */ @@ -1566,8 +1581,9 @@ static bool trans_Vimm_1r(DisasContext *s, arg_1imm *= a) } /* asimd_imm_const() sorts out VMVNI vs VMOVI for us */ fn =3D gen_helper_mve_vmovi; + vecfn =3D gen_gvec_vmovi; } - return do_1imm(s, a, fn); + return do_1imm(s, a, fn, vecfn); } =20 static bool do_2shift_vec(DisasContext *s, arg_2shift *a, MVEGenTwoOpShift= Fn fn, --=20 2.20.1