From nobody Sat May 18 07:48:50 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=1713978628; cv=none; d=zohomail.com; s=zohoarc; b=MP3BWnKAZLKKTorLADRPnb96qh2q239wTzkDcQegK0Mwmb306JQiAz4dvkjDu+ustwXC+It41+GYHekAXRmlbKu8588Qi7vI2+vW7rDzaItL7xWUGap/hkpH/6bNgmuaVk9OY+VzM/8DAhd+0WbDdUpLRkDyafRlV3x9z9+ZD8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713978628; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=KHDjww4pw6BIJWGas2p/P5rVjL2rJzApCM5JT+Uks+8=; b=S2i61mYp9XOkgbN4k1p+zQfQ8yijklVriQC8PIzcK72HPK3vsralyucqejdNExNWqLIjalq2GrtSsflTu7nMJ/PPOeE/oB8HqQ0kaUSir9w8GpkGBsSEpLtgPwq2ozvIRqfZWaAOcpXyaYU2qzgPZOdCEnPs/s18XYXdHzELQxA= 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 1713978628807514.5040769338146; Wed, 24 Apr 2024 10:10:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzg7T-0001zA-QX; Wed, 24 Apr 2024 13:09:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzg7Q-0001yE-Ru for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:16 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzg7P-0005MJ-4D for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:16 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1e8bbcbc2b7so502215ad.0 for ; Wed, 24 Apr 2024 10:09:14 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e80800b001e0b5d49fc7sm12215489plg.161.2024.04.24.10.09.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 10:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713978553; x=1714583353; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KHDjww4pw6BIJWGas2p/P5rVjL2rJzApCM5JT+Uks+8=; b=L9hVKtCBjyBW7kK5z0F0c7Jliqi/V/L/B8taIJdcDewTKlhM1011FFVloxSVAqHD7V RQKXD+7T5Es6U1/tit6Oqu/iwZaEREOcDPXXMofVDdio0MscPWT6wOsfORxZB5vgOkj1 GwcXQRBWaCH4jcpl7pAwM+BD6oOdsgmPICq0bSuVfT+BF0f/H0uildMqeyp6vgUWLad5 n2PN+vB9hNqs2cxCMGUwZCywu8DjDa7lXNRalgLf2emmUWqWg4tcFxWvlRpQT7f4zul7 l7XUKXW0wjVq/p/ooTc3qYjj3Ckt81UxDbQL0slDZejRyLeTiOG6H429eJ6NLbGFuFRu HmLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713978553; x=1714583353; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KHDjww4pw6BIJWGas2p/P5rVjL2rJzApCM5JT+Uks+8=; b=kMjHpcY6vDekv5wp2NwYr4x1aGdkY5eKmI4Js3WpB0yFbLa/FpSCVcuT+NLa+NO/4v Q2y1KEJkha+D3hO1dEe2vT/t+fB3LFQXG6ctWmC4aO/qQ8ikAkh3WTn6XHaWiBl1HoEL uH8vPzhFDpU3B37Q1GZe6Qlcm2XoiQevfYLoaniYMD/Tuc+uGF9C0z3Ta2N8tSqo8R4i NtwzpJ2gUZdMR89deSq1seHZJzMWQm5dePUTwp/G9EKHF8Yz2TdQ5xGnEV+9A2myb8wZ yxvhUV9CN/Y/3t0Ky/4SNfVV3Rkr8Wwvb0CXSkLCgFbt+Bs0oNYDIVKtCvVEgmc9FHaa 4HcA== X-Gm-Message-State: AOJu0YxXIZkIPEt5G6KcVHaDVJl3xAx7OiHucPeierXkBFk8nFlYl6h9 Pe+XACUJ7QlFAaM+drGmPBIA0uqCvk/ODZPXu/sgbAfft0b2MmmJMVWxSvzgQANtAcGBySCZESY R X-Google-Smtp-Source: AGHT+IGEumGdugEFeniZ8yzLJX4wL3yCOpTmXuZOT12XMIQq6P3rc/eVhpARI88J8eCNT1AFg29o8A== X-Received: by 2002:a17:903:284:b0:1e0:dc6e:45d6 with SMTP id j4-20020a170903028400b001e0dc6e45d6mr4460721plr.60.1713978553551; Wed, 24 Apr 2024 10:09:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/5] tcg: Add write_aofs to GVecGen3i Date: Wed, 24 Apr 2024 10:09:04 -0700 Message-Id: <20240424170908.759043-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424170908.759043-1-richard.henderson@linaro.org> References: <20240424170908.759043-1-richard.henderson@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=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1713978629091100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/tcg/tcg-op-gvec-common.h | 2 ++ tcg/tcg-op-gvec.c | 30 ++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/include/tcg/tcg-op-gvec-common.h b/include/tcg/tcg-op-gvec-com= mon.h index 4db8a58c14..65553f5f97 100644 --- a/include/tcg/tcg-op-gvec-common.h +++ b/include/tcg/tcg-op-gvec-common.h @@ -183,6 +183,8 @@ typedef struct { bool prefer_i64; /* Load dest as a 3rd source operand. */ bool load_dest; + /* Write aofs as a 2nd dest operand. */ + bool write_aofs; } GVecGen3i; =20 typedef struct { diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index bb88943f79..0308732d9b 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -785,7 +785,8 @@ static void expand_3_i32(uint32_t dofs, uint32_t aofs, } =20 static void expand_3i_i32(uint32_t dofs, uint32_t aofs, uint32_t bofs, - uint32_t oprsz, int32_t c, bool load_dest, + uint32_t oprsz, int32_t c, + bool load_dest, bool write_aofs, void (*fni)(TCGv_i32, TCGv_i32, TCGv_i32, int32_= t)) { TCGv_i32 t0 =3D tcg_temp_new_i32(); @@ -801,6 +802,9 @@ static void expand_3i_i32(uint32_t dofs, uint32_t aofs,= uint32_t bofs, } fni(t2, t0, t1, c); tcg_gen_st_i32(t2, tcg_env, dofs + i); + if (write_aofs) { + tcg_gen_st_i32(t0, tcg_env, aofs + i); + } } tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); @@ -944,7 +948,8 @@ static void expand_3_i64(uint32_t dofs, uint32_t aofs, } =20 static void expand_3i_i64(uint32_t dofs, uint32_t aofs, uint32_t bofs, - uint32_t oprsz, int64_t c, bool load_dest, + uint32_t oprsz, int64_t c, + bool load_dest, bool write_aofs, void (*fni)(TCGv_i64, TCGv_i64, TCGv_i64, int64_= t)) { TCGv_i64 t0 =3D tcg_temp_new_i64(); @@ -960,6 +965,9 @@ static void expand_3i_i64(uint32_t dofs, uint32_t aofs,= uint32_t bofs, } fni(t2, t0, t1, c); tcg_gen_st_i64(t2, tcg_env, dofs + i); + if (write_aofs) { + tcg_gen_st_i64(t0, tcg_env, aofs + i); + } } tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); @@ -1102,7 +1110,8 @@ static void expand_3_vec(unsigned vece, uint32_t dofs= , uint32_t aofs, */ static void expand_3i_vec(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t oprsz, uint32_t tysz, - TCGType type, int64_t c, bool load_dest, + TCGType type, int64_t c, + bool load_dest, bool write_aofs, void (*fni)(unsigned, TCGv_vec, TCGv_vec, TCGv_v= ec, int64_t)) { @@ -1118,6 +1127,9 @@ static void expand_3i_vec(unsigned vece, uint32_t dof= s, uint32_t aofs, } fni(vece, t2, t0, t1, c); tcg_gen_st_vec(t2, tcg_env, dofs + i); + if (write_aofs) { + tcg_gen_st_vec(t0, tcg_env, aofs + i); + } } } =20 @@ -1471,7 +1483,7 @@ void tcg_gen_gvec_3i(uint32_t dofs, uint32_t aofs, ui= nt32_t bofs, */ some =3D QEMU_ALIGN_DOWN(oprsz, 32); expand_3i_vec(g->vece, dofs, aofs, bofs, some, 32, TCG_TYPE_V256, - c, g->load_dest, g->fniv); + c, g->load_dest, g->write_aofs, g->fniv); if (some =3D=3D oprsz) { break; } @@ -1483,18 +1495,20 @@ void tcg_gen_gvec_3i(uint32_t dofs, uint32_t aofs, = uint32_t bofs, /* fallthru */ case TCG_TYPE_V128: expand_3i_vec(g->vece, dofs, aofs, bofs, oprsz, 16, TCG_TYPE_V128, - c, g->load_dest, g->fniv); + c, g->load_dest, g->write_aofs, g->fniv); break; case TCG_TYPE_V64: expand_3i_vec(g->vece, dofs, aofs, bofs, oprsz, 8, TCG_TYPE_V64, - c, g->load_dest, g->fniv); + c, g->load_dest, g->write_aofs, g->fniv); break; =20 case 0: if (g->fni8 && check_size_impl(oprsz, 8)) { - expand_3i_i64(dofs, aofs, bofs, oprsz, c, g->load_dest, g->fni= 8); + expand_3i_i64(dofs, aofs, bofs, oprsz, c, + g->load_dest, g->write_aofs, g->fni8); } else if (g->fni4 && check_size_impl(oprsz, 4)) { - expand_3i_i32(dofs, aofs, bofs, oprsz, c, g->load_dest, g->fni= 4); + expand_3i_i32(dofs, aofs, bofs, oprsz, c, + g->load_dest, g->write_aofs, g->fni4); } else { assert(g->fno !=3D NULL); tcg_gen_gvec_3_ool(dofs, aofs, bofs, oprsz, maxsz, c, g->fno); --=20 2.34.1 From nobody Sat May 18 07:48:50 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=1713978645; cv=none; d=zohomail.com; s=zohoarc; b=E/KSJLQsHKaJ0WkiQuK7+RRZv3BtU/jBEqkbpvfOfMgqrBPH/58MSVKPy+DEPuUfBfk29QjXoxEgHA9IHbJJK+x4qYOatlwgknAYd23tylrk9L4SKQNzrIDaMUIL3gjbaNGRB297qu+zHF61ST2fIg/DzHGXg1KyM5glIWA7GzY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713978645; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=T0/wwsmOrIFP2k0lfcZhLa1SDoLg5xmY78unAbAeB00=; b=VD84kpXGJKXDo+T7ZCcVl9CqBjUkRP2nowdp7XydnRh4Spp3HebNbBcrIKFEDwCb2IqRig+UiI0rXiwwK8BTBwegg3r0/pbrjczBoJ0gh4bCemGmxYUaLUXAnGnnz8+huSRFmSF4QkPd1fEBBbISXa3CGGcbWts51BuG53uFwC4= 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 17139786454751020.5785639541299; Wed, 24 Apr 2024 10:10:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzg7Z-000209-39; Wed, 24 Apr 2024 13:09:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzg7R-0001ye-Or for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:17 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzg7P-0005Mf-S2 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:17 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1e2b1cd446fso265435ad.3 for ; Wed, 24 Apr 2024 10:09:15 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e80800b001e0b5d49fc7sm12215489plg.161.2024.04.24.10.09.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 10:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713978554; x=1714583354; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=T0/wwsmOrIFP2k0lfcZhLa1SDoLg5xmY78unAbAeB00=; b=H7sImLsv1v8mHhJEgDamGcp/w1GmWIzqCpeKm5BxXmvM2ZW7DAO2+bbRg26EDStnfC rsYRRVbkBZBJus5H7/C0MkEoDPJxLPOe9/jnfcZBv81SpwocczasBfbNkrV+AMYDgND4 H062sECC9+6qQn/EFFMcPYbh3oggSpL8vb8/yzNi4e7fWQ33QMdSLc/aqDasfzZakuW4 0fAzrlI/h2Y8XEoiBOk2iz2+CxI9PMKDc8A9XuhLD4pesawJ5lwr2cfDCQECjYMTaTRv sQqqOBdq9rrsLnroQA7mr5JLgExuRxO9l1g1wve8xDJGjqdxtqohGsPgrOw5YJNu1cQ9 XHeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713978554; x=1714583354; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T0/wwsmOrIFP2k0lfcZhLa1SDoLg5xmY78unAbAeB00=; b=G94VHNqzlBiBmaPx6tFcvTyxOZrX2xRXJaWHesbAr6U2A7m5ECDjYYch6AdhScrfFh SbyZ+Dhchggez8g1dp2AQVOOJbWEAS/bjojo78rkQUcRAesdsMv4FbDu0t5NirTuMAFf 2dZkWhft3teAFsLwE5knaOZVaK5myWPyrWhN4Pf38Sldlt+8rZiIuM0Pt0ogmjT6KW+J /VQSoQiHkXzDXWxAIoiRQOSJAAFESbkcPhBCvp7Ww4pXPs8p+DTyrNb5rY4aJs7FlqAQ QDQBQCz0kL1QugESTY9p/46SpVRnbSLc5VNvs2i3t9auiRoTpcoW1B7UALqnyD+l3F0w gsYQ== X-Gm-Message-State: AOJu0YyY27BwdgVd+FF3Oo0pXX6b17IDXTrMxs9agpahU/qgby7TzZ1j I2K2znxDx/ec+RsGSEFchB0Tt9uN4+qdieQ7twOniCOlwQ4AGbACkJ510cSdTl4ffaLson5cjvU K X-Google-Smtp-Source: AGHT+IH4yayLi5d/dSHHjT7FVFY+A2gphbGYUG7hxuH44xiwskJqpRxbqh4ErcbbpzqivnuWSKgkOA== X-Received: by 2002:a17:902:784f:b0:1e6:1a7a:98df with SMTP id e15-20020a170902784f00b001e61a7a98dfmr2657901pln.66.1713978554565; Wed, 24 Apr 2024 10:09:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/5] tcg/i386: Simplify immediate 8-bit logical vector shifts Date: Wed, 24 Apr 2024 10:09:05 -0700 Message-Id: <20240424170908.759043-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424170908.759043-1-richard.henderson@linaro.org> References: <20240424170908.759043-1-richard.henderson@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=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1713978647151100003 Content-Type: text/plain; charset="utf-8" The x86 isa does not have this operation, so we need an expansion. Use the same algorithm that we use for expanding this vector operation with integers: perform the shift with a wider type and then mask the bits that must be zero. This reduces the instruction count from 5 to 2. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 61 +++++++++------------------------------ 1 file changed, 14 insertions(+), 47 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index c6ba498623..6837c519b0 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -3769,49 +3769,20 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type= , unsigned vece) } } =20 -static void expand_vec_shi(TCGType type, unsigned vece, TCGOpcode opc, +static void expand_vec_shi(TCGType type, unsigned vece, bool right, TCGv_vec v0, TCGv_vec v1, TCGArg imm) { - TCGv_vec t1, t2; + uint8_t mask; =20 tcg_debug_assert(vece =3D=3D MO_8); - - t1 =3D tcg_temp_new_vec(type); - t2 =3D tcg_temp_new_vec(type); - - /* - * Unpack to W, shift, and repack. Tricky bits: - * (1) Use punpck*bw x,x to produce DDCCBBAA, - * i.e. duplicate in other half of the 16-bit lane. - * (2) For right-shift, add 8 so that the high half of the lane - * becomes zero. For left-shift, and left-rotate, we must - * shift up and down again. - * (3) Step 2 leaves high half zero such that PACKUSWB - * (pack with unsigned saturation) does not modify - * the quantity. - */ - vec_gen_3(INDEX_op_x86_punpckl_vec, type, MO_8, - tcgv_vec_arg(t1), tcgv_vec_arg(v1), tcgv_vec_arg(v1)); - vec_gen_3(INDEX_op_x86_punpckh_vec, type, MO_8, - tcgv_vec_arg(t2), tcgv_vec_arg(v1), tcgv_vec_arg(v1)); - - if (opc !=3D INDEX_op_rotli_vec) { - imm +=3D 8; - } - if (opc =3D=3D INDEX_op_shri_vec) { - tcg_gen_shri_vec(MO_16, t1, t1, imm); - tcg_gen_shri_vec(MO_16, t2, t2, imm); + if (right) { + mask =3D 0xff >> imm; + tcg_gen_shri_vec(MO_16, v0, v1, imm); } else { - tcg_gen_shli_vec(MO_16, t1, t1, imm); - tcg_gen_shli_vec(MO_16, t2, t2, imm); - tcg_gen_shri_vec(MO_16, t1, t1, 8); - tcg_gen_shri_vec(MO_16, t2, t2, 8); + mask =3D 0xff << imm; + tcg_gen_shli_vec(MO_16, v0, v1, imm); } - - vec_gen_3(INDEX_op_x86_packus_vec, type, MO_8, - tcgv_vec_arg(v0), tcgv_vec_arg(t1), tcgv_vec_arg(t2)); - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t2); + tcg_gen_and_vec(MO_8, v0, v0, tcg_constant_vec(type, MO_8, mask)); } =20 static void expand_vec_sari(TCGType type, unsigned vece, @@ -3821,7 +3792,7 @@ static void expand_vec_sari(TCGType type, unsigned ve= ce, =20 switch (vece) { case MO_8: - /* Unpack to W, shift, and repack, as in expand_vec_shi. */ + /* Unpack to 16-bit, shift, and repack. */ t1 =3D tcg_temp_new_vec(type); t2 =3D tcg_temp_new_vec(type); vec_gen_3(INDEX_op_x86_punpckl_vec, type, MO_8, @@ -3874,12 +3845,7 @@ static void expand_vec_rotli(TCGType type, unsigned = vece, { TCGv_vec t; =20 - if (vece =3D=3D MO_8) { - expand_vec_shi(type, vece, INDEX_op_rotli_vec, v0, v1, imm); - return; - } - - if (have_avx512vbmi2) { + if (vece !=3D MO_8 && have_avx512vbmi2) { vec_gen_4(INDEX_op_x86_vpshldi_vec, type, vece, tcgv_vec_arg(v0), tcgv_vec_arg(v1), tcgv_vec_arg(v1), im= m); return; @@ -4155,10 +4121,11 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type,= unsigned vece, =20 switch (opc) { case INDEX_op_shli_vec: - case INDEX_op_shri_vec: - expand_vec_shi(type, vece, opc, v0, v1, a2); + expand_vec_shi(type, vece, false, v0, v1, a2); + break; + case INDEX_op_shri_vec: + expand_vec_shi(type, vece, true, v0, v1, a2); break; - case INDEX_op_sari_vec: expand_vec_sari(type, vece, v0, v1, a2); break; --=20 2.34.1 From nobody Sat May 18 07:48:50 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=1713978622; cv=none; d=zohomail.com; s=zohoarc; b=Q7DGORFv9XyMvu8iwRf9goS33pSKJngASEjVtrP4EvAKSvuKWoHtNnLf+0h7HqAoaKUXEbqlDlupK+7lCuTvCIfMJJRrHTWTqBLOFn6DrlDxCSI9OVQF8e6jUIzHvqKGELLK7cErgshANZ5dYN9+XumDCg3ThmgF9OfF6d1pclc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713978622; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=w8fmNK6lWstHDkHAiX3GTp5ypgknN5T6iIFnYWpyosQ=; b=naShstA1JZmtYviSIOZq4ddmCl+xKs7GcDFyCa1II+B9VtQH99Nq6MrcvA/0mGrvQvFPCV6oLyO/UkPWVA8K1XY6gg78bxAA063FE4+ec6yrYei/AITnSTYBH63VxZW83J2yy0wJwUhRTau0fnLgST2fT6bwuEdMpoKKRKRG++Q= 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 1713978622791618.1060571452085; Wed, 24 Apr 2024 10:10:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzg7a-00020d-FA; Wed, 24 Apr 2024 13:09:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzg7T-0001zB-GH for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:19 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzg7R-0005Mt-Mu for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:19 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1e4c4fb6af3so1221315ad.0 for ; Wed, 24 Apr 2024 10:09:17 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e80800b001e0b5d49fc7sm12215489plg.161.2024.04.24.10.09.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 10:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713978556; x=1714583356; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=w8fmNK6lWstHDkHAiX3GTp5ypgknN5T6iIFnYWpyosQ=; b=aJYTh7RrI9l9gg6BYo2p55gIN9ximdsaeYUriOnIwpjHbFUTMQ0BFpSrmHIH19x8xs SmQ+zdaf4ic4FDxgF1oe5S76zPUtgFjRi44yRqIG+Htz5PGckhruplSk2sQHxrH3CcUX HUjG7dvWfcBhkoAPBKaat66FVOusmcy3/7P+IQJo110xLYVJh+XFWSP7DIjDz4oaR1l1 XVCWDWUDvNMeXGCYXiCbrtrgnF5+ESTCmRrEcz1DiZcrIClmM/pr+hTPRqrsXxqnZsd6 tkx3+iTP5mQDuaODgQ1Yks4Ts95+FGW8mmrGRHcJOSALlXdkKfOEmFswjxYSzFjm2w02 W9EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713978556; x=1714583356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w8fmNK6lWstHDkHAiX3GTp5ypgknN5T6iIFnYWpyosQ=; b=fnspTB5ng+KCViOTxxHnnFXSKAXKQN7k7voALoPto+xy+BF38+3YckjugG0uicuYiO ZO/kmqcSH09zsq82VfATR+/4hV6rIEz+9C0osMP73rTGdQU2Uwa320tbcmWN5K6anzMY Ktn8oZcW4+8HCLx11uFVHPxXIfT+du/Ejni7VeJtHnZySE85W1Pe1vI+kgSl3tOgHyUY wvp8g1d0vQem8QQljE9uh5XyZTJmQ1p14Ih1keRZxNJH26hyTF8ov1jIV5ytkTlPjVRx OvkqesmcQWzZDtawYhj9sORSWhwe+QGOaa5xEdRTYuZw+Zk7/1qmEEnuv4xGQoDy08Q1 QC1Q== X-Gm-Message-State: AOJu0YyYscTXx/ikZjadpDU5JHttQ1nfOXV8+3Bp5E0XrG2CDiGQECy0 buBbWHb7kfBvt3uVGQd+nx/tqgGrsVM/Qze5KFuw4wh0TitzYd3GxzcvpjW862Mkd572UvlO9A1 c X-Google-Smtp-Source: AGHT+IFzf1W/uabRb1bkLAVqusgu4GqxiBa8/gftHoDHYhBmMqipipZkMapO6iGfHppE1ARhUwuh+g== X-Received: by 2002:a17:902:e149:b0:1e4:3c7f:c179 with SMTP id d9-20020a170902e14900b001e43c7fc179mr294478pla.12.1713978556088; Wed, 24 Apr 2024 10:09:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/5] tcg/i386: Optimize setcond of TST{EQ,NE} with 0xffffffff Date: Wed, 24 Apr 2024 10:09:06 -0700 Message-Id: <20240424170908.759043-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424170908.759043-1-richard.henderson@linaro.org> References: <20240424170908.759043-1-richard.henderson@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=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1713978623053100001 Content-Type: text/plain; charset="utf-8" This may be treated as a 32-bit EQ/NE comparison against 0, which is in turn treated as a LTU/GEU comparison against 1. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tcg/i386/tcg-target.c.inc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 6837c519b0..59235b4f38 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1658,6 +1658,7 @@ static void tcg_out_setcond(TCGContext *s, int rexw, = TCGCond cond, TCGArg dest, TCGArg arg1, TCGArg arg2, int const_arg2, bool neg) { + int cmp_rexw =3D rexw; bool inv =3D false; bool cleared; int jcc; @@ -1674,6 +1675,18 @@ static void tcg_out_setcond(TCGContext *s, int rexw,= TCGCond cond, } break; =20 + case TCG_COND_TSTNE: + inv =3D true; + /* fall through */ + case TCG_COND_TSTEQ: + /* If arg2 is -1, convert to LTU/GEU vs 1. */ + if (const_arg2 && arg2 =3D=3D 0xffffffffu) { + arg2 =3D 1; + cmp_rexw =3D 0; + goto do_ltu; + } + break; + case TCG_COND_LEU: inv =3D true; /* fall through */ @@ -1697,7 +1710,7 @@ static void tcg_out_setcond(TCGContext *s, int rexw, = TCGCond cond, * We can then use NEG or INC to produce the desired result. * This is always smaller than the SETCC expansion. */ - tcg_out_cmp(s, TCG_COND_LTU, arg1, arg2, const_arg2, rexw); + tcg_out_cmp(s, TCG_COND_LTU, arg1, arg2, const_arg2, cmp_rexw); =20 /* X - X - C =3D -C =3D (C ? -1 : 0) */ tgen_arithr(s, ARITH_SBB + (neg ? rexw : 0), dest, dest); @@ -1744,7 +1757,7 @@ static void tcg_out_setcond(TCGContext *s, int rexw, = TCGCond cond, cleared =3D true; } =20 - jcc =3D tcg_out_cmp(s, cond, arg1, arg2, const_arg2, rexw); + jcc =3D tcg_out_cmp(s, cond, arg1, arg2, const_arg2, cmp_rexw); tcg_out_modrm(s, OPC_SETCC | jcc, 0, dest); =20 if (!cleared) { --=20 2.34.1 From nobody Sat May 18 07:48:50 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=1713978640; cv=none; d=zohomail.com; s=zohoarc; b=C+g106NSaleeSRiIntqVLSPrpkI3lXUkQhpSiNEfIt3nPKGjj2huNJMh7N43Uo3IgGIFf38kicqjtrAtRD3pjPBMWUCrbs0K2pespXGI1uudiHAMd+LWRs7bbREWIoly4wX4X+9fUp+aB1jIRr/CJH9bL8V3hbZ+r6O062NHrI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713978640; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=5odWkAYeVMNCe6Cty3EzFB4YygxLZJZYtuimpCAAowk=; b=XIKmbvIi66HLnMGUa3D5Gqw1SO/6l6Yv033fPcddRmSyXmqacswmo58zHuvLzp3sPWemU01Hr1mJJ71mOv43FkbKO20Op9Z9kJfSU5u1PvvgKtCBMcQBPWWZ+UiXH/+8zFeU/YUzcSzKA3GjYHAg1b5ouH9x+/ZDe6PeNPrsQfw= 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 1713978640661499.7613893397163; Wed, 24 Apr 2024 10:10:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzg7c-00021D-RS; Wed, 24 Apr 2024 13:09:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzg7V-0001zh-Nx for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:22 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzg7T-0005NL-QR for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:21 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e3ca4fe4cfso229835ad.2 for ; Wed, 24 Apr 2024 10:09:19 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e80800b001e0b5d49fc7sm12215489plg.161.2024.04.24.10.09.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 10:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713978558; x=1714583358; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=5odWkAYeVMNCe6Cty3EzFB4YygxLZJZYtuimpCAAowk=; b=w0NXHGyst2MBcklpeOWnqA9xZASv4SNFQyu/cCYj2yvahdzFp3h8G0QI5mQjxnh1uT mfzn0CwYlomMnWtP3VGuZZzKwyF77jtc2aVTI7jtIs2Zd7H/5kpwDMlysbk69LqluxXv uT8qGgfmywCluU/WptqN0ir51ewGD2IpJY11Mcve9I/gvyZSGhlaYkilA5pA6NXK1faF U1K8nOdmFXE0sGoQZbMxDqhzp+FEtKjgdCfI/6XIc0vu8X+r6EqeTY1Du0C9nz8fhVBF GO/lh/rbcLYlQIqzTLqg57iBtpe8WUTqa9P/cW/I7IN1QfuKIKDCcDARVnZ8jmCIoMW7 nYqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713978558; x=1714583358; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5odWkAYeVMNCe6Cty3EzFB4YygxLZJZYtuimpCAAowk=; b=t9GA2HqV5nq48LGqhzHWQ/dquTUNNucvt8wsFEKNe7QjkXj95MjxEf0tArunOHpGuN lFSYo4rPELa+zeY7/JomsELsTzgNhHSj/XH9GBv5V7A+T+ul2JKY7z23Yx0T94A3l0mU DtIrlayyX/Rs+/bvXuSwoutjdMlaXh7VhSg6FWc/NKoNIOvbfQ0K18l4cq8DqFhFThxd PtmHnaDHepi8qCnqAASCUxjSBwekyiof71YeQEYVOiKUTKN1x/cht+dpoNQRDdQguN1b OGsgCTWab/zG3gB0Y0FCiUme4xyK10JCPAGJea0qbt2qOjUDHCCAkDrlYocwelnIaSq3 n4HA== X-Gm-Message-State: AOJu0Yw60s5rO9YXsh+gXlegPcmu3hms6o+x992WEHGRsahEaQHp2HU7 rNk9m4ls9UnrxcuxRYARjR+L3DfgPWbPWZx8pMg0AfVXBLo1olLcSRlKXzXCUwnF0IRLdAQCgvF f X-Google-Smtp-Source: AGHT+IEG5mkJaOUXDGH5Lh2fZO5v15uZ/cATGc+mxF/W2E8EqUarBb0u8jCpVioujWSjdjQYq0nkLg== X-Received: by 2002:a17:902:e944:b0:1e3:dfdc:6972 with SMTP id b4-20020a170902e94400b001e3dfdc6972mr4491816pll.9.1713978558138; Wed, 24 Apr 2024 10:09:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 4/5] tcg/optimize: Optimize setcond with zmask Date: Wed, 24 Apr 2024 10:09:07 -0700 Message-Id: <20240424170908.759043-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424170908.759043-1-richard.henderson@linaro.org> References: <20240424170908.759043-1-richard.henderson@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=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1713978641191100001 Content-Type: text/plain; charset="utf-8" If we can show that high bits of an input are zero, then we may optimize away some comparisons. Signed-off-by: Richard Henderson --- tcg/optimize.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/tcg/optimize.c b/tcg/optimize.c index 2e9e5725a9..8886f7037a 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2099,6 +2099,108 @@ static bool fold_remainder(OptContext *ctx, TCGOp *= op) return false; } =20 +static bool fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg) +{ + uint64_t a_zmask, b_val; + TCGCond cond; + + if (!arg_is_const(op->args[2])) { + return false; + } + + a_zmask =3D arg_info(op->args[1])->z_mask; + b_val =3D arg_info(op->args[2])->val; + cond =3D op->args[3]; + + if (ctx->type =3D=3D TCG_TYPE_I32) { + a_zmask =3D (uint32_t)a_zmask; + b_val =3D (uint32_t)b_val; + } + + /* + * A with only low bits set vs B with high bits set means that A < B. + */ + if (a_zmask < b_val) { + bool inv =3D false; + + switch (cond) { + case TCG_COND_NE: + case TCG_COND_LEU: + case TCG_COND_LTU: + inv =3D true; + /* fall through */ + case TCG_COND_GTU: + case TCG_COND_GEU: + case TCG_COND_EQ: + return tcg_opt_gen_movi(ctx, op, op->args[0], neg ? -inv : inv= ); + default: + break; + } + } + + /* + * A with only lsb set is already boolean. + */ + if (a_zmask <=3D 1) { + bool convert =3D false; + bool inv =3D false; + + switch (cond) { + case TCG_COND_EQ: + inv =3D true; + /* fall through */ + case TCG_COND_NE: + convert =3D (b_val =3D=3D 0); + break; + case TCG_COND_LTU: + case TCG_COND_TSTEQ: + inv =3D true; + /* fall through */ + case TCG_COND_GEU: + case TCG_COND_TSTNE: + convert =3D (b_val =3D=3D 1); + break; + default: + break; + } + if (convert) { + TCGOpcode add_opc, xor_opc, neg_opc; + + if (!inv && !neg) { + return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]); + } + + switch (ctx->type) { + case TCG_TYPE_I32: + add_opc =3D INDEX_op_add_i32; + neg_opc =3D INDEX_op_neg_i32; + xor_opc =3D INDEX_op_xor_i32; + break; + case TCG_TYPE_I64: + add_opc =3D INDEX_op_add_i64; + neg_opc =3D INDEX_op_neg_i64; + xor_opc =3D INDEX_op_xor_i64; + break; + default: + g_assert_not_reached(); + } + + if (!inv) { + op->opc =3D neg_opc; + } else if (neg) { + op->opc =3D add_opc; + op->args[2] =3D arg_new_constant(ctx, -1); + } else { + op->opc =3D xor_opc; + op->args[2] =3D arg_new_constant(ctx, 1); + } + return false; + } + } + + return false; +} + static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) { TCGOpcode and_opc, sub_opc, xor_opc, neg_opc, shr_opc; @@ -2200,6 +2302,10 @@ static bool fold_setcond(OptContext *ctx, TCGOp *op) if (i >=3D 0) { return tcg_opt_gen_movi(ctx, op, op->args[0], i); } + + if (fold_setcond_zmask(ctx, op, false)) { + return true; + } fold_setcond_tst_pow2(ctx, op, false); =20 ctx->z_mask =3D 1; @@ -2214,6 +2320,10 @@ static bool fold_negsetcond(OptContext *ctx, TCGOp *= op) if (i >=3D 0) { return tcg_opt_gen_movi(ctx, op, op->args[0], -i); } + + if (fold_setcond_zmask(ctx, op, true)) { + return true; + } fold_setcond_tst_pow2(ctx, op, true); =20 /* Value is {0,-1} so all bits are repetitions of the sign. */ --=20 2.34.1 From nobody Sat May 18 07:48:50 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=1713978607; cv=none; d=zohomail.com; s=zohoarc; b=Lp+eE2JiGHqAl6xNwyoHIca30bMQkwKwcgpCz/wUitNn5vhYz3H5AxBLLQtVL5GR5p1Y0kYjYhPOxysrH5ENb1w/kckT/IdTitSioVF/NQJiAD+e+P5xA7gC/+5iRBzxvznW17ZnYXNG2G6Te4kzdnQzH2hNhyaSxEAqrQN3Mw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713978607; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=qLklIJJZiY2n6UNAfojZ7eG/b6Y2VQ38WZLeXE8ZXgQ=; b=NnUcS0WZ+ah6AsHaA78R5bEv9XpYPyw/A0UZETw1pridIdQqcLtxHHvFsFlkdUnU6rbSY/vRyS2jNq9B1QJ6zvkvMCwQ51N9HqwVEruHL4bk82fr4ilHHUbU5iatrEJ86KuWvWYwu9ScS/isSKQA1kbP4Efvou21AbtMzbXZRHo= 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 1713978607054462.09619438278946; Wed, 24 Apr 2024 10:10:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzg7b-00020h-2S; Wed, 24 Apr 2024 13:09:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzg7W-000200-Vs for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:24 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzg7V-0005Ng-Ec for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:22 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1e9ffd3f96eso209325ad.3 for ; Wed, 24 Apr 2024 10:09:21 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e80800b001e0b5d49fc7sm12215489plg.161.2024.04.24.10.09.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 10:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713978560; x=1714583360; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qLklIJJZiY2n6UNAfojZ7eG/b6Y2VQ38WZLeXE8ZXgQ=; b=mExn48ViZ2PFjYG72WwmF0aC58p3mflSOWx9tejM4jSo3gkIk2WxIrotkRquP55dnR OOa68TV0o5DL6Dvti3s5NC41da8Nk8aVSpIQ0Ds2k/Gs26PDedRSlYrJcXb+GYuFVQxp MoXwpyDwDXtAIVLV82TvkyACPYtfoFSettxPNzvjxbjFeLxzF/UKjKaSwEi/dyyVg9fh ylHLkOqQsEAu9Yc3FNkJgD4anMspQmfOYHHPYtS9VrqRxM0Kgh6qtFVuR7eo5d6+PDGi HML2v53IEP9IABxJS7w0gGnSSqJL60LB1/cVESz2/aJLjfZ5LRR3ZtqprCY9SIar3pRx FRJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713978560; x=1714583360; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qLklIJJZiY2n6UNAfojZ7eG/b6Y2VQ38WZLeXE8ZXgQ=; b=mVTlSKLaAyGFPGQkzB0LvTt96UHFlivYfGWWG8nT7pl4Y/qNeUduSvo2ZGC5KIsiDW OEZqFIcSiA5tNfuYSLw3+kpUsvdO7YZVVP/1WUhsvj9D59K/33pQxOoBL0CcrPO8J3Y8 J2eJWWbc5kYy7iuWUU5nVC9E6TLChpFuL7OsbA/gA+jr7NMBLdDy9NTXymS8aDcV41QO vliFU1YGFSPzBj5wAmX5aMbRi+5Gx8U0h0lWu0tFw8dpIUel7MeXMc1LxGSLUxmxV9qX P7axYRF1kRRdO5dobjzjM/sU6awhVorPnRrhRzqiRSgPMRxU9OGFLV1iJM32pmpfKaTX cXEA== X-Gm-Message-State: AOJu0Yw9eogKry3r1CfyXCaq/RM74FpmnFVciQXBjGJI8Rs4pg7mx98m ic+ZYAxkUWtXmOW/waKzb0MD1Soy2vf1Uh6MXJHL7SZZ+Yusr8JSIUJCfIMhuKOa4klgWO8CLLL L X-Google-Smtp-Source: AGHT+IHuY0kILNYu1JgmMm9Q25UC2bjl3zpvSNohWVpiYxz3vz2PBs4LAKg53gTAGGub2DfXyUHhdw== X-Received: by 2002:a17:902:d2ce:b0:1e1:1791:3681 with SMTP id n14-20020a170902d2ce00b001e117913681mr4084590plc.61.1713978560055; Wed, 24 Apr 2024 10:09:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 5/5] accel/tcg: Introduce CF_BP_PAGE Date: Wed, 24 Apr 2024 10:09:08 -0700 Message-Id: <20240424170908.759043-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424170908.759043-1-richard.henderson@linaro.org> References: <20240424170908.759043-1-richard.henderson@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=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1713978609090100006 Content-Type: text/plain; charset="utf-8" Record the fact that we've found a breakpoint on the page in which a TranslationBlock is running. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/translation-block.h | 1 + accel/tcg/cpu-exec.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/exec/translation-block.h b/include/exec/translation-bl= ock.h index 48211c890a..a6d1af6e9b 100644 --- a/include/exec/translation-block.h +++ b/include/exec/translation-block.h @@ -77,6 +77,7 @@ struct TranslationBlock { #define CF_PARALLEL 0x00008000 /* Generate code for a parallel contex= t */ #define CF_NOIRQ 0x00010000 /* Generate an uninterruptible TB */ #define CF_PCREL 0x00020000 /* Opcodes in TB are PC-relative */ +#define CF_BP_PAGE 0x00040000 /* Breakpoint present in code page */ #define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */ #define CF_CLUSTER_SHIFT 24 =20 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 5c70748060..26bf968ff3 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -368,7 +368,7 @@ static bool check_for_breakpoints_slow(CPUState *cpu, v= addr pc, * breakpoints are removed. */ if (match_page) { - *cflags =3D (*cflags & ~CF_COUNT_MASK) | CF_NO_GOTO_TB | 1; + *cflags =3D (*cflags & ~CF_COUNT_MASK) | CF_NO_GOTO_TB | CF_BP_PAG= E | 1; } return false; } --=20 2.34.1 From nobody Sat May 18 07:48:50 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=1713978607; cv=none; d=zohomail.com; s=zohoarc; b=REFF4tyEVqDq4mdDLwlkeZOS4hG0MSEznHYU/ZVmK1Tybk6j5h0jyBophAxQEzBR7aIXLoGq57taxUVOL15z70RHbhu109xzxSTglcH29nDXqG3NS5s45G7JX/gOdZPPyySanuNeDaOr1zwCWZJwMEHLV2O+iWMvEvWj63Q9qZI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713978607; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=39YtgjPga6zni7TyfrRqLQG7p9NAFXqRFglkaRLeOY8=; b=hQx5y767Lfs7z9XPb1sDWGDFPvsgP7mHNYz5IKgRz/2evLC2DYTTz+F6kn1lk+NxgfBAgjbWTGRdt40mTM9WWqnPjSd+tNnekSGo046ebFFvKqWpVAsMckqFMDgJZqgr7Ds+ql8a6S5KYvpWcZL15Vri1YedyHBjNcPY9x5T0Lw= 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 1713978607052149.70296633931673; Wed, 24 Apr 2024 10:10:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzg7Q-0001yB-LP; Wed, 24 Apr 2024 13:09:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzg7O-0001xR-Sw for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:14 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzg7N-0005M4-F2 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 13:09:14 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1e411e339b8so234425ad.3 for ; Wed, 24 Apr 2024 10:09:13 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e80800b001e0b5d49fc7sm12215489plg.161.2024.04.24.10.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 10:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713978552; x=1714583352; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=39YtgjPga6zni7TyfrRqLQG7p9NAFXqRFglkaRLeOY8=; b=riY7IcgvqpyOOaYmLVHR+TEDUfAIXdU5SXlEvDEYFzxkJJJK4Tgs81O3lv4kGgDNRa O0bDTt7GcE5WtobBbwIapEagi1Bo3H9Q8H6DQLqlJbAI7dcweUXvPoQf8JLp4OyUdNWv jIvUolKhSRsel6/fQGf0PjP8ahP/8ZKXmKkCVxTkfbWhfG9KNF57uKd6Apxtc66OP0Ul aiWAmOKFGzNI5dsz3Z73PpMBaUI8ttI6MINBF9t34Y+TlAnH4M4fa4S3vOJkTWJaRqnK 4r6UqlMeXGpuYY7P2rK28InvW6YRuvowkjTZMz2h6ZU2HPaCTRvndSkj3wAxRkYM9ZSM iOqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713978552; x=1714583352; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=39YtgjPga6zni7TyfrRqLQG7p9NAFXqRFglkaRLeOY8=; b=MCwpOOwciGlLAZs3P7kqq+gUrF7HctRPqR6XxBkKzPX3ZQSlhSvm7StnfUK9Rw7zxn mqCLb+5Dyaf2g95GXBaEtc90lcv5iTkThs75mCXDmpHZmv9IIRo6MePKOkHGpjyO6EoM U77vqNbNdVPwHxlHvA91jccAA/yMkmAmZOeliBY6WdGFlYo/lksIfAVcy2g6Bc19gxAO Zxf9NrmlLN18Px5kEqBOSfYJ1RgiBaXulqI98i+gyPkBfoQbVsh1WqjIgqW4XzU2AbJD KG0Q/oCvS5Bx12aIMjeNWwtmNLTXXNpnRuZQj2wExrwEgHSS+AXgV3KhfOfiNGMFXlgb Zfsw== X-Gm-Message-State: AOJu0YxwNks/Bi+vUC9+AiDZyqe/t30rEoBN3x5vDin5nDb/vmmMge+z oDpIT8qaFYEJnh/qMSdqd3CzzeLteh5QbwFAWx+cinto5awbLVz0NKxvQ9q+IPhwFVy5U0X+Owi X X-Google-Smtp-Source: AGHT+IEi3kaQhKL6ZwhR5d9UW/yKOsN8PNq3Jv+ifr5sUV3Xb+LjKF0Kd1q6M5LpjTtCHg82uZLKiw== X-Received: by 2002:a17:902:e944:b0:1e3:dfdc:6972 with SMTP id b4-20020a170902e94400b001e3dfdc6972mr4491229pll.9.1713978552013; Wed, 24 Apr 2024 10:09:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= , qemu-stable@nongnu.org Subject: [PATCH] target/arm: Restrict translation disabled alignment check to VMSA Date: Wed, 24 Apr 2024 10:09:03 -0700 Message-Id: <20240424170908.759043-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424170908.759043-1-richard.henderson@linaro.org> References: <20240424170908.759043-1-richard.henderson@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=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1713978609085100005 For cpus using PMSA, when the MPU is disabled, the default memory type is Normal, Non-cachable. Fixes: 59754f85ed3 ("target/arm: Do memory type alignment check when transl= ation disabled") Reported-by: Cl=C3=A9ment Chigot Signed-off-by: Richard Henderson --- Since v9 will likely be tagged tomorrow without this fixed, Cc: qemu-stable@nongnu.org --- target/arm/tcg/hflags.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c index 5da1b0fc1d..66de30b828 100644 --- a/target/arm/tcg/hflags.c +++ b/target/arm/tcg/hflags.c @@ -38,8 +38,16 @@ static bool aprofile_require_alignment(CPUARMState *env,= int el, uint64_t sctlr) } =20 /* - * If translation is disabled, then the default memory type is - * Device(-nGnRnE) instead of Normal, which requires that alignment + * With PMSA, when the MPU is disabled, all memory types in the + * default map is Normal. + */ + if (arm_feature(env, ARM_FEATURE_PMSA)) { + return false; + } + + /* + * With VMSA, if translation is disabled, then the default memory type + * is Device(-nGnRnE) instead of Normal, which requires that alignment * be enforced. Since this affects all ram, it is most efficient * to handle this during translation. */ --=20 2.34.1