From patchwork Thu Sep 19 13:10:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829621 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319935wrn; Thu, 19 Sep 2024 06:18:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCURC53KdD5owQLNBzvv+U3v9Jl1bsSmwImH4mNqTCOdz+gx1qHMAehnxQk3UyJRUJMGZZrf6A==@linaro.org X-Google-Smtp-Source: AGHT+IGjsIydURW6OiT7krEvGlIdUE8eZifpIkPanPMulsfR6gHmU6ZK9ViEirtoUkJKQLh83Ia2 X-Received: by 2002:a05:620a:48f:b0:7ab:3679:2e6f with SMTP id af79cd13be357-7ab36792eecmr2647457085a.36.1726751932151; Thu, 19 Sep 2024 06:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751932; cv=none; d=google.com; s=arc-20240605; b=emlACQzQ7HewhxZDizkPEDiESp/LkZQGkwqAchgfX06p0L+GJPW2vCrLT93iDi3a4D AY1Sr2uSE3tFyIY73ZpQGEMvmX6kRmO4SwpKLfhvIOq/fDfvcPomfWYgWQFPp+lEqYMR PgCYAMXK8RkG4d75pX3qiqevX8oyYYYNdw2mNcYQispoo9yg12g6Ru4I7Sym17AmQui8 XCbkZIsxga0LqegFeBwU+vrN0y9TDobiE7f/jx+IpCIIT9AaALHgXKqKMGleAkW5cTSL CDFjYSU8dJ2a83i+41zc5gZ790J/cW95XWacyy1IbxcOpOhutb4G3lspWcnb+TCCqMiB yNlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=CW1Od08F73V7hTLa/GFIqEy9kNMCIX26bAK7DGcDQj4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=C01F3FtfpGFwuPtaqCznicLorsQbZiqtxqveZlT2Lz9dMYWJmIYepBElSbQiAF9Coy mxtd9fTQCZuTe/9wHSgy684XcBjnqk9SU17FRQ+OivvSj6lhyXqyWvee041jozgvcg6R ifCY5kCkNq5GzureTyjiwf7ePHp5ZpEDCLAt9JONCHcIZWX8btlhnJtTKx4KRZd7dZ85 dbcSD11otwiLvZLdbwW2ajqowka8QGmusjUp/BvYU9saU3zLIAsv3VEkAJRvFvZ0bI8Y FjfSlJzGUxpYsjjO4sRFbANkmJ0slBpfjEiPb0ignxvbMBsZ9Erzl0KcmPy6+LK7zvmp UVBQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MvzsKQHn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb08c7970si185856585a.300.2024.09.19.06.18.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MvzsKQHn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwK-0004hc-AY; Thu, 19 Sep 2024 09:11:20 -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 1srGwF-0004Tn-DC for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:15 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwA-0000zn-Ht for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:14 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42cafda818aso7650085e9.2 for ; Thu, 19 Sep 2024 06:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751468; x=1727356268; 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=CW1Od08F73V7hTLa/GFIqEy9kNMCIX26bAK7DGcDQj4=; b=MvzsKQHnoF6PBzKpk7BUGGUwfAjY+p7whWg8zblxLAK6CvLz6Q34u8iOXzd7R7FRJy BVyFB0PwQXwaSgv93lhvOivg14+pRzbcwEY3KWHuxKFWLkdRzoQO9FhjIv2rSdhdnctn 1wNvV6btZdDMQnmYd1YYxkC2B4ELyzhdRmWHhI0zGL1ns94CV2x3J/pKuBmOgVe/qNNk Y8x6vHFZjcWMPanZleVlD8oc7iR7ANohUDtgP4aP8tIb/lwSoHSchllpkDR48g9j9Nzk 5n7aiumUcnr37Giyz1dynP+bJfKWpe+ssGW6Hno9W8UL+fHNO34N0SJYIOLPpqlg4hIC 1lnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751468; x=1727356268; 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=CW1Od08F73V7hTLa/GFIqEy9kNMCIX26bAK7DGcDQj4=; b=KS53OKz0d7viqU+fnJgNbW2vT4qIFeSBaheq+e59xJPOagrSrpy6REF6gFVVOQ6boN hpA28p8pwZwzp39hNU/AbyVO3axDS7IorwurQYMEJSJyWU5keDx8+rC/sK/wYmkoUdIx AxdedFZrwqYagz7zr/SNXXNUzHUMUCwKNI53MzuDnZqtX4tBWnTmztZfdRNV5gKkBsrN sn4VhpaCopxmxRVAfom9UykbuSLV6kTnebGB4pA836AL+o8JxSPK2vJ7e4+lwKHAwBd/ qSH8ATSHjYuK1zJfCBQG8HSJhnAQ6xSYLF7H5NrXUoX2l9rVwrLVnZD73I9bf0nC+P3a DyZw== X-Gm-Message-State: AOJu0YwdZvTIkt+NGUTjsGac6LyYIB+RK2AT53MmOK4+OZNzzYmkGVSG /ycmgoRGCc4MSHPTPExWYBbm2xdxHgtmQmdcGuyCCQGm2mP7bvATWc/1wBUXlE4ALmBFx/1ycnM 9 X-Received: by 2002:a05:600c:3581:b0:42c:c8be:4217 with SMTP id 5b1f17b1804b1-42cdb53192dmr178890215e9.11.1726751468328; Thu, 19 Sep 2024 06:11:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:08 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/38] target/arm: Replace tcg_gen_dupi_vec with constants in gengvec.c Date: Thu, 19 Sep 2024 14:10:29 +0100 Message-Id: <20240919131106.3362543-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Instead of copying a constant into a temporary with dupi, use a vector constant directly. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/gengvec.c | 43 ++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 56a1dc1f755..726a1383aed 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -297,10 +297,9 @@ void gen_srshr32_i32(TCGv_i32 d, TCGv_i32 a, int32_t sh) static void gen_srshr_vec(unsigned vece, TCGv_vec d, TCGv_vec a, int64_t sh) { TCGv_vec t = tcg_temp_new_vec_matching(d); - TCGv_vec ones = tcg_temp_new_vec_matching(d); + TCGv_vec ones = tcg_constant_vec_matching(d, vece, 1); tcg_gen_shri_vec(vece, t, a, sh - 1); - tcg_gen_dupi_vec(vece, ones, 1); tcg_gen_and_vec(vece, t, t, ones); tcg_gen_sari_vec(vece, d, a, sh); tcg_gen_add_vec(vece, d, d, t); @@ -492,10 +491,9 @@ void gen_urshr64_i64(TCGv_i64 d, TCGv_i64 a, int64_t sh) static void gen_urshr_vec(unsigned vece, TCGv_vec d, TCGv_vec a, int64_t shift) { TCGv_vec t = tcg_temp_new_vec_matching(d); - TCGv_vec ones = tcg_temp_new_vec_matching(d); + TCGv_vec ones = tcg_constant_vec_matching(d, vece, 1); tcg_gen_shri_vec(vece, t, a, shift - 1); - tcg_gen_dupi_vec(vece, ones, 1); tcg_gen_and_vec(vece, t, t, ones); tcg_gen_shri_vec(vece, d, a, shift); tcg_gen_add_vec(vece, d, d, t); @@ -685,9 +683,9 @@ static void gen_shr64_ins_i64(TCGv_i64 d, TCGv_i64 a, int64_t shift) static void gen_shr_ins_vec(unsigned vece, TCGv_vec d, TCGv_vec a, int64_t sh) { TCGv_vec t = tcg_temp_new_vec_matching(d); - TCGv_vec m = tcg_temp_new_vec_matching(d); + int64_t mi = MAKE_64BIT_MASK((8 << vece) - sh, sh); + TCGv_vec m = tcg_constant_vec_matching(d, vece, mi); - tcg_gen_dupi_vec(vece, m, MAKE_64BIT_MASK((8 << vece) - sh, sh)); tcg_gen_shri_vec(vece, t, a, sh); tcg_gen_and_vec(vece, d, d, m); tcg_gen_or_vec(vece, d, d, t); @@ -773,10 +771,9 @@ static void gen_shl64_ins_i64(TCGv_i64 d, TCGv_i64 a, int64_t shift) static void gen_shl_ins_vec(unsigned vece, TCGv_vec d, TCGv_vec a, int64_t sh) { TCGv_vec t = tcg_temp_new_vec_matching(d); - TCGv_vec m = tcg_temp_new_vec_matching(d); + TCGv_vec m = tcg_constant_vec_matching(d, vece, MAKE_64BIT_MASK(0, sh)); tcg_gen_shli_vec(vece, t, a, sh); - tcg_gen_dupi_vec(vece, m, MAKE_64BIT_MASK(0, sh)); tcg_gen_and_vec(vece, d, d, m); tcg_gen_or_vec(vece, d, d, t); } @@ -1044,14 +1041,13 @@ static void gen_ushl_vec(unsigned vece, TCGv_vec dst, TCGv_vec rval = tcg_temp_new_vec_matching(dst); TCGv_vec lsh = tcg_temp_new_vec_matching(dst); TCGv_vec rsh = tcg_temp_new_vec_matching(dst); - TCGv_vec msk, max; + TCGv_vec max; tcg_gen_neg_vec(vece, rsh, shift); if (vece == MO_8) { tcg_gen_mov_vec(lsh, shift); } else { - msk = tcg_temp_new_vec_matching(dst); - tcg_gen_dupi_vec(vece, msk, 0xff); + TCGv_vec msk = tcg_constant_vec_matching(dst, vece, 0xff); tcg_gen_and_vec(vece, lsh, shift, msk); tcg_gen_and_vec(vece, rsh, rsh, msk); } @@ -1064,9 +1060,6 @@ static void gen_ushl_vec(unsigned vece, TCGv_vec dst, tcg_gen_shlv_vec(vece, lval, src, lsh); tcg_gen_shrv_vec(vece, rval, src, rsh); - max = tcg_temp_new_vec_matching(dst); - tcg_gen_dupi_vec(vece, max, 8 << vece); - /* * The choice of LT (signed) and GEU (unsigned) are biased toward * the instructions of the x86_64 host. For MO_8, the whole byte @@ -1074,6 +1067,7 @@ static void gen_ushl_vec(unsigned vece, TCGv_vec dst, * have already masked to a byte and so a signed compare works. * Other tcg hosts have a full set of comparisons and do not care. */ + max = tcg_constant_vec_matching(dst, vece, 8 << vece); if (vece == MO_8) { tcg_gen_cmp_vec(TCG_COND_GEU, vece, lsh, lsh, max); tcg_gen_cmp_vec(TCG_COND_GEU, vece, rsh, rsh, max); @@ -1170,6 +1164,7 @@ static void gen_sshl_vec(unsigned vece, TCGv_vec dst, TCGv_vec lsh = tcg_temp_new_vec_matching(dst); TCGv_vec rsh = tcg_temp_new_vec_matching(dst); TCGv_vec tmp = tcg_temp_new_vec_matching(dst); + TCGv_vec max, zero; /* * Rely on the TCG guarantee that out of range shifts produce @@ -1180,15 +1175,15 @@ static void gen_sshl_vec(unsigned vece, TCGv_vec dst, if (vece == MO_8) { tcg_gen_mov_vec(lsh, shift); } else { - tcg_gen_dupi_vec(vece, tmp, 0xff); - tcg_gen_and_vec(vece, lsh, shift, tmp); - tcg_gen_and_vec(vece, rsh, rsh, tmp); + TCGv_vec msk = tcg_constant_vec_matching(dst, vece, 0xff); + tcg_gen_and_vec(vece, lsh, shift, msk); + tcg_gen_and_vec(vece, rsh, rsh, msk); } /* Bound rsh so out of bound right shift gets -1. */ - tcg_gen_dupi_vec(vece, tmp, (8 << vece) - 1); - tcg_gen_umin_vec(vece, rsh, rsh, tmp); - tcg_gen_cmp_vec(TCG_COND_GT, vece, tmp, lsh, tmp); + max = tcg_constant_vec_matching(dst, vece, (8 << vece) - 1); + tcg_gen_umin_vec(vece, rsh, rsh, max); + tcg_gen_cmp_vec(TCG_COND_GT, vece, tmp, lsh, max); tcg_gen_shlv_vec(vece, lval, src, lsh); tcg_gen_sarv_vec(vece, rval, src, rsh); @@ -1197,12 +1192,12 @@ static void gen_sshl_vec(unsigned vece, TCGv_vec dst, tcg_gen_andc_vec(vece, lval, lval, tmp); /* Select between left and right shift. */ + zero = tcg_constant_vec_matching(dst, vece, 0); if (vece == MO_8) { - tcg_gen_dupi_vec(vece, tmp, 0); - tcg_gen_cmpsel_vec(TCG_COND_LT, vece, dst, lsh, tmp, rval, lval); + tcg_gen_cmpsel_vec(TCG_COND_LT, vece, dst, lsh, zero, rval, lval); } else { - tcg_gen_dupi_vec(vece, tmp, 0x80); - tcg_gen_cmpsel_vec(TCG_COND_LT, vece, dst, lsh, tmp, lval, rval); + TCGv_vec sgn = tcg_constant_vec_matching(dst, vece, 0x80); + tcg_gen_cmpsel_vec(TCG_COND_LT, vece, dst, lsh, sgn, lval, rval); } } From patchwork Thu Sep 19 13:10:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829607 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316906wrn; Thu, 19 Sep 2024 06:13:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVWogAqU7rkQTsXG/EJ1Rlw3BtGy6+a2ztC4rqkp6AHNlkeJlW0m6nVJ9xMdmbypyjEjnVtSw==@linaro.org X-Google-Smtp-Source: AGHT+IEHNNhaCGuTr5Z1eR4jflWc+ZtyeSX59ilfiYYiqK6agsg2fnKfI8IBOeMcY17yojUxritq X-Received: by 2002:a05:6808:10c5:b0:3d9:2319:48ac with SMTP id 5614622812f47-3e071a850a7mr24956696b6e.9.1726751600952; Thu, 19 Sep 2024 06:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751600; cv=none; d=google.com; s=arc-20240605; b=IOKTL3oz/wyjQuZb4CpPztObR6sbe08/7ztIDinQGVhyn7AmThuT79UT9jZxOlISWp jfxgSpIF+tY71+ctnKc5/NDLDm2cOxAtDZcHn3qU6LpYywtS48vNy8B5p60SbzwahCHA PynPd3bEO3gFSCd4Y6e1tdWcZX4bIEchQKUj37Q2asPn//1WWJjYYSfmzMjUrrQuHUwz 3ybi9ay+Ysmfwt5v/m9d12kJb7XVEXEGB8t8nyUowbtf+OCwLTXr9Vfae2ubUl8dnYLN maEfdTN69ijFjaJAOdti7kMas1khisrKZieik1Nqhw1FfdTHQKukdbK/9FlwW/Nbr9HW BXzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ssn9H7VrIbql77q/bvO9LinYCZ18sNmlwvuHxervBLY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=k/KUhzcA//czqzCSR4Opz3IaeoFtYTDFgV7RX7JoDdEPhoyb+LaLsFVb4SxZy27Upg e32WCUMp6Vy3tj/Jw4VTv0YTuJKCxRSRdi3rq8RKRoEyhXrZpnHeb19yaiJCF1wWPD1c SGdWOrc5zpNbwj5CAhtOVwotpBKc3fBZvJeQ3Q3vj1Fz5KTYOoPvMrfQtmCZ6XgmfFbf 0GMhoWdEizjMs+xbBZK+K+HdrpZ0CVQktcGBSOqQVKsI+6pZrJ9ZEm53XE4UA/+abwdj QrhCr3zQptK7csBo2pC7yuV2514hrCbXRReCqmAvydFlTP4NqycuVFP869F5jiG1id5j 2jbQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=opY0+KIB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a1e0cc1a2514c-8493994c42dsi2430991241.164.2024.09.19.06.13.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:13:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=opY0+KIB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwL-0004l2-Al; Thu, 19 Sep 2024 09:11:21 -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 1srGwF-0004Ty-In for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:16 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwA-0000zr-MP for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:14 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-42e5e1e6d37so7615495e9.3 for ; Thu, 19 Sep 2024 06:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751469; x=1727356269; 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=ssn9H7VrIbql77q/bvO9LinYCZ18sNmlwvuHxervBLY=; b=opY0+KIB26u5hTyyE+UysA6HFJb/lM9s5eCD+pQAhQg67DKERu+c96QLcVcED6wH4P VBXprEnxFQQVElNRyeMufacLcolbiUuFE0q0xzmf83U9LITh89sHGz2obbEg8QjaT8z0 4voUr6krnDMJ2SUQB+Z6dK6XywtbEqRE+Z9JQ3v7MKUdtuP4yTiHWunXk0EgIjR1zc7b mRDVu8qyrxqZtAg0BX1Ut5APM2dULxTEgtealAhMJismni5fftzN2FH1YL2NRVOFxIrD kxw6Fb6v+mMf0d9FJaMborZ4WHDedsz1cQ0HRvgneF8Ip9sFbVJPXnjoUgWzZTJOz7Bk O3Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751469; x=1727356269; 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=ssn9H7VrIbql77q/bvO9LinYCZ18sNmlwvuHxervBLY=; b=bV142Yrnr+JjeYVtg/vfBpjxJ4Eri3y+M2MsLVSJxszemt20VvNm6bYCT9szxFiQXR +ggMj7PwLgTwIVVxsgz0bESaGYY0eftkBuXDcFTYOM2MwLgqYOk14MZCj32xnRJuT3a0 ol8yDr8mlpoluoJIoT3XY7lIL5wzaMrWXGbnwVEnDYle/Y3D1948/PrZlkgEWTZ+SMbX SUsDU27Qlzvh4cTb3mJm8S652jns+9Y80IYacy/XFbdLbw6pIVOrBBOb20EU5zrHvGoe a1XZtPgngyaQmlq0rjadAbbYUgM5F/7sH+AF6J7ZmVV/796e3WGnr9J6bcTRfz3FMHdg 5lFA== X-Gm-Message-State: AOJu0YyPWR0mWWZUpnGJjyDoph4aTQq38VJlLEGBtO8n1s8ibYAswztz nsXHhNcxJQs3ciRoz5Y4+N4p0R14RYTw+C7nyW8QcaAYiu2Mx/AcJ4GVxREiyNfZlwJcqashkPL u X-Received: by 2002:a05:600c:4f81:b0:42c:b7f9:4bbd with SMTP id 5b1f17b1804b1-42cdb586ccfmr193756785e9.26.1726751468933; Thu, 19 Sep 2024 06:11:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:08 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/38] target/arm: Replace tcg_gen_dupi_vec with constants in translate-sve.c Date: Thu, 19 Sep 2024 14:10:30 +0100 Message-Id: <20240919131106.3362543-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Instead of copying a constant into a temporary with dupi, use a vector constant directly. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-3-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate-sve.c | 128 +++++++++++++-------------------- 1 file changed, 49 insertions(+), 79 deletions(-) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 9e2536dfe99..49d32fabc9d 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -6081,9 +6081,9 @@ static void gen_sshll_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t imm) if (top) { if (shl == halfbits) { - TCGv_vec t = tcg_temp_new_vec_matching(d); - tcg_gen_dupi_vec(vece, t, MAKE_64BIT_MASK(halfbits, halfbits)); - tcg_gen_and_vec(vece, d, n, t); + tcg_gen_and_vec(vece, d, n, + tcg_constant_vec_matching(d, vece, + MAKE_64BIT_MASK(halfbits, halfbits))); } else { tcg_gen_sari_vec(vece, d, n, halfbits); tcg_gen_shli_vec(vece, d, d, shl); @@ -6138,18 +6138,18 @@ static void gen_ushll_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t imm) if (top) { if (shl == halfbits) { - TCGv_vec t = tcg_temp_new_vec_matching(d); - tcg_gen_dupi_vec(vece, t, MAKE_64BIT_MASK(halfbits, halfbits)); - tcg_gen_and_vec(vece, d, n, t); + tcg_gen_and_vec(vece, d, n, + tcg_constant_vec_matching(d, vece, + MAKE_64BIT_MASK(halfbits, halfbits))); } else { tcg_gen_shri_vec(vece, d, n, halfbits); tcg_gen_shli_vec(vece, d, d, shl); } } else { if (shl == 0) { - TCGv_vec t = tcg_temp_new_vec_matching(d); - tcg_gen_dupi_vec(vece, t, MAKE_64BIT_MASK(0, halfbits)); - tcg_gen_and_vec(vece, d, n, t); + tcg_gen_and_vec(vece, d, n, + tcg_constant_vec_matching(d, vece, + MAKE_64BIT_MASK(0, halfbits))); } else { tcg_gen_shli_vec(vece, d, n, halfbits); tcg_gen_shri_vec(vece, d, d, halfbits - shl); @@ -6317,18 +6317,14 @@ static const TCGOpcode sqxtn_list[] = { static void gen_sqxtnb_vec(unsigned vece, TCGv_vec d, TCGv_vec n) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; int64_t mask = (1ull << halfbits) - 1; int64_t min = -1ull << (halfbits - 1); int64_t max = -min - 1; - tcg_gen_dupi_vec(vece, t, min); - tcg_gen_smax_vec(vece, d, n, t); - tcg_gen_dupi_vec(vece, t, max); - tcg_gen_smin_vec(vece, d, d, t); - tcg_gen_dupi_vec(vece, t, mask); - tcg_gen_and_vec(vece, d, d, t); + tcg_gen_smax_vec(vece, d, n, tcg_constant_vec_matching(d, vece, min)); + tcg_gen_smin_vec(vece, d, d, tcg_constant_vec_matching(d, vece, max)); + tcg_gen_and_vec(vece, d, d, tcg_constant_vec_matching(d, vece, mask)); } static const GVecGen2 sqxtnb_ops[3] = { @@ -6349,19 +6345,15 @@ TRANS_FEAT(SQXTNB, aa64_sve2, do_narrow_extract, a, sqxtnb_ops) static void gen_sqxtnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; int64_t mask = (1ull << halfbits) - 1; int64_t min = -1ull << (halfbits - 1); int64_t max = -min - 1; - tcg_gen_dupi_vec(vece, t, min); - tcg_gen_smax_vec(vece, n, n, t); - tcg_gen_dupi_vec(vece, t, max); - tcg_gen_smin_vec(vece, n, n, t); + tcg_gen_smax_vec(vece, n, n, tcg_constant_vec_matching(d, vece, min)); + tcg_gen_smin_vec(vece, n, n, tcg_constant_vec_matching(d, vece, max)); tcg_gen_shli_vec(vece, n, n, halfbits); - tcg_gen_dupi_vec(vece, t, mask); - tcg_gen_bitsel_vec(vece, d, t, d, n); + tcg_gen_bitsel_vec(vece, d, tcg_constant_vec_matching(d, vece, mask), d, n); } static const GVecGen2 sqxtnt_ops[3] = { @@ -6389,12 +6381,10 @@ static const TCGOpcode uqxtn_list[] = { static void gen_uqxtnb_vec(unsigned vece, TCGv_vec d, TCGv_vec n) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; int64_t max = (1ull << halfbits) - 1; - tcg_gen_dupi_vec(vece, t, max); - tcg_gen_umin_vec(vece, d, n, t); + tcg_gen_umin_vec(vece, d, n, tcg_constant_vec_matching(d, vece, max)); } static const GVecGen2 uqxtnb_ops[3] = { @@ -6415,14 +6405,13 @@ TRANS_FEAT(UQXTNB, aa64_sve2, do_narrow_extract, a, uqxtnb_ops) static void gen_uqxtnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; int64_t max = (1ull << halfbits) - 1; + TCGv_vec maxv = tcg_constant_vec_matching(d, vece, max); - tcg_gen_dupi_vec(vece, t, max); - tcg_gen_umin_vec(vece, n, n, t); + tcg_gen_umin_vec(vece, n, n, maxv); tcg_gen_shli_vec(vece, n, n, halfbits); - tcg_gen_bitsel_vec(vece, d, t, d, n); + tcg_gen_bitsel_vec(vece, d, maxv, d, n); } static const GVecGen2 uqxtnt_ops[3] = { @@ -6450,14 +6439,11 @@ static const TCGOpcode sqxtun_list[] = { static void gen_sqxtunb_vec(unsigned vece, TCGv_vec d, TCGv_vec n) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; int64_t max = (1ull << halfbits) - 1; - tcg_gen_dupi_vec(vece, t, 0); - tcg_gen_smax_vec(vece, d, n, t); - tcg_gen_dupi_vec(vece, t, max); - tcg_gen_umin_vec(vece, d, d, t); + tcg_gen_smax_vec(vece, d, n, tcg_constant_vec_matching(d, vece, 0)); + tcg_gen_umin_vec(vece, d, d, tcg_constant_vec_matching(d, vece, max)); } static const GVecGen2 sqxtunb_ops[3] = { @@ -6478,16 +6464,14 @@ TRANS_FEAT(SQXTUNB, aa64_sve2, do_narrow_extract, a, sqxtunb_ops) static void gen_sqxtunt_vec(unsigned vece, TCGv_vec d, TCGv_vec n) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; int64_t max = (1ull << halfbits) - 1; + TCGv_vec maxv = tcg_constant_vec_matching(d, vece, max); - tcg_gen_dupi_vec(vece, t, 0); - tcg_gen_smax_vec(vece, n, n, t); - tcg_gen_dupi_vec(vece, t, max); - tcg_gen_umin_vec(vece, n, n, t); + tcg_gen_smax_vec(vece, n, n, tcg_constant_vec_matching(d, vece, 0)); + tcg_gen_umin_vec(vece, n, n, maxv); tcg_gen_shli_vec(vece, n, n, halfbits); - tcg_gen_bitsel_vec(vece, d, t, d, n); + tcg_gen_bitsel_vec(vece, d, maxv, d, n); } static const GVecGen2 sqxtunt_ops[3] = { @@ -6551,13 +6535,11 @@ static void gen_shrnb64_i64(TCGv_i64 d, TCGv_i64 n, int64_t shr) static void gen_shrnb_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t shr) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; uint64_t mask = MAKE_64BIT_MASK(0, halfbits); tcg_gen_shri_vec(vece, n, n, shr); - tcg_gen_dupi_vec(vece, t, mask); - tcg_gen_and_vec(vece, d, n, t); + tcg_gen_and_vec(vece, d, n, tcg_constant_vec_matching(d, vece, mask)); } static const TCGOpcode shrnb_vec_list[] = { INDEX_op_shri_vec, 0 }; @@ -6609,13 +6591,11 @@ static void gen_shrnt64_i64(TCGv_i64 d, TCGv_i64 n, int64_t shr) static void gen_shrnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t shr) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; uint64_t mask = MAKE_64BIT_MASK(0, halfbits); tcg_gen_shli_vec(vece, n, n, halfbits - shr); - tcg_gen_dupi_vec(vece, t, mask); - tcg_gen_bitsel_vec(vece, d, t, d, n); + tcg_gen_bitsel_vec(vece, d, tcg_constant_vec_matching(d, vece, mask), d, n); } static const TCGOpcode shrnt_vec_list[] = { INDEX_op_shli_vec, 0 }; @@ -6658,14 +6638,12 @@ TRANS_FEAT(RSHRNT, aa64_sve2, do_shr_narrow, a, rshrnt_ops) static void gen_sqshrunb_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t shr) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; + uint64_t max = MAKE_64BIT_MASK(0, halfbits); tcg_gen_sari_vec(vece, n, n, shr); - tcg_gen_dupi_vec(vece, t, 0); - tcg_gen_smax_vec(vece, n, n, t); - tcg_gen_dupi_vec(vece, t, MAKE_64BIT_MASK(0, halfbits)); - tcg_gen_umin_vec(vece, d, n, t); + tcg_gen_smax_vec(vece, n, n, tcg_constant_vec_matching(d, vece, 0)); + tcg_gen_umin_vec(vece, d, n, tcg_constant_vec_matching(d, vece, max)); } static const TCGOpcode sqshrunb_vec_list[] = { @@ -6690,16 +6668,15 @@ TRANS_FEAT(SQSHRUNB, aa64_sve2, do_shr_narrow, a, sqshrunb_ops) static void gen_sqshrunt_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t shr) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; + uint64_t max = MAKE_64BIT_MASK(0, halfbits); + TCGv_vec maxv = tcg_constant_vec_matching(d, vece, max); tcg_gen_sari_vec(vece, n, n, shr); - tcg_gen_dupi_vec(vece, t, 0); - tcg_gen_smax_vec(vece, n, n, t); - tcg_gen_dupi_vec(vece, t, MAKE_64BIT_MASK(0, halfbits)); - tcg_gen_umin_vec(vece, n, n, t); + tcg_gen_smax_vec(vece, n, n, tcg_constant_vec_matching(d, vece, 0)); + tcg_gen_umin_vec(vece, n, n, maxv); tcg_gen_shli_vec(vece, n, n, halfbits); - tcg_gen_bitsel_vec(vece, d, t, d, n); + tcg_gen_bitsel_vec(vece, d, maxv, d, n); } static const TCGOpcode sqshrunt_vec_list[] = { @@ -6742,18 +6719,15 @@ TRANS_FEAT(SQRSHRUNT, aa64_sve2, do_shr_narrow, a, sqrshrunt_ops) static void gen_sqshrnb_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t shr) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; int64_t max = MAKE_64BIT_MASK(0, halfbits - 1); int64_t min = -max - 1; + int64_t mask = MAKE_64BIT_MASK(0, halfbits); tcg_gen_sari_vec(vece, n, n, shr); - tcg_gen_dupi_vec(vece, t, min); - tcg_gen_smax_vec(vece, n, n, t); - tcg_gen_dupi_vec(vece, t, max); - tcg_gen_smin_vec(vece, n, n, t); - tcg_gen_dupi_vec(vece, t, MAKE_64BIT_MASK(0, halfbits)); - tcg_gen_and_vec(vece, d, n, t); + tcg_gen_smax_vec(vece, n, n, tcg_constant_vec_matching(d, vece, min)); + tcg_gen_smin_vec(vece, n, n, tcg_constant_vec_matching(d, vece, max)); + tcg_gen_and_vec(vece, d, n, tcg_constant_vec_matching(d, vece, mask)); } static const TCGOpcode sqshrnb_vec_list[] = { @@ -6778,19 +6752,16 @@ TRANS_FEAT(SQSHRNB, aa64_sve2, do_shr_narrow, a, sqshrnb_ops) static void gen_sqshrnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t shr) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; int64_t max = MAKE_64BIT_MASK(0, halfbits - 1); int64_t min = -max - 1; + int64_t mask = MAKE_64BIT_MASK(0, halfbits); tcg_gen_sari_vec(vece, n, n, shr); - tcg_gen_dupi_vec(vece, t, min); - tcg_gen_smax_vec(vece, n, n, t); - tcg_gen_dupi_vec(vece, t, max); - tcg_gen_smin_vec(vece, n, n, t); + tcg_gen_smax_vec(vece, n, n, tcg_constant_vec_matching(d, vece, min)); + tcg_gen_smin_vec(vece, n, n, tcg_constant_vec_matching(d, vece, max)); tcg_gen_shli_vec(vece, n, n, halfbits); - tcg_gen_dupi_vec(vece, t, MAKE_64BIT_MASK(0, halfbits)); - tcg_gen_bitsel_vec(vece, d, t, d, n); + tcg_gen_bitsel_vec(vece, d, tcg_constant_vec_matching(d, vece, mask), d, n); } static const TCGOpcode sqshrnt_vec_list[] = { @@ -6833,12 +6804,11 @@ TRANS_FEAT(SQRSHRNT, aa64_sve2, do_shr_narrow, a, sqrshrnt_ops) static void gen_uqshrnb_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t shr) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; + int64_t max = MAKE_64BIT_MASK(0, halfbits); tcg_gen_shri_vec(vece, n, n, shr); - tcg_gen_dupi_vec(vece, t, MAKE_64BIT_MASK(0, halfbits)); - tcg_gen_umin_vec(vece, d, n, t); + tcg_gen_umin_vec(vece, d, n, tcg_constant_vec_matching(d, vece, max)); } static const TCGOpcode uqshrnb_vec_list[] = { @@ -6863,14 +6833,14 @@ TRANS_FEAT(UQSHRNB, aa64_sve2, do_shr_narrow, a, uqshrnb_ops) static void gen_uqshrnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t shr) { - TCGv_vec t = tcg_temp_new_vec_matching(d); int halfbits = 4 << vece; + int64_t max = MAKE_64BIT_MASK(0, halfbits); + TCGv_vec maxv = tcg_constant_vec_matching(d, vece, max); tcg_gen_shri_vec(vece, n, n, shr); - tcg_gen_dupi_vec(vece, t, MAKE_64BIT_MASK(0, halfbits)); - tcg_gen_umin_vec(vece, n, n, t); + tcg_gen_umin_vec(vece, n, n, maxv); tcg_gen_shli_vec(vece, n, n, halfbits); - tcg_gen_bitsel_vec(vece, d, t, d, n); + tcg_gen_bitsel_vec(vece, d, maxv, d, n); } static const TCGOpcode uqshrnt_vec_list[] = { From patchwork Thu Sep 19 13:10:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829599 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316310wrn; Thu, 19 Sep 2024 06:12:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWaYVtsCTv4rKNbuSpufPnBEmpK/6I1Xiv6xK9YEF2OogdmzGSxXgNfc1SvHXL43LrUFc06Dw==@linaro.org X-Google-Smtp-Source: AGHT+IGabwSTXWJi9T8d5oOJMbk6ELnN7zs/ebrRc4Eu8AHpi1utHUx5SADe7jnbY+o5O49tFXX0 X-Received: by 2002:a05:6808:3207:b0:3e0:4ed8:80a4 with SMTP id 5614622812f47-3e07a1331ffmr12916260b6e.28.1726751527377; Thu, 19 Sep 2024 06:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751527; cv=none; d=google.com; s=arc-20240605; b=hoG5/I8EG4bz9fls3Nh9214Q7JMOQ1jLBFwL/Wq/aZm3cuSqpAiTQUlHNpDtg+IrmR uv+t8jqoCx++66z2xXfq65q3vC5eiIcwQfI9iURg3cyZvNyGtPd37dvgn86MzRCUldbx 84fn+xtpg5qwkFkh3aNFLNxWkAaUXAJnAcBnjWrXtc6qBjUczhPaDoQ0pCLgcwU/gtGL bB0oFgTkl7/KNI2YenkW8kniZVoT2mOjg+TItLA5+Kfahc99QTiLIzLTqPg6nlGbSPV/ OD8MXUS7J9amTWqMYDEdXKMAfI7VtO3VLUHz2dvEUIR0IrTku8Ch4a0cRAiy7SDceUUX IRsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=He6YBSgRqmlZmIL7adkdTXMZx39goQaKpXwPEt+3grs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=VtiBQtq4bMQQyCMSsb/IviBNf0OHc+7d0+VFxGNCG9CSQN8zwGpVMY1+U9G3KOheE6 Jo5YOdoRY10Hvf+pKSz3H56PvoQXDq75OTS8/wuD2H87mJGbS7oAf1awi5xW+75ciplN uGE/IHlt7a9cup7vDIZpuGRfvYI+wGc2/epBItTvSaBxsOT7tmhaQN0cEUfoz1lhTDQW IYWSaEVM+/oNWzzC+972CD3Witf0oTNLlfLK0IJ9cp/Awk1GIfSuMKL9w9dWE7nmFViQ i4Qo1ay96SWs35lJcOu8iU6Hnam9ExVLdG9+p6oa7nfmuJvf+pybDKgbFCqBuPvu8vuF 52nQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwJmh3L4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a1e0cc1a2514c-8493990c38esi2058069241.119.2024.09.19.06.12.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:12:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwJmh3L4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwJ-0004dd-EB; Thu, 19 Sep 2024 09:11: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 1srGwE-0004Sz-Od for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:14 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwB-0000zw-3l for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:13 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42cacabd2e0so6925015e9.3 for ; Thu, 19 Sep 2024 06:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751469; x=1727356269; 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=He6YBSgRqmlZmIL7adkdTXMZx39goQaKpXwPEt+3grs=; b=xwJmh3L4Zc1scCPkauPp8ZiXEucFVL3SC0HDEeyHBk0+YjQVael30atiHQUctb1u2A Eyvo9YjW1W7vGZFLAuH+oylor1DPRVJwvuOI2UQXwHUO7PG1u/kwoUxyEdY5PhVS8kCF 8rxMiWsscUSXEsVzwYO0kYfb71/DTnbpRZcHzK0CO1syauZdK4DKmOuTmzpI/r+QllaH cZhkefrrsrrgvki2ieaIfUXOLKkwJC+yKLTWGMA4qDnn4k+XtBOW57C4tyDcAPQRTFVm f6LEx+m7EF+4WaJChk8IqNIHaNI+4Ga485g6/Fy5rNPgLhG0noAbIKPAP1QHbscLSW3V D8Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751469; x=1727356269; 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=He6YBSgRqmlZmIL7adkdTXMZx39goQaKpXwPEt+3grs=; b=OCpF0ewHGOS6VKq8n8BWSywI7xYCD5wJHHNa/fU2ZfMSKEStqRbbHSGyccOTuT9zg6 XT3QeVFGB/aCMr8PynLHVrzFOf07V0FkKfWQzAus+2k/oNYhvVIXDHiRSXVYebxUbkmu gMmU11XLaEggaHawSPjmTWkd4iRC7adAP0ZTbumE3jB+V49Q5Pzg32xYsvYhuu3DwEa4 hTGOdVqvMjJDVHYNnys/vFo7cprCqizSMaQmTw8p0Z93Eo7gbKggr/o3ubw+n/pwpxF0 nV+pjDpNgaEXR2DwSvbX5nPMBJ/lwlI1d0K7Q4eCgYGagNTDmvX5S20jEKT0NZ9o5Man 77tg== X-Gm-Message-State: AOJu0YzwS0b81bJcNiDhia8TGTlLxKKfUf0ChG5XgknguHEmGASdTedt VKFe0+OWqMt6dmHQpXLwbQiobX388nftCdxF4ggCxvFpyaKsl7zmjbEnhp5j48NbcOfXfl0dEJh d X-Received: by 2002:a05:600c:3108:b0:42c:be90:fa2f with SMTP id 5b1f17b1804b1-42cdb5662bfmr205865065e9.25.1726751469457; Thu, 19 Sep 2024 06:11:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/38] target/arm: Use cmpsel in gen_ushl_vec Date: Thu, 19 Sep 2024 14:10:31 +0100 Message-Id: <20240919131106.3362543-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Instead of cmp+and or cmp+andc, use cmpsel. This will be better for hosts that use predicate registers for cmp. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-4-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/gengvec.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 726a1383aed..3edbf3a2627 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -1041,7 +1041,7 @@ static void gen_ushl_vec(unsigned vece, TCGv_vec dst, TCGv_vec rval = tcg_temp_new_vec_matching(dst); TCGv_vec lsh = tcg_temp_new_vec_matching(dst); TCGv_vec rsh = tcg_temp_new_vec_matching(dst); - TCGv_vec max; + TCGv_vec max, zero; tcg_gen_neg_vec(vece, rsh, shift); if (vece == MO_8) { @@ -1061,23 +1061,20 @@ static void gen_ushl_vec(unsigned vece, TCGv_vec dst, tcg_gen_shrv_vec(vece, rval, src, rsh); /* - * The choice of LT (signed) and GEU (unsigned) are biased toward + * The choice of GE (signed) and GEU (unsigned) are biased toward * the instructions of the x86_64 host. For MO_8, the whole byte * is significant so we must use an unsigned compare; otherwise we * have already masked to a byte and so a signed compare works. * Other tcg hosts have a full set of comparisons and do not care. */ + zero = tcg_constant_vec_matching(dst, vece, 0); max = tcg_constant_vec_matching(dst, vece, 8 << vece); if (vece == MO_8) { - tcg_gen_cmp_vec(TCG_COND_GEU, vece, lsh, lsh, max); - tcg_gen_cmp_vec(TCG_COND_GEU, vece, rsh, rsh, max); - tcg_gen_andc_vec(vece, lval, lval, lsh); - tcg_gen_andc_vec(vece, rval, rval, rsh); + tcg_gen_cmpsel_vec(TCG_COND_GEU, vece, lval, lsh, max, zero, lval); + tcg_gen_cmpsel_vec(TCG_COND_GEU, vece, rval, rsh, max, zero, rval); } else { - tcg_gen_cmp_vec(TCG_COND_LT, vece, lsh, lsh, max); - tcg_gen_cmp_vec(TCG_COND_LT, vece, rsh, rsh, max); - tcg_gen_and_vec(vece, lval, lval, lsh); - tcg_gen_and_vec(vece, rval, rval, rsh); + tcg_gen_cmpsel_vec(TCG_COND_GE, vece, lval, lsh, max, zero, lval); + tcg_gen_cmpsel_vec(TCG_COND_GE, vece, rval, rsh, max, zero, rval); } tcg_gen_or_vec(vece, dst, lval, rval); } @@ -1087,7 +1084,7 @@ void gen_gvec_ushl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, { static const TCGOpcode vecop_list[] = { INDEX_op_neg_vec, INDEX_op_shlv_vec, - INDEX_op_shrv_vec, INDEX_op_cmp_vec, 0 + INDEX_op_shrv_vec, INDEX_op_cmpsel_vec, 0 }; static const GVecGen3 ops[4] = { { .fniv = gen_ushl_vec, From patchwork Thu Sep 19 13:10:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829603 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316704wrn; Thu, 19 Sep 2024 06:12:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWovBmVScoWwYtBmMtCNm555IKsyuxgm9bl/4oeV8Tmn8teJYJcNUXHizewQEQ0UpGXWQpjtQ==@linaro.org X-Google-Smtp-Source: AGHT+IGReJL2VPrC9k0WLu2xP2RrFeOmMaoFJBF38ibHgT4kbqFFVhCvQ0WHLllIlqsqJniuptll X-Received: by 2002:a05:6122:3710:b0:501:13b1:d2e0 with SMTP id 71dfb90a1353d-503c9b824f5mr2346499e0c.1.1726751575565; Thu, 19 Sep 2024 06:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751575; cv=none; d=google.com; s=arc-20240605; b=Idr2plVVf4EjpyldUQvbsotO0NZ6bo2spKqpsrLyAPaULmSjvjHn3V+13DuX4MMAcO maNRSkT4sKqznlE70Bna988YQC/svcboKJMIqBsZEew2UT+eB/hwiJXfRDlxsCRBGwJZ Xo3Ac0yai9cIt9pQ+zn+jGKT0nkuD6+kE5YdyLzshwwnXqJzdAkMH20/8DC+mhf6Yx04 f8coDiwByjLitwxVpHGZ2ACXEW7ZQzj71NlaxAYnG7SFlozFS4wAx65lKMVb94OupY2N ZJhLdCmadMBtc/hAUFN9vTAt3vozh2HUAl9xrEbwQWRROphk0C88Y78acmDlbLswPukR LALQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yJUYEhTNiz8x7jW5BdcZtlOjlfWgR1fgHUkwcdaNL2s=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=VuA4D+Ls5yggqIdXT9vkyk0oE5ahkDoNnMFH6UOK3DmsvCAkpHxYMdgA7K4uEQ59Nv w4pZzPnZt1Bpa1dwy4OG58QNvkLfMRoe5hn17i17zfH04rkI32KwQHMH8qHisPgspyP6 FPthQs+jSLUmMiL4iCOXz9tApElHNm2A1kND9c9Ow29IH3uvxFtriDHyWYazie6bQd55 a0+Ho8KxV53DwwsR8LxndqEc3u7o0sjhHTE8P2niTQzgXoi6DYyjljXsEttaZNgqxRPQ Ss/JXxq447/+l0JQ04DUE6WpjRQ8FHJ2SmM9kCaiodfyg9V81okA1HdPyaRmnlhA5lDS pPrQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UnWSGbjV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5035bc817desi2467273e0c.231.2024.09.19.06.12.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UnWSGbjV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwI-0004Xg-EE; Thu, 19 Sep 2024 09:11: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 1srGwF-0004Tl-Dd for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:15 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwB-000105-Kz for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:13 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-42bb7298bdeso10283695e9.1 for ; Thu, 19 Sep 2024 06:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751470; x=1727356270; 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=yJUYEhTNiz8x7jW5BdcZtlOjlfWgR1fgHUkwcdaNL2s=; b=UnWSGbjVkFHYKDRJ3N4FXxzNJmzRxWv8pa7mXko1KRVWA5C4RcAMughRDhwWz9V83j EpzCfBM7JW7SvFmFbNqG4uVJ7Yo9Bb5atGSy9nklMYP5qkGmprJz47whsfuvifvbMAOc yTTQcPh1wcb4khPZE/TYNg3cB4Ycd9NYW/bF97ujea7qPAFbFR/u+6XH11234+ghE9Ed EQi2aO1O/ffX71GES7+9lHph5fFozAjCCSqM063xK0A66Ruk071lEwJcAJ82tqnPtyxe 5PXbe47LJC7q5MEWv6lld98x+mkezIdi4YxUrPhYQX6fvbIodrJtJhecGLCBtRD+Vhz0 5/Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751470; x=1727356270; 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=yJUYEhTNiz8x7jW5BdcZtlOjlfWgR1fgHUkwcdaNL2s=; b=r25lWFsoYbO16JVZt4PMvvr3SPHTfyyP1779U/E8VLFYfb4HKPQN13IAfBopkagZ// 4r6vPI4tMF/IUn94is9Z3DC5su2TKqtkSsQccP56zArga7i4TlRl0IG3j/0b+uZyfkXs fYPrqzMH+kbwHTat7I2usjn7zZHN5U8QDxZgiFbHIe4TGxi5iMvrbypx4MLD4DKGNKZZ JP6V76EXINuWaaxNhS7RtQAEFmvb0DsFjQtbk3vP/iG/QJeqizfC3xxyQvitBwkdxxYD D+m8f6BBbEpIw/+xMwkj2UjEze1RP0n4DD2Zg8fxO9KgbPtxabELOS+hAufnaT/Kt+i2 Wnbw== X-Gm-Message-State: AOJu0YwdzGFEkOogFh68CUTmJVK1RXBL3pOA9kKdYhJ3TXRVhaxUdusX WkC6olv3Fdi7l1mLPWZcSCrx8SslrIIFIhkJYIJ9TzSrrcs04/0/30ymL7saizO9GZ0+9BxyQjg 4 X-Received: by 2002:a05:600c:4f01:b0:42c:aeaa:6b0d with SMTP id 5b1f17b1804b1-42d907205a5mr212889925e9.9.1726751469997; Thu, 19 Sep 2024 06:11:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/38] target/arm: Use cmpsel in gen_sshl_vec Date: Thu, 19 Sep 2024 14:10:32 +0100 Message-Id: <20240919131106.3362543-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Instead of cmp+and or cmp+andc, use cmpsel. This will be better for hosts that use predicate registers for cmp. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-5-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/gengvec.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 3edbf3a2627..c5fc1b6cfbf 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -1160,7 +1160,6 @@ static void gen_sshl_vec(unsigned vece, TCGv_vec dst, TCGv_vec rval = tcg_temp_new_vec_matching(dst); TCGv_vec lsh = tcg_temp_new_vec_matching(dst); TCGv_vec rsh = tcg_temp_new_vec_matching(dst); - TCGv_vec tmp = tcg_temp_new_vec_matching(dst); TCGv_vec max, zero; /* @@ -1180,16 +1179,15 @@ static void gen_sshl_vec(unsigned vece, TCGv_vec dst, /* Bound rsh so out of bound right shift gets -1. */ max = tcg_constant_vec_matching(dst, vece, (8 << vece) - 1); tcg_gen_umin_vec(vece, rsh, rsh, max); - tcg_gen_cmp_vec(TCG_COND_GT, vece, tmp, lsh, max); tcg_gen_shlv_vec(vece, lval, src, lsh); tcg_gen_sarv_vec(vece, rval, src, rsh); /* Select in-bound left shift. */ - tcg_gen_andc_vec(vece, lval, lval, tmp); + zero = tcg_constant_vec_matching(dst, vece, 0); + tcg_gen_cmpsel_vec(TCG_COND_GT, vece, lval, lsh, max, zero, lval); /* Select between left and right shift. */ - zero = tcg_constant_vec_matching(dst, vece, 0); if (vece == MO_8) { tcg_gen_cmpsel_vec(TCG_COND_LT, vece, dst, lsh, zero, rval, lval); } else { @@ -1203,7 +1201,7 @@ void gen_gvec_sshl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, { static const TCGOpcode vecop_list[] = { INDEX_op_neg_vec, INDEX_op_umin_vec, INDEX_op_shlv_vec, - INDEX_op_sarv_vec, INDEX_op_cmp_vec, INDEX_op_cmpsel_vec, 0 + INDEX_op_sarv_vec, INDEX_op_cmpsel_vec, 0 }; static const GVecGen3 ops[4] = { { .fniv = gen_sshl_vec, From patchwork Thu Sep 19 13:10:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829611 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp317419wrn; Thu, 19 Sep 2024 06:14:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVdWe3nk5IeQi4cYitztdEuNUF3MidpARW6gqoPOU0NvLpJZbczmM1WLRRrp/NqCizU3GiWMw==@linaro.org X-Google-Smtp-Source: AGHT+IHQvl5fOIar1caphSF6PlKOXUFv/jy2rwusvd4XDQbavz/lHtoDy0G/KXauSqkewxOD6lHK X-Received: by 2002:a05:6122:3288:b0:4f5:197a:d679 with SMTP id 71dfb90a1353d-503c9ba3e45mr1863125e0c.1.1726751659035; Thu, 19 Sep 2024 06:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751659; cv=none; d=google.com; s=arc-20240605; b=gvJAFYs062QQrLdIdy8oC9W6UtDkwlOCT/Vsy5jKA+j3LT7KjZ6IGJSmsldm/oi9dw oTxdHt1fHdwKObeATgtqRBLpfLHL0z3Z97oRsQ/nNzWiVNN0FJXUk8QR9h6xSpw9HPEE fzWN0ROd9mcWIwlqehKA5IOdKCF+b2MP/9N5BOG4XJf235aKEC9gr54voYT7f4BG4EPL KWmuZ0W6e7Xz+0nwGeSvmcfPPyuXGu0GzG2Q+Pw8lER9FPhZv7xSTQN1IBlOaUnRJOaV Q2XacfXhEIbG2JX8K/MsWdgNw8pIsEbuxfixR09qX2Ksq7MaxdqIgCNwK+fopVoJZSu5 cf4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PwISEcabRGvIN2Ug75sruZUxfeshtkeh7kv+0zeczuo=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=K2OC3MW0bhNcSok1ZjZweGpYCdqqK06lXniyvL9gYkwnMb209FvfWyz9sSlS/ouP1B isR95oBLzZHW3f5jWxnkh/htdJDwvz9hgg72DlinEpK6OGGUvJ9+1DMD47dW3+O0IJWj cHFU2hTzlEsDz2yJ2A3pBj2gaYOErhNXm2ISmBbx1vroNo1JEymgcu2RKNR+m2dGg1mb 0ldkwmgPTi5UXG6Mknkqs29Wn926vfdrH75pjeEy+VqttNWgvqR4th+Zu6Y/TYPXvNYn fV3XvNF6PZoFzECZz01Udjjpex/bb66Vw6U3afPf9KgTKeecsqo1WPb4AIriBe1vCjeu LE+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cplLOTvd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5035bb52981si2579330e0c.145.2024.09.19.06.14.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:14:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cplLOTvd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwL-0004i7-3I; Thu, 19 Sep 2024 09:11:21 -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 1srGwE-0004T0-PV for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:14 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwC-00010B-3d for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:14 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42cb9a0c300so7125165e9.0 for ; Thu, 19 Sep 2024 06:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751470; x=1727356270; 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=PwISEcabRGvIN2Ug75sruZUxfeshtkeh7kv+0zeczuo=; b=cplLOTvdKS7F8EPDN089sY8dKjW9FEnj7HFjTWuzuizsiEs2tQd/XP5orltteiuhFd yvM7r4i0GlVsx5P3c2cX9CnZOGrO6Fnh/d0o0pD5VWU+WYj7cmlELI5NADaZDwj6oqdI P+AldwP+zJ/IbhNTwhKb/U7H6uhzUKcOFjRMt23FoQP7QmDkCSWXWBQgNWDYwAVpEd2M AhBRRbKFgJsxcNRqTt+BiWuvKX3q2kOTPZlMo76l7wyRgUMA5YWqqSC2C4yJXV3WuhUk Y9jbXb1qK+6NLiKuqhyyTRqMCIGl+d87HWvuPXuurGQoSv+4kj8SmhmPKxTL3/YPKv5Q C8jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751470; x=1727356270; 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=PwISEcabRGvIN2Ug75sruZUxfeshtkeh7kv+0zeczuo=; b=roGpvKXmLdztKv6/eNhrUDK9ZGy9ZGXsZv9HFXHGOJoynjaUbLeQteWufog6ew6j2O XUpnNaOMBcUyoI3E1yeE6pXYexuT0VkrvjvZdcf8xmVdSmtjTgxtqA+joF0vcOJcwKSD 4WoDCip10QHDGAM5/1Gbh/hUfzHAnNhBjKLMo7EAbAfzRcRMhFWg7Bfi9tU8PHX/aHji gkYLXedPHkDr6bTRNvaAo02MUfQOrqzp+ZHIgwrJtInJYcGQkTelf1saDS7AF2iYFqhm s5xhFHWTNcZG2n9nkUuni/YZXY0vZkaE1sLCHBX0/om4qDkm4v61EAIcqY/KeXPlIHdH 747Q== X-Gm-Message-State: AOJu0YzMTqoNGuvmK4TPTIRrsXuBu30vr2d696wUD/VhesYRyhUX8ATB 5alAMBCkYH60y12WRDClg3vtG0QU0sKYCIrKda0ZUF88cK5iMv7jgKu5UVmpfeaCc2RNhDQ4QtL n X-Received: by 2002:a05:600c:470d:b0:42c:bb96:340e with SMTP id 5b1f17b1804b1-42cdb56fa94mr170560335e9.31.1726751470486; Thu, 19 Sep 2024 06:11:10 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:10 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/38] target/arm: Use tcg_gen_extract2_i64 for EXT Date: Thu, 19 Sep 2024 14:10:33 +0100 Message-Id: <20240919131106.3362543-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson The extract2 tcg op performs the same operation as the do_ext64 function. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-6-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 6d5f12e8f55..1a0b2bb33b6 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8890,23 +8890,6 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) } } -static void do_ext64(DisasContext *s, TCGv_i64 tcg_left, TCGv_i64 tcg_right, - int pos) -{ - /* Extract 64 bits from the middle of two concatenated 64 bit - * vector register slices left:right. The extracted bits start - * at 'pos' bits into the right (least significant) side. - * We return the result in tcg_right, and guarantee not to - * trash tcg_left. - */ - TCGv_i64 tcg_tmp = tcg_temp_new_i64(); - assert(pos > 0 && pos < 64); - - tcg_gen_shri_i64(tcg_right, tcg_right, pos); - tcg_gen_shli_i64(tcg_tmp, tcg_left, 64 - pos); - tcg_gen_or_i64(tcg_right, tcg_right, tcg_tmp); -} - /* EXT * 31 30 29 24 23 22 21 20 16 15 14 11 10 9 5 4 0 * +---+---+-------------+-----+---+------+---+------+---+------+------+ @@ -8944,7 +8927,7 @@ static void disas_simd_ext(DisasContext *s, uint32_t insn) read_vec_element(s, tcg_resl, rn, 0, MO_64); if (pos != 0) { read_vec_element(s, tcg_resh, rm, 0, MO_64); - do_ext64(s, tcg_resh, tcg_resl, pos); + tcg_gen_extract2_i64(tcg_resl, tcg_resl, tcg_resh, pos); } } else { TCGv_i64 tcg_hh; @@ -8965,10 +8948,10 @@ static void disas_simd_ext(DisasContext *s, uint32_t insn) read_vec_element(s, tcg_resh, elt->reg, elt->elt, MO_64); elt++; if (pos != 0) { - do_ext64(s, tcg_resh, tcg_resl, pos); + tcg_gen_extract2_i64(tcg_resl, tcg_resl, tcg_resh, pos); tcg_hh = tcg_temp_new_i64(); read_vec_element(s, tcg_hh, elt->reg, elt->elt, MO_64); - do_ext64(s, tcg_hh, tcg_resh, pos); + tcg_gen_extract2_i64(tcg_resh, tcg_resh, tcg_hh, pos); } } From patchwork Thu Sep 19 13:10:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829604 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316714wrn; Thu, 19 Sep 2024 06:12:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW6Ca8GFy9aTxoVm+gvykgZl+Kl5qE0GhTn7K2TEmky89TmYLkceSii6rklpoZWWL2oM4h6Dg==@linaro.org X-Google-Smtp-Source: AGHT+IGQ5ORaKzcn1Vkzqy3eYoNB2+bLG8qGbp2osg6lqK7MtKXwF226aJXNv6vXLcuanKNNAq+e X-Received: by 2002:a05:6359:59f:b0:1bc:43d8:59b7 with SMTP id e5c5f4694b2df-1bc43d85aebmr466132555d.11.1726751576759; Thu, 19 Sep 2024 06:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751576; cv=none; d=google.com; s=arc-20240605; b=inlH02Xqv7kbmrkzxsR5fs51ZeTTvee0PytX97MPe9LvQB0bx0H3GL0v15DsfMcY4F dT06PwTFDBO9f/DLRaIIBlMDe92+fDqdzilaBBGbmXtNa03/KOuDrZ9H4RXKGQpp8ygq wa2Y9B9LM/iLOy13KG5+b/HMW7c63jfqhWjsSbD0gCgDzxo0LLih1Y016worMuWqKqj2 akzkDUhijhOisKj0g/mVs8yBw+roxy5N/9JosrHjJAckPlrGF5UuRzJdgc/yrxRX1ulg VWBRRdxbL5PmjS4OsHasLx9bhTmM6FRtGcGdM4L4YTmLQ1UWpwRciWrXlSYDf0LxIXn3 wpug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=e9gN9iym25WjHBVpIhI+njO5zeAi0FqzRkFImgHvlIA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=LScvFV1tXuBSks9eYr9RaerrPEByAIihDWsi5cFDDLaDK7217f/hPqROn21O7ANiTD 7dYKrmV5g/yl6zoLo84BCcW8irlWhAH4bIKPKVDGmrOlfYFNigVKclGlry5M50hMmmiJ L/tdvwUm5ZiWc4qE6wW7hV5aPLSjpkCI+mp+MCqwvNitm+rukt0/E/o5B3tXSzOpK+S8 cMnukhWaLfCrhZ81ZBoLzNIGlbKnbRwQbqw46Nvj/gpcCZTQLmFAwMJKp0Y3m2NTrhqn RONlSkstS9q5nKGJIq65VkAtarQjl99hGMqTbuQT1kVlHjOgSmiO1E325VeHxEiEfgtK kyyQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jmrhVHg/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5035b929d54si2287756e0c.21.2024.09.19.06.12.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:12:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jmrhVHg/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwP-0004sT-1f; Thu, 19 Sep 2024 09:11: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 1srGwG-0004U9-A9 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:16 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwD-00010J-Df for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:16 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42cb8dac900so7632105e9.3 for ; Thu, 19 Sep 2024 06:11:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751471; x=1727356271; 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=e9gN9iym25WjHBVpIhI+njO5zeAi0FqzRkFImgHvlIA=; b=jmrhVHg/CZ3oxdMARuvCzo+iYjesUMglAEZFhXbvfQFMFAXRBc9Wiq4KVZNYPxf29O 99h3I0PSh8XoEVvnoa0VPnllgpW/wM1z8GHQBTHpmxfxRhlIHrsc6EYgCxQjh+FllOsp vfSGXEwW9UbO7t2WuQaJaFxmBuWELog7s2HMYAVkjesx4kS7EvrF1tl5joic1DF1Hzat mNKWcNhFuxM4axvm/jWzHkLn0F/QnH49bxjvQiGxD8E99NpKRuMRWZ93mvMpH5WuAX0z KvQPTpw4D+J9JVfDuSY7p+gmChceLgvTGtaHtHc/VIz+0FlHUzz9R/b0Mw6ZL7KhhlR1 4F1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751471; x=1727356271; 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=e9gN9iym25WjHBVpIhI+njO5zeAi0FqzRkFImgHvlIA=; b=cOUV1H9nbYzu/2vZTnb06MsNUTlXjr/49QHozSDfopFJNlKky0OopT07dz9Q2HEdPt xAU2lRHb/9+0Vv5y2FzoL/qEhmEP9W/kgaB1lmpOfERoalKissKGvJrFJkNWyyxEeAh6 FW/Fh5khDU5Xxv32z7jP0uDxawjGPsNr/u93wlDf/oCC7hh/1WX0C86Yy+d5Tv+xQsDr fFhsslPY+D2AU1aEpYcbER3+vGNOXcZ46eTKE2CN4Pv66sfa8P5z4OXe3f8IdpCR6BhV gW9NtFOJpkGCZFts1hgC7mR721EDMNLFXh856H1tvh/tt+XOykwJWveWcxx0pysm5y24 j5uA== X-Gm-Message-State: AOJu0YzjL1x8P2kOqf6trlElTUUwZRm++sKWG+JzaXWw3FBdOfiPL4ew v7F6ms9laCsK0yRFLgaM8WSTLDNW51YEgqEhpbH7ZfQ8s4xI3UkOuEo5s93Ez8R4I7kz4UcQaLc g X-Received: by 2002:a7b:c453:0:b0:42c:de34:34be with SMTP id 5b1f17b1804b1-42cde3436e0mr208139425e9.3.1726751471340; Thu, 19 Sep 2024 06:11:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:10 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/38] target/arm: Convert EXT to decodetree Date: Thu, 19 Sep 2024 14:10:34 +0100 Message-Id: <20240919131106.3362543-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-7-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 5 ++ target/arm/tcg/translate-a64.c | 121 +++++++++++++-------------------- 2 files changed, 53 insertions(+), 73 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 62df4c4ceb4..f72f95865fb 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1136,3 +1136,8 @@ FMADD 0001 1111 .. 0 ..... 0 ..... ..... ..... @rrrr_hsd FMSUB 0001 1111 .. 0 ..... 1 ..... ..... ..... @rrrr_hsd FNMADD 0001 1111 .. 1 ..... 0 ..... ..... ..... @rrrr_hsd FNMSUB 0001 1111 .. 1 ..... 1 ..... ..... ..... @rrrr_hsd + +# Advanced SIMD Extract + +EXT_d 0010 1110 00 0 rm:5 00 imm:3 0 rn:5 rd:5 +EXT_q 0110 1110 00 0 rm:5 0 imm:4 0 rn:5 rd:5 diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 1a0b2bb33b6..48188d41165 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6582,6 +6582,54 @@ static bool trans_FCSEL(DisasContext *s, arg_FCSEL *a) return true; } +/* + * Advanced SIMD Extract + */ + +static bool trans_EXT_d(DisasContext *s, arg_EXT_d *a) +{ + if (fp_access_check(s)) { + TCGv_i64 lo = read_fp_dreg(s, a->rn); + if (a->imm != 0) { + TCGv_i64 hi = read_fp_dreg(s, a->rm); + tcg_gen_extract2_i64(lo, lo, hi, a->imm * 8); + } + write_fp_dreg(s, a->rd, lo); + } + return true; +} + +static bool trans_EXT_q(DisasContext *s, arg_EXT_q *a) +{ + TCGv_i64 lo, hi; + int pos = (a->imm & 7) * 8; + int elt = a->imm >> 3; + + if (!fp_access_check(s)) { + return true; + } + + lo = tcg_temp_new_i64(); + hi = tcg_temp_new_i64(); + + read_vec_element(s, lo, a->rn, elt, MO_64); + elt++; + read_vec_element(s, hi, elt & 2 ? a->rm : a->rn, elt & 1, MO_64); + elt++; + + if (pos != 0) { + TCGv_i64 hh = tcg_temp_new_i64(); + tcg_gen_extract2_i64(lo, lo, hi, pos); + read_vec_element(s, hh, a->rm, elt & 1, MO_64); + tcg_gen_extract2_i64(hi, hi, hh, pos); + } + + write_vec_element(s, lo, a->rd, 0, MO_64); + write_vec_element(s, hi, a->rd, 1, MO_64); + clear_vec_high(s, true, a->rd); + return true; +} + /* * Floating-point data-processing (3 source) */ @@ -8890,78 +8938,6 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) } } -/* EXT - * 31 30 29 24 23 22 21 20 16 15 14 11 10 9 5 4 0 - * +---+---+-------------+-----+---+------+---+------+---+------+------+ - * | 0 | Q | 1 0 1 1 1 0 | op2 | 0 | Rm | 0 | imm4 | 0 | Rn | Rd | - * +---+---+-------------+-----+---+------+---+------+---+------+------+ - */ -static void disas_simd_ext(DisasContext *s, uint32_t insn) -{ - int is_q = extract32(insn, 30, 1); - int op2 = extract32(insn, 22, 2); - int imm4 = extract32(insn, 11, 4); - int rm = extract32(insn, 16, 5); - int rn = extract32(insn, 5, 5); - int rd = extract32(insn, 0, 5); - int pos = imm4 << 3; - TCGv_i64 tcg_resl, tcg_resh; - - if (op2 != 0 || (!is_q && extract32(imm4, 3, 1))) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - tcg_resh = tcg_temp_new_i64(); - tcg_resl = tcg_temp_new_i64(); - - /* Vd gets bits starting at pos bits into Vm:Vn. This is - * either extracting 128 bits from a 128:128 concatenation, or - * extracting 64 bits from a 64:64 concatenation. - */ - if (!is_q) { - read_vec_element(s, tcg_resl, rn, 0, MO_64); - if (pos != 0) { - read_vec_element(s, tcg_resh, rm, 0, MO_64); - tcg_gen_extract2_i64(tcg_resl, tcg_resl, tcg_resh, pos); - } - } else { - TCGv_i64 tcg_hh; - typedef struct { - int reg; - int elt; - } EltPosns; - EltPosns eltposns[] = { {rn, 0}, {rn, 1}, {rm, 0}, {rm, 1} }; - EltPosns *elt = eltposns; - - if (pos >= 64) { - elt++; - pos -= 64; - } - - read_vec_element(s, tcg_resl, elt->reg, elt->elt, MO_64); - elt++; - read_vec_element(s, tcg_resh, elt->reg, elt->elt, MO_64); - elt++; - if (pos != 0) { - tcg_gen_extract2_i64(tcg_resl, tcg_resl, tcg_resh, pos); - tcg_hh = tcg_temp_new_i64(); - read_vec_element(s, tcg_hh, elt->reg, elt->elt, MO_64); - tcg_gen_extract2_i64(tcg_resh, tcg_resh, tcg_hh, pos); - } - } - - write_vec_element(s, tcg_resl, rd, 0, MO_64); - if (is_q) { - write_vec_element(s, tcg_resh, rd, 1, MO_64); - } - clear_vec_high(s, is_q, rd); -} - /* TBL/TBX * 31 30 29 24 23 22 21 20 16 15 14 13 12 11 10 9 5 4 0 * +---+---+-------------+-----+---+------+---+-----+----+-----+------+------+ @@ -11860,7 +11836,6 @@ static const AArch64DecodeTable data_proc_simd[] = { { 0x0f000400, 0x9f800400, disas_simd_shift_imm }, { 0x0e000000, 0xbf208c00, disas_simd_tb }, { 0x0e000800, 0xbf208c00, disas_simd_zip_trn }, - { 0x2e000000, 0xbf208400, disas_simd_ext }, { 0x5e200800, 0xdf3e0c00, disas_simd_scalar_two_reg_misc }, { 0x5f000400, 0xdf800400, disas_simd_scalar_shift_imm }, { 0x0e780800, 0x8f7e0c00, disas_simd_two_reg_misc_fp16 }, From patchwork Thu Sep 19 13:10:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829625 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319985wrn; Thu, 19 Sep 2024 06:18:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUkw03Mer+YKmwUXRMolPuhOKa4BYcPKpnPJYKTTHUCmT2qp3vOXj2Bnq1oAKECElyynp5M/w==@linaro.org X-Google-Smtp-Source: AGHT+IFMV2qmRpGxD1/5ohnvxgX84fhM0jVpq1Vcr9nvLXdUN9PnUz2jnx8OjrSRJLtfMaXCnqOi X-Received: by 2002:a05:620a:4106:b0:79f:f32:bb28 with SMTP id af79cd13be357-7a9e5ee75admr4182665585a.11.1726751936089; Thu, 19 Sep 2024 06:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751936; cv=none; d=google.com; s=arc-20240605; b=IYmqJM5n5TTaQ2/A/3zNifcrrWG+8mUeFSLfWNDU+9lNn/mUbM21l3Ot/wD2blqa8h z52djTbyogk8RwLKgXegLotCu+6JIV7D7Z7TSpYnRfUiBu/SRAYGXFg8yla5Tg7IUbGs +2HDvM1QidUUuVsdScDpfcWZuIoztYWGHwTa2Ub+L49e5iUVlTY7E7BYCG/xb9avzYAh WrMEqSoiwCDbXtv/c9NlGObAQ0BVym3BRju0Efv6sOORpI4mhIYJcvH0UTfUmKaULzxj T7IiuRjxF/W3coiOIlaNjBaG7juwXcdPs9KBUtAC6epFJcjOKkVcYTVzUX+as0HoMUKu PKPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=skHPuVnsvR6Ul8cA6v8OopyRl4icBlvvZ1tc+HPXORU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=PUxcYcotJEx0+RMsFl/i6leJJBbxhRDhzOO/lWCVivoBjsosJ6Ci8OI3m/Cd1VS5CI bkXcVq/89s08Jse0AMoBT8H+24FJo5X5J1ZNkYctQLhR940JywiVese80lEoX/I2yXXb 3PRzv+y47XqU7hpybpsvrxxnCQ9wBAcM0KQsCorPJugO8LE7FNt4QCber7gHGlW076EG H2wYblZxnzdW713KtqiYTaDHnAcpKGM/f/hwaV/akQHsCq8wGM0SuT4lOKLrc4JbI/Sl glhdPVxJPKkjSDq7JZjc7zFVQ4Pm2KoIZJQLWW4qxeK5kegsgN20cZuRQga9J2Qurfi7 VwzA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EZkPS4/X"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb08e10b1si183455085a.427.2024.09.19.06.18.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EZkPS4/X"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwi-00064S-8U; Thu, 19 Sep 2024 09:11:44 -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 1srGwH-0004XV-HQ for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:18 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwE-00010V-HF for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:16 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2f77fe7ccc4so8881501fa.2 for ; Thu, 19 Sep 2024 06:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751472; x=1727356272; 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=skHPuVnsvR6Ul8cA6v8OopyRl4icBlvvZ1tc+HPXORU=; b=EZkPS4/Xk+dh2GfAkUxDf/yFUZsmlZukrfI+aKtu8dVsKrsp+xecqNYb5fxQXbhQac aF13fdyrdZ6hxswnloul7Aj3H2hakmiU/SRUHO5pKb2g1CMViozUGf10jW7kfmghNfQE jQ9iTXj2b5BPV0u3JBk5bdnmxDVTqGBuCWs9DL6CpY+25PWstgAhRhWsxmHr9wprds4v 8OiLcOJvf87mqPZ6KRkdQMejj/z23XgyCm8lEzZ+R+biCS5mY9ohnl0aUBHLbGiNM3Gc fIQ546iYncdBURjJw4GeJJxt6VLMb7hvz3Oic/NR6k8ewIpuDJVP7++7hYsqQbyyzZlZ WoZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751472; x=1727356272; 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=skHPuVnsvR6Ul8cA6v8OopyRl4icBlvvZ1tc+HPXORU=; b=imsqRujAS3UfWOkf1AsN2EZYj5ARR0X9fEQjBxZ+uDZVnlmaEyAIp8y/vdWKuzbGtG we09LZMiD9CTfvQ8j0/9/V5Xkweu8kOw4SKywmBe7LyARLIfiejlWa7Oor04q2cpZ/Ea q/asqmWUMYy2xzNi1jHRkX4SgWhlyNqBH3WFXoNEiGK+OJcd59lP0IIxsdn9Xh7JraO8 NsF+EoXnERD8BSfhBdxnYDZdM2KpXVrc0I0gZ+x8S2dvJaaz3cMl3u9ygECDkr2I6B33 yp0nojgi3oAgyQnZHP25f78jPVIxvfBGm0mKtYGke7QahTZEyLMBL7wh+P0nBH3zWMRn tEqQ== X-Gm-Message-State: AOJu0Yw+I9WT/oRauZ3LvjaU/R+dnUsG9ZyT5FygvTCjyFwrlR+9LfTb yWIWVZmnK7Y34osuyKFoSbFo1hvv8zLzz08SZQ+/UBHBARgkXHfI+5kKYACR+oWAK+I/0z5SCJ2 C X-Received: by 2002:a2e:be1f:0:b0:2f7:64b9:ff90 with SMTP id 38308e7fff4ca-2f7918e9558mr116755271fa.9.1726751471945; Thu, 19 Sep 2024 06:11:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/38] target/arm: Convert TBL, TBX to decodetree Date: Thu, 19 Sep 2024 14:10:35 +0100 Message-Id: <20240919131106.3362543-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22f.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-8-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 4 +++ target/arm/tcg/translate-a64.c | 47 ++++++++++------------------------ 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index f72f95865fb..e2a3ef62efb 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1141,3 +1141,7 @@ FNMSUB 0001 1111 .. 1 ..... 1 ..... ..... ..... @rrrr_hsd EXT_d 0010 1110 00 0 rm:5 00 imm:3 0 rn:5 rd:5 EXT_q 0110 1110 00 0 rm:5 0 imm:4 0 rn:5 rd:5 + +# Advanced SIMD Table Lookup + +TBL_TBX 0 q:1 00 1110 000 rm:5 0 len:2 tbx:1 00 rn:5 rd:5 diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 48188d41165..70173c67c26 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -4680,6 +4680,20 @@ static bool trans_EXTR(DisasContext *s, arg_extract *a) return true; } +static bool trans_TBL_TBX(DisasContext *s, arg_TBL_TBX *a) +{ + if (fp_access_check(s)) { + int len = (a->len + 1) * 16; + + tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, a->rd), + vec_full_reg_offset(s, a->rm), tcg_env, + a->q ? 16 : 8, vec_full_reg_size(s), + (len << 6) | (a->tbx << 5) | a->rn, + gen_helper_simd_tblx); + } + return true; +} + /* * Cryptographic AES, SHA, SHA512 */ @@ -8938,38 +8952,6 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) } } -/* TBL/TBX - * 31 30 29 24 23 22 21 20 16 15 14 13 12 11 10 9 5 4 0 - * +---+---+-------------+-----+---+------+---+-----+----+-----+------+------+ - * | 0 | Q | 0 0 1 1 1 0 | op2 | 0 | Rm | 0 | len | op | 0 0 | Rn | Rd | - * +---+---+-------------+-----+---+------+---+-----+----+-----+------+------+ - */ -static void disas_simd_tb(DisasContext *s, uint32_t insn) -{ - int op2 = extract32(insn, 22, 2); - int is_q = extract32(insn, 30, 1); - int rm = extract32(insn, 16, 5); - int rn = extract32(insn, 5, 5); - int rd = extract32(insn, 0, 5); - int is_tbx = extract32(insn, 12, 1); - int len = (extract32(insn, 13, 2) + 1) * 16; - - if (op2 != 0) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, rd), - vec_full_reg_offset(s, rm), tcg_env, - is_q ? 16 : 8, vec_full_reg_size(s), - (len << 6) | (is_tbx << 5) | rn, - gen_helper_simd_tblx); -} - /* ZIP/UZP/TRN * 31 30 29 24 23 22 21 20 16 15 14 12 11 10 9 5 4 0 * +---+---+-------------+------+---+------+---+------------------+------+ @@ -11834,7 +11816,6 @@ static const AArch64DecodeTable data_proc_simd[] = { /* simd_mod_imm decode is a subset of simd_shift_imm, so must precede it */ { 0x0f000400, 0x9ff80400, disas_simd_mod_imm }, { 0x0f000400, 0x9f800400, disas_simd_shift_imm }, - { 0x0e000000, 0xbf208c00, disas_simd_tb }, { 0x0e000800, 0xbf208c00, disas_simd_zip_trn }, { 0x5e200800, 0xdf3e0c00, disas_simd_scalar_two_reg_misc }, { 0x5f000400, 0xdf800400, disas_simd_scalar_shift_imm }, From patchwork Thu Sep 19 13:10:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829610 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp317289wrn; Thu, 19 Sep 2024 06:14:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU/7+oNA2k0Q4avKswLHjulthQtunI9UyyBUBbQCV7ri8beL8WM2FNYVWkEJ7NWtthD1rI5Pg==@linaro.org X-Google-Smtp-Source: AGHT+IGRq04z5stNmIpd0o+fVBMuJlTdnvVtgd9muT5eo/5Scl4G3Y60QxFA3E3pnweAsS1u2OQf X-Received: by 2002:a05:6871:e2a7:b0:261:20f:c297 with SMTP id 586e51a60fabf-27c688fc188mr11723238fac.11.1726751643945; Thu, 19 Sep 2024 06:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751643; cv=none; d=google.com; s=arc-20240605; b=b6F6ScNPXBbyG09XuiBJaX+ujetOTMKHsFjcJU9ISFH++rhyk92piHp4MEj3as6lPb D6l0w/XteNMMsacAVxen+XCfCWDcsmkOcNhCuBwnmV2Um+ZIOMRk+n7IXJJfUHtS2bYJ HD/7KrQNWX8hrVyn47HdlvUzUSEYe0t436YcRZKNm+JFBPYoAV6dlQ4IEPKjSvDmG1A4 V39drUKG0tRWnagfFnxuVrdZPlMqB1HDpYUBskzhTJbujMbNPqo6Jn4Kg8tB1JN0YfW9 LYIFg+I8VkG4DOUtnSXfiC6EfvUmGBnd4NSgY3Nse5iclk1zuyOGDjobwvRL+3WOGQcM kBZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=fujMg81aMBphgOTX1G+SEeLAf+hd6K9shlKbIkHWXKw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=XvdF3IHv7aPhjsnUqgKLEm93odqd+vbmSDP5LMcy/728pClc+ALFdf8rkcvDhozCTP R5dUgPxOV0HiZekBKqhsdNY+DYMT3TPa89QmTnwjDS6zqqA/Bgn1iWEITdwZZQf1dSK1 c9qCmogQLQUZRIemCDFCBLJgd78sob2pVB5jRhhiBFIoYd/ciuiuQbWjDrg390ILqXIQ 9kWdtqYl/8FfeS779IuYbLs7DBFI+9lROqLRydLc6i28dcj9FlXCfaGL1BmECHce5wm6 vcL3tIqP1ERML30hQoBLuZXkfihD1rWa2wmZt5S2mhvBk8kEZKvA3M0h0weF1mBa6W81 b9ag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Iq3AUyRb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-49e6b43bd7esi2588604137.358.2024.09.19.06.14.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:14:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Iq3AUyRb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwg-0005xO-II; Thu, 19 Sep 2024 09:11:42 -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 1srGwH-0004XZ-Im for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:18 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwE-00010X-H6 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:16 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42e748f78d6so6695375e9.0 for ; Thu, 19 Sep 2024 06:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751472; x=1727356272; 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=fujMg81aMBphgOTX1G+SEeLAf+hd6K9shlKbIkHWXKw=; b=Iq3AUyRbSXWn1Z4FcKLi5XuGHJZz7LVBzapunEQUT0huhED4tOrpaCxNwPlgAfeoqR ZDoqVk599iNECPL/wjLi3HvtDWko8qlVSrf2w1sey4wJJP/NeRBqbCFFApRG6WeioyjS /dM1/pqBolc2ZXGGbXeeNwSNx+FGn6uToT/lZrGsFt8R8iOnonXFQSicN+taUQfGYTdU rdASNInYblFe1zpbq0lARUsxqLBBB2pcwmYBfnRrki5P71faD87H5LsdpyBt1flcjbZ6 Dv6GYDP+UsS0h1Grl/WXcfbTZSJK1w5lgI2Xnu+0FEBXsngDAPQCeAMLy0Rlckkq97kd Akvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751472; x=1727356272; 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=fujMg81aMBphgOTX1G+SEeLAf+hd6K9shlKbIkHWXKw=; b=hO1ZLQvodhiMuigtn0yYrSmp2kP2Cc4BoHAtFl8WmkLPqKWc1nnU3uFGvyFvBhyzs3 BTShzZhGyLqQ3K8BmhFp0vT8OXg2gk2aOue47VBQlJKewZY2a3kmoQWkseIwae6nNt24 +HX1FbeLe/x89zwUU+sx/m+wLNrVVJpZSPEsFLgzPHnrlxjpnyQIobbQ6Nm7xroJFt9i 0dM1RMDVAyEx4zHbdmR4Rb5y2OGqLiBdFZcTvUc9USW6276OEpIPhQA9pBQZ0oA9xFPU SkkYlB9hk8sJg+TLuNYEHhIfW/6o3JX2XKs4Rrme5odiR0SJwf5W2bbbz9XswcH7VyG/ pekw== X-Gm-Message-State: AOJu0YxS72WQ8m0FRhd7uT0dvq/y3DVGzxhV5aaL9GDaQ0gRVIB5JEOb gh3PvUxHe8NQPo5IF+RzXOe+dHAY3aKgPz2Wes1LPAn162pc7z73eA9WsGZAJsBcehc6hdsaLno r X-Received: by 2002:a05:600c:1550:b0:42c:a8cb:6a96 with SMTP id 5b1f17b1804b1-42cdb5721eamr174913645e9.31.1726751472444; Thu, 19 Sep 2024 06:11:12 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:12 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/38] target/arm: Convert UZP, TRN, ZIP to decodetree Date: Thu, 19 Sep 2024 14:10:36 +0100 Message-Id: <20240919131106.3362543-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-9-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 9 ++ target/arm/tcg/translate-a64.c | 158 ++++++++++++++------------------- 2 files changed, 77 insertions(+), 90 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index e2a3ef62efb..7f71c56f83e 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1145,3 +1145,12 @@ EXT_q 0110 1110 00 0 rm:5 0 imm:4 0 rn:5 rd:5 # Advanced SIMD Table Lookup TBL_TBX 0 q:1 00 1110 000 rm:5 0 len:2 tbx:1 00 rn:5 rd:5 + +# Advanced SIMD Permute + +UZP1 0.00 1110 .. 0 ..... 0 001 10 ..... ..... @qrrr_e +UZP2 0.00 1110 .. 0 ..... 0 101 10 ..... ..... @qrrr_e +TRN1 0.00 1110 .. 0 ..... 0 010 10 ..... ..... @qrrr_e +TRN2 0.00 1110 .. 0 ..... 0 110 10 ..... ..... @qrrr_e +ZIP1 0.00 1110 .. 0 ..... 0 011 10 ..... ..... @qrrr_e +ZIP2 0.00 1110 .. 0 ..... 0 111 10 ..... ..... @qrrr_e diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 70173c67c26..04160b25136 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -4694,6 +4694,74 @@ static bool trans_TBL_TBX(DisasContext *s, arg_TBL_TBX *a) return true; } +typedef int simd_permute_idx_fn(int i, int part, int elements); + +static bool do_simd_permute(DisasContext *s, arg_qrrr_e *a, + simd_permute_idx_fn *fn, int part) +{ + MemOp esz = a->esz; + int datasize = a->q ? 16 : 8; + int elements = datasize >> esz; + TCGv_i64 tcg_res[2], tcg_ele; + + if (esz == MO_64 && !a->q) { + return false; + } + if (!fp_access_check(s)) { + return true; + } + + tcg_res[0] = tcg_temp_new_i64(); + tcg_res[1] = a->q ? tcg_temp_new_i64() : NULL; + tcg_ele = tcg_temp_new_i64(); + + for (int i = 0; i < elements; i++) { + int o, w, idx; + + idx = fn(i, part, elements); + read_vec_element(s, tcg_ele, (idx & elements ? a->rm : a->rn), + idx & (elements - 1), esz); + + w = (i << (esz + 3)) / 64; + o = (i << (esz + 3)) % 64; + if (o == 0) { + tcg_gen_mov_i64(tcg_res[w], tcg_ele); + } else { + tcg_gen_deposit_i64(tcg_res[w], tcg_res[w], tcg_ele, o, 8 << esz); + } + } + + for (int i = a->q; i >= 0; --i) { + write_vec_element(s, tcg_res[i], a->rd, i, MO_64); + } + clear_vec_high(s, a->q, a->rd); + return true; +} + +static int permute_load_uzp(int i, int part, int elements) +{ + return 2 * i + part; +} + +TRANS(UZP1, do_simd_permute, a, permute_load_uzp, 0) +TRANS(UZP2, do_simd_permute, a, permute_load_uzp, 1) + +static int permute_load_trn(int i, int part, int elements) +{ + return (i & 1) * elements + (i & ~1) + part; +} + +TRANS(TRN1, do_simd_permute, a, permute_load_trn, 0) +TRANS(TRN2, do_simd_permute, a, permute_load_trn, 1) + +static int permute_load_zip(int i, int part, int elements) +{ + return (i & 1) * elements + ((part * elements + i) >> 1); +} + +TRANS(ZIP1, do_simd_permute, a, permute_load_zip, 0) +TRANS(ZIP2, do_simd_permute, a, permute_load_zip, 1) + /* * Cryptographic AES, SHA, SHA512 */ @@ -8952,95 +9020,6 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) } } -/* ZIP/UZP/TRN - * 31 30 29 24 23 22 21 20 16 15 14 12 11 10 9 5 4 0 - * +---+---+-------------+------+---+------+---+------------------+------+ - * | 0 | Q | 0 0 1 1 1 0 | size | 0 | Rm | 0 | opc | 1 0 | Rn | Rd | - * +---+---+-------------+------+---+------+---+------------------+------+ - */ -static void disas_simd_zip_trn(DisasContext *s, uint32_t insn) -{ - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int rm = extract32(insn, 16, 5); - int size = extract32(insn, 22, 2); - /* opc field bits [1:0] indicate ZIP/UZP/TRN; - * bit 2 indicates 1 vs 2 variant of the insn. - */ - int opcode = extract32(insn, 12, 2); - bool part = extract32(insn, 14, 1); - bool is_q = extract32(insn, 30, 1); - int esize = 8 << size; - int i; - int datasize = is_q ? 128 : 64; - int elements = datasize / esize; - TCGv_i64 tcg_res[2], tcg_ele; - - if (opcode == 0 || (size == 3 && !is_q)) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - tcg_res[0] = tcg_temp_new_i64(); - tcg_res[1] = is_q ? tcg_temp_new_i64() : NULL; - tcg_ele = tcg_temp_new_i64(); - - for (i = 0; i < elements; i++) { - int o, w; - - switch (opcode) { - case 1: /* UZP1/2 */ - { - int midpoint = elements / 2; - if (i < midpoint) { - read_vec_element(s, tcg_ele, rn, 2 * i + part, size); - } else { - read_vec_element(s, tcg_ele, rm, - 2 * (i - midpoint) + part, size); - } - break; - } - case 2: /* TRN1/2 */ - if (i & 1) { - read_vec_element(s, tcg_ele, rm, (i & ~1) + part, size); - } else { - read_vec_element(s, tcg_ele, rn, (i & ~1) + part, size); - } - break; - case 3: /* ZIP1/2 */ - { - int base = part * elements / 2; - if (i & 1) { - read_vec_element(s, tcg_ele, rm, base + (i >> 1), size); - } else { - read_vec_element(s, tcg_ele, rn, base + (i >> 1), size); - } - break; - } - default: - g_assert_not_reached(); - } - - w = (i * esize) / 64; - o = (i * esize) % 64; - if (o == 0) { - tcg_gen_mov_i64(tcg_res[w], tcg_ele); - } else { - tcg_gen_shli_i64(tcg_ele, tcg_ele, o); - tcg_gen_or_i64(tcg_res[w], tcg_res[w], tcg_ele); - } - } - - for (i = 0; i <= is_q; ++i) { - write_vec_element(s, tcg_res[i], rd, i, MO_64); - } - clear_vec_high(s, is_q, rd); -} - /* * do_reduction_op helper * @@ -11816,7 +11795,6 @@ static const AArch64DecodeTable data_proc_simd[] = { /* simd_mod_imm decode is a subset of simd_shift_imm, so must precede it */ { 0x0f000400, 0x9ff80400, disas_simd_mod_imm }, { 0x0f000400, 0x9f800400, disas_simd_shift_imm }, - { 0x0e000800, 0xbf208c00, disas_simd_zip_trn }, { 0x5e200800, 0xdf3e0c00, disas_simd_scalar_two_reg_misc }, { 0x5f000400, 0xdf800400, disas_simd_scalar_shift_imm }, { 0x0e780800, 0x8f7e0c00, disas_simd_two_reg_misc_fp16 }, From patchwork Thu Sep 19 13:10:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829628 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320056wrn; Thu, 19 Sep 2024 06:19:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUPLLmfZQwuOfB0nJE1hZnKjZJdLzGp+LiL/pcFx1J7wjcNJYDwQus9uiQzGKxuHRFq/9Kjpw==@linaro.org X-Google-Smtp-Source: AGHT+IHS0wwQBoKt+Eh7y815Zi0xsu8+3LnZFnOw4PFNEXXzl7hV/YKV82NLMW9m18M2KbESy8os X-Received: by 2002:a05:6214:451d:b0:6c3:6e36:eff5 with SMTP id 6a1803df08f44-6c57357a441mr465683616d6.22.1726751944532; Thu, 19 Sep 2024 06:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751944; cv=none; d=google.com; s=arc-20240605; b=FjLbJn/N4BuLVdUGEGydnpILySLA4R1ATo/oGs55MilVTkTfAa0DEvYFjAIDH42bax 8X0aFBoD8HJmtXvvnO9tL3zUFJzidpJUaam5U1ryIBU1Yeuv2Ic5GtsFTO9iL8/axUEW SFL78uLGk+ScRkINZuQL4IKAp66odFaNghxb71mWM77oiwHbseKL+lu1Gs4r3Ngw01xD 2G5GIMhch2JVBbbIJ56V9Jqpwu7+iiZxic0dJ/RGVJsMt3DE/StCfQ/MEKKOhy3PJHbC Zbqy1iHuR15hW6h5iVdfPCOxz6QeHeE22+ucQrUyNS+Isvv1TO8UJTHjfwujfZAUE68o VFQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=zURWD2EwiMkoq8peBlm9KWuzJycV0Jiua+pYVgeZppE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=RVSVEXeFJq1HWeRAi75izBbjALuJLQFksXRlZ7deOYGOIFJFuECn/TVTFCfADz5RoH YCfHbMzBHjanjxcgXWwRfeQIEGpcD14jKpNZEYfFuZgb8eHQdl1MfkyzVcYgEg6lLxJg /WUmFPAQJiZ4RFQ58bVHmfqiTZYWEfZmtNfp5+F5gppwDHDXBoWyMjRegPxDIMGdPsQ3 lvscarz4H+CceroOBrcynriXoE52xQVA+g326cvhHXQheEefuMIjDNjr1dS2gUPwvS7D u43fTOC7xKwotudZTLv8L+iosKYFb4ACz17U7rvvwe1huZSe+M1avbBq8sOpOCr5jugg 2VNA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ePTk3eZI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c75e5a73fbsi18280576d6.501.2024.09.19.06.19.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ePTk3eZI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwh-0005zO-AQ; Thu, 19 Sep 2024 09:11:43 -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 1srGwJ-0004di-Cz for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:19 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwF-00010d-At for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:17 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42cc43454d5so6575455e9.3 for ; Thu, 19 Sep 2024 06:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751473; x=1727356273; 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=zURWD2EwiMkoq8peBlm9KWuzJycV0Jiua+pYVgeZppE=; b=ePTk3eZInNbFpYTFyIYM+HH3awTSybwTs9rUl7woQHd03xAfn+ygAxVXP0h2gGyEZY JBqCJqUFrH6mJb7NNg74FKLounoDefW7Olqp7wVRLzeyb/Ggn6wJ2PmNiehRGQtnX2+Q GOSsPNjuORWM7FNNgRS0TjNXlwObjh4ESMFpI7PGfwfKlvEBEY1zFTZKi8ukqHvK/RH1 kLgsUhxOzT8WhvQ/5wJ0l2ZdfZN3eNwma0qdQ1UBmYKwweC+r1EOxXoiBF8I/XjSLv0V 670mK4UO69FIn6lXZ7jCdMPmC6WG/5fEiuZI3Xg7jUhKhsaTtxYM96SVFhZh7ghZBznV OC0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751473; x=1727356273; 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=zURWD2EwiMkoq8peBlm9KWuzJycV0Jiua+pYVgeZppE=; b=Xa6SN3IBHFrFqa4HM+rjRg9TuftMQQOe/f2Cak0tiLTfASWdWORAnyPlCPi0/h0zSE 7lclMw8JbgBRQSDfzvggu+4+JwwXWkGi6UzkFbiKzXJcwUizkSmX2huZXNzEHhEfL3nv KkM6WwCdh1aMKxU5urNbvkORF6cOaDHKSQOqASSwEFG6eFbDvzIC4L2/bKAuhj6R5E/k x65Q9pJoitXrorIkfWu2YmL7FIcOVcwvQm4/XuaGBs6dqH4UTPvStqjDv6z197XSAkFv qUIjR3AqidLcO4xM2L2fK2+dqaGa74NTjbxf3+icFcQjPpYo3jcqqQE4szg2gbgkjV9S PVvA== X-Gm-Message-State: AOJu0YygVp03LJQssHCNWtw3xD4z3mQYo43hmHpeJzwVBVKNOSoWq58h O4xV72EBeRH2cPAgaY9+/pNdlsx+PxRZZh+U7rCv0GzJi22mXhhKdQ77g/J2qy94cw8tSFXEslP E X-Received: by 2002:a05:600c:1c9a:b0:428:1b0d:8657 with SMTP id 5b1f17b1804b1-42d964d8579mr155304525e9.22.1726751472981; Thu, 19 Sep 2024 06:11:12 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:12 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/38] target/arm: Simplify do_reduction_op Date: Thu, 19 Sep 2024 14:10:37 +0100 Message-Id: <20240919131106.3362543-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Use simple shift and add instead of ctpop, ctz, shift and mask. Unlike SVE, there is no predicate to disable elements. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-10-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 40 +++++++++++----------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 04160b25136..74efb351648 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9027,34 +9027,23 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) * important for correct NaN propagation that we do these * operations in exactly the order specified by the pseudocode. * - * This is a recursive function, TCG temps should be freed by the - * calling function once it is done with the values. + * This is a recursive function. */ static TCGv_i32 do_reduction_op(DisasContext *s, int fpopcode, int rn, - int esize, int size, int vmap, TCGv_ptr fpst) + MemOp esz, int ebase, int ecount, TCGv_ptr fpst) { - if (esize == size) { - int element; - MemOp msize = esize == 16 ? MO_16 : MO_32; - TCGv_i32 tcg_elem; - - /* We should have one register left here */ - assert(ctpop8(vmap) == 1); - element = ctz32(vmap); - assert(element < 8); - - tcg_elem = tcg_temp_new_i32(); - read_vec_element_i32(s, tcg_elem, rn, element, msize); + if (ecount == 1) { + TCGv_i32 tcg_elem = tcg_temp_new_i32(); + read_vec_element_i32(s, tcg_elem, rn, ebase, esz); return tcg_elem; } else { - int bits = size / 2; - int shift = ctpop8(vmap) / 2; - int vmap_lo = (vmap >> shift) & vmap; - int vmap_hi = (vmap & ~vmap_lo); + int half = ecount >> 1; TCGv_i32 tcg_hi, tcg_lo, tcg_res; - tcg_hi = do_reduction_op(s, fpopcode, rn, esize, bits, vmap_hi, fpst); - tcg_lo = do_reduction_op(s, fpopcode, rn, esize, bits, vmap_lo, fpst); + tcg_hi = do_reduction_op(s, fpopcode, rn, esz, + ebase + half, half, fpst); + tcg_lo = do_reduction_op(s, fpopcode, rn, esz, + ebase, half, fpst); tcg_res = tcg_temp_new_i32(); switch (fpopcode) { @@ -9105,7 +9094,6 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) bool is_u = extract32(insn, 29, 1); bool is_fp = false; bool is_min = false; - int esize; int elements; int i; TCGv_i64 tcg_res, tcg_elt; @@ -9152,8 +9140,7 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) return; } - esize = 8 << size; - elements = (is_q ? 128 : 64) / esize; + elements = (is_q ? 16 : 8) >> size; tcg_res = tcg_temp_new_i64(); tcg_elt = tcg_temp_new_i64(); @@ -9208,9 +9195,8 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) */ TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); int fpopcode = opcode | is_min << 4 | is_u << 5; - int vmap = (1 << elements) - 1; - TCGv_i32 tcg_res32 = do_reduction_op(s, fpopcode, rn, esize, - (is_q ? 128 : 64), vmap, fpst); + TCGv_i32 tcg_res32 = do_reduction_op(s, fpopcode, rn, size, + 0, elements, fpst); tcg_gen_extu_i32_i64(tcg_res, tcg_res32); } From patchwork Thu Sep 19 13:10:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829612 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp317517wrn; Thu, 19 Sep 2024 06:14:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWp7QYNpGOi+KMbyr+TQRSrAZF1IfyUyjhbY3FTOoaVnWtEGXlyD96BLRrD9ieN/YQbvEwqlQ==@linaro.org X-Google-Smtp-Source: AGHT+IE8UIY4i9HkeYOOCGi/4Y0KLN7DkF0dFFsyWHvQQ/MNXDQyTURd9vnI/4XKzJt8hM1yD2yx X-Received: by 2002:a05:6830:65c6:b0:710:eb9a:f8d1 with SMTP id 46e09a7af769-71109486190mr24930332a34.17.1726751670410; Thu, 19 Sep 2024 06:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751670; cv=none; d=google.com; s=arc-20240605; b=UZrGoJu/ABB7MJAuOHzAKACBLm537L96nMKg2V20xEbnuXCWHMiRklkB0YzJZz0zzv U0NOOqELUDinQp6ArgDyr4fmX/XcFMKsjECeVgO+P+kilSVgI62hgRFV1KCtXvEpvgfe 5yNB2ryEv1i64wgjGeP0kn6hAPYbR/4+thhxRDfsNlg4VstegebYVErUQj4utA+1sC8E gF+V3ssPb+LBpQmDwncQwRIfWUNs+kkaPcam4vIGnKpsZ5ajWszdZMmAQ8v3nos2/Sxm v2RcidiGmz0j4idmkxVI8+LQZ/Mb70JlKN+NYTzXH7lcbU/cdvKV9UnmVOETnjrsz1Zk 0Aig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SYRqTsHcomuCQZ1y0zetgXdf9PlPsY0CwTUQYRMMcPs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=dYgSo1udBU8Hu0GDa5hotfb14H9kXXRWePoFUnOKt8eU7r1gol6Qe1ltDOJ8e54x/A ZA5P6QkLpL0Msr9cp3Cl14Rn0dxbrPNHl0OFnYDWEv/4Sfu+XtOad9vESIVPo/Qph0UW RV1F5nAB06h0EYhNN60zFlHAi5sjW3IgFihA8av9NH2y+vWqWRuGezmhXz+4Tz2iOHtn NbrbZAS0ewqmbF0yeSrhiIUnpe9wZv7+QxQRKYni4cqaOGzRpHbM261WUwTNivxyq/lj xPnp3FsEkWu+WwSMVW/ABJo/INgaRFCqfv7Y2z9SpTL+4tviD6Sz1pzw8TNNmfIdyFOY AQIg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tWYiOwR0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-49e6b43be06si2700709137.393.2024.09.19.06.14.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:14:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tWYiOwR0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwU-00057e-Sb; Thu, 19 Sep 2024 09:11:32 -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 1srGwJ-0004dc-Ci for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:19 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwF-00010n-B6 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:17 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42ca6ba750eso5590205e9.0 for ; Thu, 19 Sep 2024 06:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751474; x=1727356274; 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=SYRqTsHcomuCQZ1y0zetgXdf9PlPsY0CwTUQYRMMcPs=; b=tWYiOwR0tpvMzVHNrqbBPWN8aWsOcdZqJWQROjhE09nZ6yP5NKyavU1iNPV0ALRMD8 Lnm1sN+njXEQQbWvdrdyVfWBArN4Q5n48JaXsCgBhKbOQoG3wiwgunUklkbW13faN9TR 925KPQF0yjrwObYDRWTOC3vaN+LfPU0y+E0TsjKfWciqNlIS5mqDTeYLpZ8ZHXSwNdlr oMxtwvhooWcLgN+bN+uLZ+pOz1qMW3W265L0NUOAKt0jobsOnKOJYYJ9C8l3vRLQGBGB /VNsjYAT+vvQ2aiJ7pSfnE2y0/OQwZ+bVj4Xz5zxDcsMBPDs2ozHbrjxq455wHVhOeKC kK3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751474; x=1727356274; 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=SYRqTsHcomuCQZ1y0zetgXdf9PlPsY0CwTUQYRMMcPs=; b=A/F5UWUdbi1hXi9vRdCHVvoISDHR4ThR5Eyv0ouP2Y9v6qY8Ecn5oICe+NvQZd69xK zXC/Yh4HLJ8NNIQHJECnNWy78D1bygDsch/cHnuJ21yG6OJwcaNEI2LbG2h8+IQZidl8 BgeTBg0ruFKgbH37+uQeui9gRqefXxj8r/dIt5mdmgCQRZZvbSnRlZdqnqQVn5KALEr0 +bx9W4inJSTPnpqAMbBLc0z+95sz8V+1va1oRzNWe6X6tpyjjYapDtAaJIgnI4BZsDib 3eXGXzTBsHjFS4XGnyHJjzfMwwbHWXmqjvxVHmDQpxq5OwznEIw0/cK6hTbs5FX3N0SB fbqg== X-Gm-Message-State: AOJu0Yy+bLL6j9rWptrudqFiE1e/5u7RrJeqVD5wB17XzriaJNO39pJ9 DJQ/HddYs7aLK2vL48lVTI1w1wIfC9PBajLJ2Fvu866sPFJAthysNSR7UEFjXrv0H6M0j9kX+oF p X-Received: by 2002:a05:600c:1884:b0:426:67f9:a7d8 with SMTP id 5b1f17b1804b1-42e7442e1bdmr21803195e9.9.1726751473491; Thu, 19 Sep 2024 06:11:13 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:13 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/38] target/arm: Convert ADDV, *ADDLV, *MAXV, *MINV to decodetree Date: Thu, 19 Sep 2024 14:10:38 +0100 Message-Id: <20240919131106.3362543-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-11-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 12 +++ target/arm/tcg/translate-a64.c | 140 ++++++++++++--------------------- 2 files changed, 61 insertions(+), 91 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 7f71c56f83e..5ab4b117810 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -59,6 +59,8 @@ @rrr_q1e3 ........ ... rm:5 ...... rn:5 rd:5 &qrrr_e q=1 esz=3 @rrrr_q1e3 ........ ... rm:5 . ra:5 rn:5 rd:5 &qrrrr_e q=1 esz=3 +@qrr_e . q:1 ...... esz:2 ...... ...... rn:5 rd:5 &qrr_e + @qrrr_b . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=0 @qrrr_h . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=1 @qrrr_s . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=2 @@ -1154,3 +1156,13 @@ TRN1 0.00 1110 .. 0 ..... 0 010 10 ..... ..... @qrrr_e TRN2 0.00 1110 .. 0 ..... 0 110 10 ..... ..... @qrrr_e ZIP1 0.00 1110 .. 0 ..... 0 011 10 ..... ..... @qrrr_e ZIP2 0.00 1110 .. 0 ..... 0 111 10 ..... ..... @qrrr_e + +# Advanced SIMD Across Lanes + +ADDV 0.00 1110 .. 11000 11011 10 ..... ..... @qrr_e +SADDLV 0.00 1110 .. 11000 00011 10 ..... ..... @qrr_e +UADDLV 0.10 1110 .. 11000 00011 10 ..... ..... @qrr_e +SMAXV 0.00 1110 .. 11000 01010 10 ..... ..... @qrr_e +UMAXV 0.10 1110 .. 11000 01010 10 ..... ..... @qrr_e +SMINV 0.00 1110 .. 11000 11010 10 ..... ..... @qrr_e +UMINV 0.10 1110 .. 11000 11010 10 ..... ..... @qrr_e diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 74efb351648..593a1774d88 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6794,6 +6794,47 @@ TRANS(FNMADD, do_fmadd, a, true, true) TRANS(FMSUB, do_fmadd, a, false, true) TRANS(FNMSUB, do_fmadd, a, true, false) +/* + * Advanced SIMD Across Lanes + */ + +static bool do_int_reduction(DisasContext *s, arg_qrr_e *a, bool widen, + MemOp src_sign, NeonGenTwo64OpFn *fn) +{ + TCGv_i64 tcg_res, tcg_elt; + MemOp src_mop = a->esz | src_sign; + int elements = (a->q ? 16 : 8) >> a->esz; + + /* Reject MO_64, and MO_32 without Q: a minimum of 4 elements. */ + if (elements < 4) { + return false; + } + if (!fp_access_check(s)) { + return true; + } + + tcg_res = tcg_temp_new_i64(); + tcg_elt = tcg_temp_new_i64(); + + read_vec_element(s, tcg_res, a->rn, 0, src_mop); + for (int i = 1; i < elements; i++) { + read_vec_element(s, tcg_elt, a->rn, i, src_mop); + fn(tcg_res, tcg_res, tcg_elt); + } + + tcg_gen_ext_i64(tcg_res, tcg_res, a->esz + widen); + write_fp_dreg(s, a->rd, tcg_res); + return true; +} + +TRANS(ADDV, do_int_reduction, a, false, 0, tcg_gen_add_i64) +TRANS(SADDLV, do_int_reduction, a, true, MO_SIGN, tcg_gen_add_i64) +TRANS(UADDLV, do_int_reduction, a, true, 0, tcg_gen_add_i64) +TRANS(SMAXV, do_int_reduction, a, false, MO_SIGN, tcg_gen_smax_i64) +TRANS(UMAXV, do_int_reduction, a, false, 0, tcg_gen_umax_i64) +TRANS(SMINV, do_int_reduction, a, false, MO_SIGN, tcg_gen_smin_i64) +TRANS(UMINV, do_int_reduction, a, false, 0, tcg_gen_umin_i64) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -9092,27 +9133,10 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) int opcode = extract32(insn, 12, 5); bool is_q = extract32(insn, 30, 1); bool is_u = extract32(insn, 29, 1); - bool is_fp = false; bool is_min = false; int elements; - int i; - TCGv_i64 tcg_res, tcg_elt; switch (opcode) { - case 0x1b: /* ADDV */ - if (is_u) { - unallocated_encoding(s); - return; - } - /* fall through */ - case 0x3: /* SADDLV, UADDLV */ - case 0xa: /* SMAXV, UMAXV */ - case 0x1a: /* SMINV, UMINV */ - if (size == 3 || (size == 2 && !is_q)) { - unallocated_encoding(s); - return; - } - break; case 0xc: /* FMAXNMV, FMINNMV */ case 0xf: /* FMAXV, FMINV */ /* Bit 1 of size field encodes min vs max and the actual size @@ -9121,7 +9145,6 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) * precision. */ is_min = extract32(size, 1, 1); - is_fp = true; if (!is_u && dc_isar_feature(aa64_fp16, s)) { size = 1; } else if (!is_u || !is_q || extract32(size, 0, 1)) { @@ -9132,6 +9155,10 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) } break; default: + case 0x3: /* SADDLV, UADDLV */ + case 0xa: /* SMAXV, UMAXV */ + case 0x1a: /* SMINV, UMINV */ + case 0x1b: /* ADDV */ unallocated_encoding(s); return; } @@ -9142,52 +9169,7 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) elements = (is_q ? 16 : 8) >> size; - tcg_res = tcg_temp_new_i64(); - tcg_elt = tcg_temp_new_i64(); - - /* These instructions operate across all lanes of a vector - * to produce a single result. We can guarantee that a 64 - * bit intermediate is sufficient: - * + for [US]ADDLV the maximum element size is 32 bits, and - * the result type is 64 bits - * + for FMAX*V, FMIN*V, ADDV the intermediate type is the - * same as the element size, which is 32 bits at most - * For the integer operations we can choose to work at 64 - * or 32 bits and truncate at the end; for simplicity - * we use 64 bits always. The floating point - * ops do require 32 bit intermediates, though. - */ - if (!is_fp) { - read_vec_element(s, tcg_res, rn, 0, size | (is_u ? 0 : MO_SIGN)); - - for (i = 1; i < elements; i++) { - read_vec_element(s, tcg_elt, rn, i, size | (is_u ? 0 : MO_SIGN)); - - switch (opcode) { - case 0x03: /* SADDLV / UADDLV */ - case 0x1b: /* ADDV */ - tcg_gen_add_i64(tcg_res, tcg_res, tcg_elt); - break; - case 0x0a: /* SMAXV / UMAXV */ - if (is_u) { - tcg_gen_umax_i64(tcg_res, tcg_res, tcg_elt); - } else { - tcg_gen_smax_i64(tcg_res, tcg_res, tcg_elt); - } - break; - case 0x1a: /* SMINV / UMINV */ - if (is_u) { - tcg_gen_umin_i64(tcg_res, tcg_res, tcg_elt); - } else { - tcg_gen_smin_i64(tcg_res, tcg_res, tcg_elt); - } - break; - default: - g_assert_not_reached(); - } - - } - } else { + { /* Floating point vector reduction ops which work across 32 * bit (single) or 16 bit (half-precision) intermediates. * Note that correct NaN propagation requires that we do these @@ -9195,34 +9177,10 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) */ TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); int fpopcode = opcode | is_min << 4 | is_u << 5; - TCGv_i32 tcg_res32 = do_reduction_op(s, fpopcode, rn, size, - 0, elements, fpst); - tcg_gen_extu_i32_i64(tcg_res, tcg_res32); + TCGv_i32 tcg_res = do_reduction_op(s, fpopcode, rn, size, + 0, elements, fpst); + write_fp_sreg(s, rd, tcg_res); } - - /* Now truncate the result to the width required for the final output */ - if (opcode == 0x03) { - /* SADDLV, UADDLV: result is 2*esize */ - size++; - } - - switch (size) { - case 0: - tcg_gen_ext8u_i64(tcg_res, tcg_res); - break; - case 1: - tcg_gen_ext16u_i64(tcg_res, tcg_res); - break; - case 2: - tcg_gen_ext32u_i64(tcg_res, tcg_res); - break; - case 3: - break; - default: - g_assert_not_reached(); - } - - write_fp_dreg(s, rd, tcg_res); } /* AdvSIMD modified immediate From patchwork Thu Sep 19 13:10:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829617 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319530wrn; Thu, 19 Sep 2024 06:18:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUAK5cUoc2yeAI9zUHK7fwQebBL3ONQS2lPu5Oal5tJG4/YMfuPnMnPT9ZR79SwflYKpG7esQ==@linaro.org X-Google-Smtp-Source: AGHT+IERsCOhehXJtHI5xzy/bGm+YMWqAyTekntE48B1CUhxC0asg4cDFLmDBqj2ll121HktmowH X-Received: by 2002:ac8:7e8c:0:b0:458:5cbb:bb8 with SMTP id d75a77b69052e-4599d252439mr350718441cf.25.1726751884158; Thu, 19 Sep 2024 06:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751884; cv=none; d=google.com; s=arc-20240605; b=ju26iaqnIy1qhsunC9PmULPj2dM07Fzrk/1G1n7sXPCAQz/YLmjqeQuKh6/4HvsxKo 6PJd8pNrQUc9bjb39RNC7qMGVREwb/n9e1iNMArpEiqs5dEM/LKwTRIvq8uaDiXgmH6/ xaVNtDQmxdQ2EG43x9iwhkLhrWykG1+SYFNpxazQL/OFxOHRrNbTmymtNGMl5l0v4OV3 yLrt4AuqSY01nGO7NMiBiWZ6xtfEdzFxnf2t8OJHVllmXpyP+yX4OBwgO+0EO9aB6H5L nrnzhoMoo1ttIknlHUJqgaxJILFj8OOvRkgQl5wpct3ZBG4HJ2k1I7yUg33DeQlvN9Jq N/Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=w2rs0shGHQnEBTFtKlv36VpzEDM06oVh8Dyeq3l3z3U=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=DciNsHLSgojQbYGRQVmxrkmTHkGwNu+V8o4SwEu3MgOIjwyWMgQhD8EMHyCb5XMeqm 0W9Rf26VUh3PrMvabQ3geYyllnEqbvhZHM5vHGSwdad20mooz42rgAhfGIZz1vYGfRgF a4ZzMuHp3Schms1odt+4zzl4cPxsNVvtqo2KIgbY3Vo8rlGRjOeelRsbDGmPajZXBS8C KwUHArcNroxSG9CkzIF4Xc1pkfhHktwBFGZkfh7Mw0pm19T8h4eU0Fu9fsZwux9FRJ6k eKOOEjI1JT0Ht/XhaDueeOrjh1CkY+OkZSMTfmhQKnJkF9scyiWIxMzNQrxKBZjv6Svq CZdg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xr9BXzQC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45b178698d9si18032281cf.116.2024.09.19.06.18.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xr9BXzQC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwh-0005zN-A6; Thu, 19 Sep 2024 09:11:43 -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 1srGwJ-0004dx-Ei for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:19 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwF-000119-Ri for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:18 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42cb57f8b41so10421455e9.0 for ; Thu, 19 Sep 2024 06:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751474; x=1727356274; 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=w2rs0shGHQnEBTFtKlv36VpzEDM06oVh8Dyeq3l3z3U=; b=Xr9BXzQCNE4qm4aI5YJCqXqEj4siGx6ei0OJD3ia6aKJTRDgQl9QYyqqcBCKTOUCXD Uf8bwJSU3TLs3iZrHbJG92sCZ+u8zMjAa21lX3HeSYzoQrEyPUZnyILVAgo4exVga22y 451zExmd2dzyKgaw4mOddxy8wmF8wBmhd22HzA8yiJ5CIp1dMXnFMM4Tmi5HNXtFxCAl q5Miq82nngzIZItErgvcNFB7huIkjgu6ay39hDuXECuJW8LfvAca07wk70brheceOTcr drP0Ud7YpCBd3qn/jfDygpj0fL6pKW33mv4XuEGgHvWE9kcDF28fDgBDdc9VK543tx2s Jfcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751474; x=1727356274; 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=w2rs0shGHQnEBTFtKlv36VpzEDM06oVh8Dyeq3l3z3U=; b=cU+w/STLtdLz40dWk4uKNs+I68O8cDQmrNHfv4Jw7W2/rd9uGyOJGmx0oD+SIqN+tD weNGQBDrhXzxQqIF1ASWhdIyaQRVIdCU9V7JuY/AFBr68ULfCnXjxlEVEd3f6qPfIVIA 7czjkTCDFswgX0Aybu+JsWQ7ecxJm+Q+MLvZQO2b/Uqi+9EEWx1P520OPAP4xb/ByL6Y 6ebb8fyccAh+HYYXwCnd1pzXpKeCZh7pKmejBvowHXtmCMHWPe58jdCSXfPsZh9qpVbF 5amtai5SIPN7AFaGIuW/JgAB64igf79T5dQ3S/ymXGUx0xVXKVaNw61HcTl/ZO9qAj2N moCA== X-Gm-Message-State: AOJu0YxxZURlX2yQ/e0DqxSdP9LmyGfsdbKyal/Bks6q0vLB/ttjZXRD 96egxwAqZ0Qhg+o9bZrC4g1Rn/aL9JpIFrl+GNQbN7X5th29sDSGnOqwEqkDKosZlVBdhy6RwsE p X-Received: by 2002:a05:600c:354a:b0:42c:c8be:4215 with SMTP id 5b1f17b1804b1-42d9070b2eamr191049925e9.4.1726751474015; Thu, 19 Sep 2024 06:11:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:13 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/38] target/arm: Convert FMAXNMV, FMINNMV, FMAXV, FMINV to decodetree Date: Thu, 19 Sep 2024 14:10:39 +0100 Message-Id: <20240919131106.3362543-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-12-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 14 +++ target/arm/tcg/translate-a64.c | 176 ++++++++++----------------------- 2 files changed, 67 insertions(+), 123 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 5ab4b117810..c77f9fc9870 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -54,11 +54,13 @@ @rrx_d ........ .. . rm:5 .... idx:1 . rn:5 rd:5 &rrx_e esz=3 @rr_q1e0 ........ ........ ...... rn:5 rd:5 &qrr_e q=1 esz=0 +@rr_q1e2 ........ ........ ...... rn:5 rd:5 &qrr_e q=1 esz=2 @r2r_q1e0 ........ ........ ...... rm:5 rd:5 &qrrr_e rn=%rd q=1 esz=0 @rrr_q1e0 ........ ... rm:5 ...... rn:5 rd:5 &qrrr_e q=1 esz=0 @rrr_q1e3 ........ ... rm:5 ...... rn:5 rd:5 &qrrr_e q=1 esz=3 @rrrr_q1e3 ........ ... rm:5 . ra:5 rn:5 rd:5 &qrrrr_e q=1 esz=3 +@qrr_h . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=1 @qrr_e . q:1 ...... esz:2 ...... ...... rn:5 rd:5 &qrr_e @qrrr_b . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=0 @@ -1166,3 +1168,15 @@ SMAXV 0.00 1110 .. 11000 01010 10 ..... ..... @qrr_e UMAXV 0.10 1110 .. 11000 01010 10 ..... ..... @qrr_e SMINV 0.00 1110 .. 11000 11010 10 ..... ..... @qrr_e UMINV 0.10 1110 .. 11000 11010 10 ..... ..... @qrr_e + +FMAXNMV_h 0.00 1110 00 11000 01100 10 ..... ..... @qrr_h +FMAXNMV_s 0110 1110 00 11000 01100 10 ..... ..... @rr_q1e2 + +FMINNMV_h 0.00 1110 10 11000 01100 10 ..... ..... @qrr_h +FMINNMV_s 0110 1110 10 11000 01100 10 ..... ..... @rr_q1e2 + +FMAXV_h 0.00 1110 00 11000 01111 10 ..... ..... @qrr_h +FMAXV_s 0110 1110 00 11000 01111 10 ..... ..... @rr_q1e2 + +FMINV_h 0.00 1110 10 11000 01111 10 ..... ..... @qrr_h +FMINV_s 0110 1110 10 11000 01111 10 ..... ..... @rr_q1e2 diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 593a1774d88..aec2f6a542a 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6835,6 +6835,59 @@ TRANS(UMAXV, do_int_reduction, a, false, 0, tcg_gen_umax_i64) TRANS(SMINV, do_int_reduction, a, false, MO_SIGN, tcg_gen_smin_i64) TRANS(UMINV, do_int_reduction, a, false, 0, tcg_gen_umin_i64) +/* + * do_fp_reduction helper + * + * This mirrors the Reduce() pseudocode in the ARM ARM. It is + * important for correct NaN propagation that we do these + * operations in exactly the order specified by the pseudocode. + * + * This is a recursive function. + */ +static TCGv_i32 do_reduction_op(DisasContext *s, int rn, MemOp esz, + int ebase, int ecount, TCGv_ptr fpst, + NeonGenTwoSingleOpFn *fn) +{ + if (ecount == 1) { + TCGv_i32 tcg_elem = tcg_temp_new_i32(); + read_vec_element_i32(s, tcg_elem, rn, ebase, esz); + return tcg_elem; + } else { + int half = ecount >> 1; + TCGv_i32 tcg_hi, tcg_lo, tcg_res; + + tcg_hi = do_reduction_op(s, rn, esz, ebase + half, half, fpst, fn); + tcg_lo = do_reduction_op(s, rn, esz, ebase, half, fpst, fn); + tcg_res = tcg_temp_new_i32(); + + fn(tcg_res, tcg_lo, tcg_hi, fpst); + return tcg_res; + } +} + +static bool do_fp_reduction(DisasContext *s, arg_qrr_e *a, + NeonGenTwoSingleOpFn *fn) +{ + if (fp_access_check(s)) { + MemOp esz = a->esz; + int elts = (a->q ? 16 : 8) >> esz; + TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + TCGv_i32 res = do_reduction_op(s, a->rn, esz, 0, elts, fpst, fn); + write_fp_sreg(s, a->rd, res); + } + return true; +} + +TRANS_FEAT(FMAXNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_maxnumh) +TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_minnumh) +TRANS_FEAT(FMAXV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_maxh) +TRANS_FEAT(FMINV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_minh) + +TRANS(FMAXNMV_s, do_fp_reduction, a, gen_helper_vfp_maxnums) +TRANS(FMINNMV_s, do_fp_reduction, a, gen_helper_vfp_minnums) +TRANS(FMAXV_s, do_fp_reduction, a, gen_helper_vfp_maxs) +TRANS(FMINV_s, do_fp_reduction, a, gen_helper_vfp_mins) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -9061,128 +9114,6 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) } } -/* - * do_reduction_op helper - * - * This mirrors the Reduce() pseudocode in the ARM ARM. It is - * important for correct NaN propagation that we do these - * operations in exactly the order specified by the pseudocode. - * - * This is a recursive function. - */ -static TCGv_i32 do_reduction_op(DisasContext *s, int fpopcode, int rn, - MemOp esz, int ebase, int ecount, TCGv_ptr fpst) -{ - if (ecount == 1) { - TCGv_i32 tcg_elem = tcg_temp_new_i32(); - read_vec_element_i32(s, tcg_elem, rn, ebase, esz); - return tcg_elem; - } else { - int half = ecount >> 1; - TCGv_i32 tcg_hi, tcg_lo, tcg_res; - - tcg_hi = do_reduction_op(s, fpopcode, rn, esz, - ebase + half, half, fpst); - tcg_lo = do_reduction_op(s, fpopcode, rn, esz, - ebase, half, fpst); - tcg_res = tcg_temp_new_i32(); - - switch (fpopcode) { - case 0x0c: /* fmaxnmv half-precision */ - gen_helper_advsimd_maxnumh(tcg_res, tcg_lo, tcg_hi, fpst); - break; - case 0x0f: /* fmaxv half-precision */ - gen_helper_advsimd_maxh(tcg_res, tcg_lo, tcg_hi, fpst); - break; - case 0x1c: /* fminnmv half-precision */ - gen_helper_advsimd_minnumh(tcg_res, tcg_lo, tcg_hi, fpst); - break; - case 0x1f: /* fminv half-precision */ - gen_helper_advsimd_minh(tcg_res, tcg_lo, tcg_hi, fpst); - break; - case 0x2c: /* fmaxnmv */ - gen_helper_vfp_maxnums(tcg_res, tcg_lo, tcg_hi, fpst); - break; - case 0x2f: /* fmaxv */ - gen_helper_vfp_maxs(tcg_res, tcg_lo, tcg_hi, fpst); - break; - case 0x3c: /* fminnmv */ - gen_helper_vfp_minnums(tcg_res, tcg_lo, tcg_hi, fpst); - break; - case 0x3f: /* fminv */ - gen_helper_vfp_mins(tcg_res, tcg_lo, tcg_hi, fpst); - break; - default: - g_assert_not_reached(); - } - return tcg_res; - } -} - -/* AdvSIMD across lanes - * 31 30 29 28 24 23 22 21 17 16 12 11 10 9 5 4 0 - * +---+---+---+-----------+------+-----------+--------+-----+------+------+ - * | 0 | Q | U | 0 1 1 1 0 | size | 1 1 0 0 0 | opcode | 1 0 | Rn | Rd | - * +---+---+---+-----------+------+-----------+--------+-----+------+------+ - */ -static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) -{ - int rd = extract32(insn, 0, 5); - int rn = extract32(insn, 5, 5); - int size = extract32(insn, 22, 2); - int opcode = extract32(insn, 12, 5); - bool is_q = extract32(insn, 30, 1); - bool is_u = extract32(insn, 29, 1); - bool is_min = false; - int elements; - - switch (opcode) { - case 0xc: /* FMAXNMV, FMINNMV */ - case 0xf: /* FMAXV, FMINV */ - /* Bit 1 of size field encodes min vs max and the actual size - * depends on the encoding of the U bit. If not set (and FP16 - * enabled) then we do half-precision float instead of single - * precision. - */ - is_min = extract32(size, 1, 1); - if (!is_u && dc_isar_feature(aa64_fp16, s)) { - size = 1; - } else if (!is_u || !is_q || extract32(size, 0, 1)) { - unallocated_encoding(s); - return; - } else { - size = 2; - } - break; - default: - case 0x3: /* SADDLV, UADDLV */ - case 0xa: /* SMAXV, UMAXV */ - case 0x1a: /* SMINV, UMINV */ - case 0x1b: /* ADDV */ - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - elements = (is_q ? 16 : 8) >> size; - - { - /* Floating point vector reduction ops which work across 32 - * bit (single) or 16 bit (half-precision) intermediates. - * Note that correct NaN propagation requires that we do these - * operations in exactly the order specified by the pseudocode. - */ - TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); - int fpopcode = opcode | is_min << 4 | is_u << 5; - TCGv_i32 tcg_res = do_reduction_op(s, fpopcode, rn, size, - 0, elements, fpst); - write_fp_sreg(s, rd, tcg_res); - } -} - /* AdvSIMD modified immediate * 31 30 29 28 19 18 16 15 12 11 10 9 5 4 0 * +---+---+----+---------------------+-----+-------+----+---+-------+------+ @@ -11735,7 +11666,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) static const AArch64DecodeTable data_proc_simd[] = { /* pattern , mask , fn */ { 0x0e200800, 0x9f3e0c00, disas_simd_two_reg_misc }, - { 0x0e300800, 0x9f3e0c00, disas_simd_across_lanes }, /* simd_mod_imm decode is a subset of simd_shift_imm, so must precede it */ { 0x0f000400, 0x9ff80400, disas_simd_mod_imm }, { 0x0f000400, 0x9f800400, disas_simd_shift_imm }, From patchwork Thu Sep 19 13:10:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829608 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp317159wrn; Thu, 19 Sep 2024 06:13:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUxh/X4amHS/g8ysoxHiVhx2UAPjwBTl9KFnQ78mE0ck3ehCHd3u5pXJOKLwZSPYRWIJ4LtuA==@linaro.org X-Google-Smtp-Source: AGHT+IHQvSZz7SMWHBW5qcdH8AH2iV/Ge7xiLGNS3xE8qUYC9bP1V2lW+EFYzlGx4EUI7UwGlvq4 X-Received: by 2002:a05:6122:198e:b0:503:d875:6a26 with SMTP id 71dfb90a1353d-503d8756d7fmr675846e0c.5.1726751629147; Thu, 19 Sep 2024 06:13:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751629; cv=none; d=google.com; s=arc-20240605; b=T5efx+RaR9SrpPCDRKU0BJnPJAGAbV2qZJYT0FxQ+XJ7bhB+rYg1MqjEeNOBNA3avl U4sgU1IzWcMMy4tT6v3D5QCp9ufdjY5IqY37H5Ebm7fcILIAi/TtNrn4fff1+yrQzwoD pzskv8mPD3FiBdztN/wb81/VYL/QJszRZx3XKwGggb8aEHnfkmugomLImrFiGMK9tF73 GhKx5Zeh1ReG5UW7w9PholqKpz0j4mpDj7njSmQ9wRqXDFuDBK47nH2hg+a0k65HKXHc wxHXIh2C9LStZk0muEiFR49LO6q34yuYgSoCzAMVTAtv7Ha6GmLY95e12W1Mw3qUY7Bp IulA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7Pb5Ur5SlwBbUkJJZB5BuBT+5Cma8+8Ft4qmvnIsqo4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=DmYmwu6fs5zqAmUMlWSolA0DfZTUs5NXKCNVk68iPzXItOGznYjziUEbBEOLFSfFlb thUIPUDKhRtveFYxXcxywkWQX/6YO2F5Z6Rcy/aTfZaAN7q+noyd2mPirY7oSP2TJCQ3 HBP/YX0FjOSAYdJN1LHjvwg9q/3pIBZy2YMNbM+h0aOKxPLU6Qw3sw1MBx00pU6u6aHP YYJGS6b6ooKuPcBuJjAWai8paKhdGBTqGtUMGzVcQULNzSZ2Zx/n1kQejpMYw2zOr9hx ZYxK9gGPBctFaKLVovKCAwKHbXtmtLKK4C4dnaJ2l9YrZUxUuC9Utj6TrKowYm6481Zf VyGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qn66sjtE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5035bc7d953si1527262e0c.228.2024.09.19.06.13.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:13:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qn66sjtE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwW-00057p-DG; Thu, 19 Sep 2024 09:11:36 -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 1srGwJ-0004dl-De for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:19 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwF-00011G-U7 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:18 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42cafda818aso7651505e9.2 for ; Thu, 19 Sep 2024 06:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751474; x=1727356274; 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=7Pb5Ur5SlwBbUkJJZB5BuBT+5Cma8+8Ft4qmvnIsqo4=; b=Qn66sjtEaM+Mo/vYNgzx7a7jrIffOwEeQMUVt7r9tY1EtSlxTqzh1tt3VSMyc4mTjT z30Q80AJf2PRJaaRXizLVZC8qTutyWC9WF3v9dYFL3iOk0iUibpPGSpfxqTuaf7cds/B Qu5n+Pj6cvECxiAKBfVqy6l1wNGqC4XW3/av+BBYOSdHqi7oZpwcl7A8INBhx0U7M1l1 3SwTDe1iZwHzYPyVRAHOPv8y6a1j1txtvRHjGNrMRiAXV/bBAzNd5VNvHK8nY8G5EFoA TMkFrCCxnDiGupTGHO3+sT9dN5saJjc9EkMi/5YljvlXYqaoYKmWqc1X/oUSaHt1BRPi 6gxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751474; x=1727356274; 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=7Pb5Ur5SlwBbUkJJZB5BuBT+5Cma8+8Ft4qmvnIsqo4=; b=oJd01q4YQcCBMrZ1dJLflIgCPvFyPxvqJt0c1LAbIwSz89x2i/njHyHWM0opmBy3+u JN6ckt/6Ylpb4OAKAzdXSNoC9RJOv94EMHWfRSjuBa+OUIAc8AYeyvKB/I2RStEX/exP lXNzwQUK/40N9nmNOC8nbDj9z+ON3S6JDgw08YEjuPq3l5zzodhfrNlxq9vHFym1nWqS sdTo60c0rGkrJN194ucO6IgWGSnkW9pX7lby96sWCVT6l/ux8g+Ibkzanx48IaYsOwih elBXOLH6u6f3nZj9U6pcsqHhC3fPPNW1/7jvsQs/u5svfsI4xwX7HVgLEUWZZE1jHXwD 0nRg== X-Gm-Message-State: AOJu0YyGD3EpG6/FYTMX7Uxh8iZ+94pC3QazmE0nAC+32GWNYBRvWXM4 XrnKRMiaNR2Dhk9jblK46e6qDFov6+jkAW0b5SEW1w/iiOuIxVJtMqwvb5k2ZpLGeYHQW6ea0iR h X-Received: by 2002:a05:600c:3504:b0:42c:b1ee:4afb with SMTP id 5b1f17b1804b1-42cdfac946fmr192095805e9.26.1726751474536; Thu, 19 Sep 2024 06:11:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:14 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/38] target/arm: Convert FMOVI (scalar, immediate) to decodetree Date: Thu, 19 Sep 2024 14:10:40 +0100 Message-Id: <20240919131106.3362543-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-13-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 4 ++ target/arm/tcg/translate-a64.c | 74 ++++++++++++---------------------- 2 files changed, 30 insertions(+), 48 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index c77f9fc9870..e11e293631b 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1180,3 +1180,7 @@ FMAXV_s 0110 1110 00 11000 01111 10 ..... ..... @rr_q1e2 FMINV_h 0.00 1110 10 11000 01111 10 ..... ..... @qrr_h FMINV_s 0110 1110 10 11000 01111 10 ..... ..... @rr_q1e2 + +# Floating-point Immediate + +FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index aec2f6a542a..0e290062ef1 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6888,6 +6888,31 @@ TRANS(FMINNMV_s, do_fp_reduction, a, gen_helper_vfp_minnums) TRANS(FMAXV_s, do_fp_reduction, a, gen_helper_vfp_maxs) TRANS(FMINV_s, do_fp_reduction, a, gen_helper_vfp_mins) +/* + * Floating-point Immediate + */ + +static bool trans_FMOVI_s(DisasContext *s, arg_FMOVI_s *a) +{ + switch (a->esz) { + case MO_32: + case MO_64: + break; + case MO_16: + if (!dc_isar_feature(aa64_fp16, s)) { + return false; + } + break; + default: + return false; + } + if (fp_access_check(s)) { + uint64_t imm = vfp_expand_imm(a->esz, a->imm); + write_fp_dreg(s, a->rd, tcg_constant_i64(imm)); + } + return true; +} + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -8625,53 +8650,6 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) } } -/* Floating point immediate - * 31 30 29 28 24 23 22 21 20 13 12 10 9 5 4 0 - * +---+---+---+-----------+------+---+------------+-------+------+------+ - * | M | 0 | S | 1 1 1 1 0 | type | 1 | imm8 | 1 0 0 | imm5 | Rd | - * +---+---+---+-----------+------+---+------------+-------+------+------+ - */ -static void disas_fp_imm(DisasContext *s, uint32_t insn) -{ - int rd = extract32(insn, 0, 5); - int imm5 = extract32(insn, 5, 5); - int imm8 = extract32(insn, 13, 8); - int type = extract32(insn, 22, 2); - int mos = extract32(insn, 29, 3); - uint64_t imm; - MemOp sz; - - if (mos || imm5) { - unallocated_encoding(s); - return; - } - - switch (type) { - case 0: - sz = MO_32; - break; - case 1: - sz = MO_64; - break; - case 3: - sz = MO_16; - if (dc_isar_feature(aa64_fp16, s)) { - break; - } - /* fallthru */ - default: - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - imm = vfp_expand_imm(sz, imm8); - write_fp_dreg(s, rd, tcg_constant_i64(imm)); -} - /* Handle floating point <=> fixed point conversions. Note that we can * also deal with fp <=> integer conversions as a special case (scale == 64) * OPTME: consider handling that special case specially or at least skipping @@ -9091,7 +9069,7 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) switch (ctz32(extract32(insn, 12, 4))) { case 0: /* [15:12] == xxx1 */ /* Floating point immediate */ - disas_fp_imm(s, insn); + unallocated_encoding(s); /* in decodetree */ break; case 1: /* [15:12] == xx10 */ /* Floating point compare */ From patchwork Thu Sep 19 13:10:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829602 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316584wrn; Thu, 19 Sep 2024 06:12:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW5XFTlwe2M0+9zfFOgJPn26Fq7iOkr2MV6jHFOlOU8mELfnh08/PTXCrLeABeC3bsJe8G4cA==@linaro.org X-Google-Smtp-Source: AGHT+IHg51X4T2XpnqZkit0Su4fkIR+rHsiUEo7fwipuimuCE/f41h3cKtDvxLnZ+mALVqAQsuox X-Received: by 2002:a05:6358:712:b0:1b8:3468:3f3b with SMTP id e5c5f4694b2df-1bc3941f872mr624075555d.3.1726751561651; Thu, 19 Sep 2024 06:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751561; cv=none; d=google.com; s=arc-20240605; b=k+GIULB3WwiKV0iMuRj/iTspOS1MQqLnuiJ3yHWK3hvD2h3lfkYfpcG14FA1KKlATN wdvfyHggoynAyYd6stmxaOdOCuawQLbTcqOuv2PsfqF1KJS4uOQScHPmkERnAtDNdKR9 vHG8LjhdXM6HNMrc20Wc7xtztXDuBw2EsfLfE6P7BLruaxuIbnLe/uulmh6pVMkhF/KZ +h3hk7khr5Dn1qqqj/RS8G3E5FUrSnHCY2UqWvJB81709ZUnIvUMFyK/hnPMaQ94/1id 8JDQyzZ3sxkeYHNB/pckQImdLS00RDksUPX9vTYxsK82EeWEoJa+axOHt9G9GBXBuUyW dpAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NwA8IMlT0sOSRXhOrSBTBleprWAAmzHJ7qrswSkhHtE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ZiRyrYK3OsM2xCL2bbstEswxlM9l0oqyfHFdxIWIIeFDyEPZcSfaC9oxWHI7XmE/2V ym6wfZ37a9aYADLguQexbG71DQK5+7b4yXlKPPzUMZtUTmbH4wjv/9kWGq+fGAaRrm1R SkQkJlp0bq9SrMpJVP83c+UhBRU+fWLjgTMeXkWeI+P/05WCvhD21adGxvwj1d4qnWCv AT1GC4S1idFDfjDL6v3SnEPJ9IBVzsOd4upw6FlbGPRAmA0JtZYFzP+4bsRKtCO1gf4b F6XjbH1Pg07kly+THWViYT+DW9V+78YaRhVDct0/hAXgYsIkXZ2Sn4mstiyUW+HM1bl8 Pvpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fe8hdSTU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-49e6b43bae5si2185922137.387.2024.09.19.06.12.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:12:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fe8hdSTU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwj-0006A7-Pk; Thu, 19 Sep 2024 09:11:45 -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 1srGwL-0004l9-8f for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:21 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwH-00011V-8Z for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:20 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42cbc38a997so5487695e9.1 for ; Thu, 19 Sep 2024 06:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751475; x=1727356275; 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=NwA8IMlT0sOSRXhOrSBTBleprWAAmzHJ7qrswSkhHtE=; b=Fe8hdSTU411BgOUAZIf3gBlLgnt57wOa1JKu6+P631MXj14jPTCy6Rgx2tNaY08Y0f XherVE62Y1b1UwxPQnFh8ngcOu2OZSugWn+DMpkYBOhzDxr6w3KkKll2MlBh3mRZeiIj lwxVoYYWUQRb2h40K8wBi3/mCAJvwLwwGXQK75n7dvk81CoIn+XLwBH8qPm9U1n01D2y 0sgDNXQABzb2/QPDs25sX0/MrVYctHHpSzeCQX8+CcBda/aFAjgdI8V8cYUEbR6qFkNP SKMxW8QB4y69x8JNenxp//quqJDdtOY1y4EMo8LwKI9uaHZwlRZjiI3alasjdOZgQWl3 i++g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751475; x=1727356275; 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=NwA8IMlT0sOSRXhOrSBTBleprWAAmzHJ7qrswSkhHtE=; b=l8Pkj1OwBY9PK53/C60dnAoWYbgm4X2i7vX83BlzrevAkT+VrY+zdmEr0vxyIUgIHj J9Fp2Qjq3CaeROcPIM0oWEYA6/321FTrkaowVrBfzwV2JYxnGXWAHsC+Hw/XU6pJB7pV MIJm/LBaVcS9sXxJieO1L7goqZVa0/6aIbQLGrYTBXfqdrfmvgm0dVlJTZhu6WbZV/En jOOcGY1VLzn5TK3JVgCtCYptSGb6BWx9hmdjjk7AwsjX64h4olZeVsatdDwH4Nave5OH mlmGyA8kNVNHK5Tw2LgaAKC8wytd9cphPSH5ut67Dt34EJXqSsPU+hG97p8NlkryBGb1 FQ9g== X-Gm-Message-State: AOJu0Yx5vtP/UTpocdWw9R09YiEEXwAxhwOQUMd1i9TK6vE0K4+t/Xsa 8DNQIxkcZE6hKgxyTMGEg31wLkX+4b9LTBrwZBe0uM+T8xt8rVEPdJZB0ap6TyNJwZfZhTlvgMh t X-Received: by 2002:a05:600c:154d:b0:42c:b2a2:af3a with SMTP id 5b1f17b1804b1-42e744279b1mr21822355e9.9.1726751475005; Thu, 19 Sep 2024 06:11:15 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:14 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/38] target/arm: Convert MOVI, FMOV, ORR, BIC (vector immediate) to decodetree Date: Thu, 19 Sep 2024 14:10:41 +0100 Message-Id: <20240919131106.3362543-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-14-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 9 +++ target/arm/tcg/translate-a64.c | 117 ++++++++++++++------------------- 2 files changed, 59 insertions(+), 67 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index e11e293631b..278d7873c21 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1184,3 +1184,12 @@ FMINV_s 0110 1110 10 11000 01111 10 ..... ..... @rr_q1e2 # Floating-point Immediate FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd + +# Advanced SIMD Modified Immediate + +%abcdefgh 16:3 5:5 + +FMOVI_v_h 0 q:1 00 1111 00000 ... 1111 11 ..... rd:5 %abcdefgh + +# MOVI, MVNI, ORR, BIC, FMOV are all intermixed via cmode. +Vimm 0 q:1 op:1 0 1111 00000 ... cmode:4 01 ..... rd:5 %abcdefgh diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 0e290062ef1..53022f4fc08 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6913,6 +6913,52 @@ static bool trans_FMOVI_s(DisasContext *s, arg_FMOVI_s *a) return true; } +/* + * Advanced SIMD Modified Immediate + */ + +static bool trans_FMOVI_v_h(DisasContext *s, arg_FMOVI_v_h *a) +{ + if (!dc_isar_feature(aa64_fp16, s)) { + return false; + } + if (fp_access_check(s)) { + tcg_gen_gvec_dup_imm(MO_16, vec_full_reg_offset(s, a->rd), + a->q ? 16 : 8, vec_full_reg_size(s), + vfp_expand_imm(MO_16, a->abcdefgh)); + } + return true; +} + +static void gen_movi(unsigned vece, uint32_t dofs, uint32_t aofs, + int64_t c, uint32_t oprsz, uint32_t maxsz) +{ + tcg_gen_gvec_dup_imm(MO_64, dofs, oprsz, maxsz, c); +} + +static bool trans_Vimm(DisasContext *s, arg_Vimm *a) +{ + GVecGen2iFn *fn; + + /* Handle decode of cmode/op here between ORR/BIC/MOVI */ + if ((a->cmode & 1) && a->cmode < 12) { + /* For op=1, the imm will be inverted, so BIC becomes AND. */ + fn = a->op ? tcg_gen_gvec_andi : tcg_gen_gvec_ori; + } else { + /* There is one unallocated cmode/op combination in this space */ + if (a->cmode == 15 && a->op == 1 && a->q == 0) { + return false; + } + fn = gen_movi; + } + + if (fp_access_check(s)) { + uint64_t imm = asimd_imm_const(a->abcdefgh, a->cmode, a->op); + gen_gvec_fn2i(s, a->q, a->rd, a->rd, imm, fn, MO_64); + } + return true; +} + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -9092,69 +9138,6 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) } } -/* AdvSIMD modified immediate - * 31 30 29 28 19 18 16 15 12 11 10 9 5 4 0 - * +---+---+----+---------------------+-----+-------+----+---+-------+------+ - * | 0 | Q | op | 0 1 1 1 1 0 0 0 0 0 | abc | cmode | o2 | 1 | defgh | Rd | - * +---+---+----+---------------------+-----+-------+----+---+-------+------+ - * - * There are a number of operations that can be carried out here: - * MOVI - move (shifted) imm into register - * MVNI - move inverted (shifted) imm into register - * ORR - bitwise OR of (shifted) imm with register - * BIC - bitwise clear of (shifted) imm with register - * With ARMv8.2 we also have: - * FMOV half-precision - */ -static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) -{ - int rd = extract32(insn, 0, 5); - int cmode = extract32(insn, 12, 4); - int o2 = extract32(insn, 11, 1); - uint64_t abcdefgh = extract32(insn, 5, 5) | (extract32(insn, 16, 3) << 5); - bool is_neg = extract32(insn, 29, 1); - bool is_q = extract32(insn, 30, 1); - uint64_t imm = 0; - - if (o2) { - if (cmode != 0xf || is_neg) { - unallocated_encoding(s); - return; - } - /* FMOV (vector, immediate) - half-precision */ - if (!dc_isar_feature(aa64_fp16, s)) { - unallocated_encoding(s); - return; - } - imm = vfp_expand_imm(MO_16, abcdefgh); - /* now duplicate across the lanes */ - imm = dup_const(MO_16, imm); - } else { - if (cmode == 0xf && is_neg && !is_q) { - unallocated_encoding(s); - return; - } - imm = asimd_imm_const(abcdefgh, cmode, is_neg); - } - - if (!fp_access_check(s)) { - return; - } - - if (!((cmode & 0x9) == 0x1 || (cmode & 0xd) == 0x9)) { - /* MOVI or MVNI, with MVNI negation handled above. */ - tcg_gen_gvec_dup_imm(MO_64, vec_full_reg_offset(s, rd), is_q ? 16 : 8, - vec_full_reg_size(s), imm); - } else { - /* ORR or BIC, with BIC negation to AND handled above. */ - if (is_neg) { - gen_gvec_fn2i(s, is_q, rd, rd, imm, tcg_gen_gvec_andi, MO_64); - } else { - gen_gvec_fn2i(s, is_q, rd, rd, imm, tcg_gen_gvec_ori, MO_64); - } - } -} - /* * Common SSHR[RA]/USHR[RA] - Shift right (optional rounding/accumulate) * @@ -10635,8 +10618,10 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) bool is_u = extract32(insn, 29, 1); bool is_q = extract32(insn, 30, 1); - /* data_proc_simd[] has sent immh == 0 to disas_simd_mod_imm. */ - assert(immh != 0); + if (immh == 0) { + unallocated_encoding(s); + return; + } switch (opcode) { case 0x08: /* SRI */ @@ -11644,8 +11629,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) static const AArch64DecodeTable data_proc_simd[] = { /* pattern , mask , fn */ { 0x0e200800, 0x9f3e0c00, disas_simd_two_reg_misc }, - /* simd_mod_imm decode is a subset of simd_shift_imm, so must precede it */ - { 0x0f000400, 0x9ff80400, disas_simd_mod_imm }, { 0x0f000400, 0x9f800400, disas_simd_shift_imm }, { 0x5e200800, 0xdf3e0c00, disas_simd_scalar_two_reg_misc }, { 0x5f000400, 0xdf800400, disas_simd_scalar_shift_imm }, From patchwork Thu Sep 19 13:10:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829633 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320586wrn; Thu, 19 Sep 2024 06:20:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUYspp6OmOeGBuclUCDVeRDyFvctrK+GJXMS4ATErzDRj8h6JWF2aa9q+dIAgsUNDpmgciZOA==@linaro.org X-Google-Smtp-Source: AGHT+IF+PoHmSvx8QLFZEyeYEkoNqSFSe+GMG1G8TUjMja8jamLGB7kIut8g01cyP3SfjKJ8fMdR X-Received: by 2002:a0c:fcce:0:b0:6c5:7c58:13c3 with SMTP id 6a1803df08f44-6c57c581665mr289299696d6.1.1726752012579; Thu, 19 Sep 2024 06:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726752012; cv=none; d=google.com; s=arc-20240605; b=RkHPBxd/7EHR1wP5UEtde+BQ73djKHpRtgkgG9fJTmrROmJCnZpXbADth7UlNY4ZNg Q/VR4oUsxzCO1sAzVqbw/Cjv+5RC/uGa2aHH6/+qC5hF/hR3HlvWxT4nAJHqRBIBNjek 5uqsWXFyggrwNr+1zQwpKGScFq3AqjrrgJ7UT5w0m/P0PJjfy6kVdxbFGeZ47FIBzSUB mGm6SGQjczl7FqVvJUVfLXzdzEV22gBFN1dUFQJHEafbYX01bY7qntzB4cjvupY3IvkY K+H/duIxScBCbKaMYL4ykzj6CmMedfEFbcFsVFHnbPi3gc4N9FjV1ikeXES8dKBmy6g3 whJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=77EyE8OGWL9B86asGNhTWMqtVOBMqqUs1GAcCB8v5ek=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=arfiizoDMLs52xKE2fPMApM3jOTUpmshx+WncFD6X8Rl8evy6DCRevCENXiDMMwKxv 0oUnLy6tk8Bbiav8Pdr0/O7AbwEybxF7EwA22RMWPD1ap6hrTaskELFMw45RUl6foT/m ht7/Enn5vFPfM9/fjX2hBVoVcj4rERSr3G9mGb05RTyVVhQ7m6qadKn1Rx47aKQ4o+zB dyjeY1V8cRGeQED6tFitTfsx8W4GR4KjTvIrjtmoqb9KTQod+8JnH4QS4lPsA4xY1sBX 4f6EoEQCBThMelSQ9XXu9L6/TKOhhAyDC4SsUdM0Uimu2C+SA/3DNrelePLR8/4e/T0C dARw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HX7+Kvv9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c75e564a04si18421136d6.198.2024.09.19.06.20.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:20:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HX7+Kvv9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwi-00063P-0p; Thu, 19 Sep 2024 09:11:44 -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 1srGwO-0004wz-Bw for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:24 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwJ-00011e-3K for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:21 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2f758f84dfbso6799121fa.0 for ; Thu, 19 Sep 2024 06:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751476; x=1727356276; 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=77EyE8OGWL9B86asGNhTWMqtVOBMqqUs1GAcCB8v5ek=; b=HX7+Kvv9wlBz52nNCkX39Qhc7QLEBTZB4SfqFkavGnan9P26LwxT6R8UIgYqLd16rm 1TFf0bc9mm+BHkT6LaiEwKTWgjDp6M92XLiXuezN7762PDcXYp78yd10aALzAH5KxccG 3u4OIrA5eMTYOxXrt6upn9kdtwWuWAFaNd5mTJIodWrwQ4lS/3UbCGMNkzyARabcaaYq cRI5uhtOjq1bizSORioER/ggSwgYKcOMCwOWfqY9o0i5b4GNEqg8bQQXtEs6rw122To3 Vh9RMhRUd63kk0eSt0R9DNN2s0HftB4ZlvSxjaCh79aqo7mji4C9wxryIqOwq+8kr6RD y4Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751476; x=1727356276; 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=77EyE8OGWL9B86asGNhTWMqtVOBMqqUs1GAcCB8v5ek=; b=kdUiNZkNiOPRTQ3pNyR/eNgvCosKQP3wzUpAyGEt0Cb08CcI06SwsaNXKruThtKF/F kvQH4YmtkFFe6Q8bxs/v7Y/VEMJY8Iphkr7qwfQAwOGv3yPHDe6BU6X7vitNR5keFkGK ZTPHV7Oo6RHPy4VMqZqGURuyLRbb+JsN+9C763jgiMuO2QL8aVW0gchQboQ0Jk75MSxT bPmjGxYDJemr/IfFoDZMKKNCY5O97688wlRH4rTVQvAeQR1eOSuxPsbJO76LhRTgEkiB 6TGUVvsWyzK8yYnq2KcEJGrPA2fwjfQuoFsBovh1zzOg1vFYHhi2iD5YmZWkTL66Cu3i gkyg== X-Gm-Message-State: AOJu0YwYUIo/aeIfrxBFQL8cApXGJPmiL7XQjk9vZ7shRThqrOF218Lm a2jJPI9RbFV9xmijw88dCl9ryA1tLMs7nF5sQvHgaelL5wuGi5nT4wZ0sP1H9vmzrBi/qUfLm6s T X-Received: by 2002:a2e:a987:0:b0:2f3:d8dd:a1f6 with SMTP id 38308e7fff4ca-2f787f505demr158361821fa.40.1726751475789; Thu, 19 Sep 2024 06:11:15 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:15 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/38] target/arm: Introduce gen_gvec_sshr, gen_gvec_ushr Date: Thu, 19 Sep 2024 14:10:42 +0100 Message-Id: <20240919131106.3362543-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22d.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Handle the two special cases within these new functions instead of higher in the call stack. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-15-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate.h | 5 +++++ target/arm/tcg/gengvec.c | 19 +++++++++++++++++++ target/arm/tcg/translate-a64.c | 16 +--------------- target/arm/tcg/translate-neon.c | 25 ++----------------------- 4 files changed, 27 insertions(+), 38 deletions(-) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 3f0e9ceaa39..45990ae2928 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -514,6 +514,11 @@ void gen_sqsub_d(TCGv_i64 d, TCGv_i64 q, TCGv_i64 a, TCGv_i64 b); void gen_gvec_sqsub_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_sshr(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, + int64_t shift, uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_ushr(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, + int64_t shift, uint32_t opr_sz, uint32_t max_sz); + void gen_gvec_ssra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, int64_t shift, uint32_t opr_sz, uint32_t max_sz); void gen_gvec_usra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index c5fc1b6cfbf..33c5084ea64 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -88,6 +88,25 @@ GEN_CMP0(gen_gvec_cgt0, TCG_COND_GT) #undef GEN_CMP0 +void gen_gvec_sshr(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, + int64_t shift, uint32_t opr_sz, uint32_t max_sz) +{ + /* Signed shift out of range results in all-sign-bits */ + shift = MIN(shift, (8 << vece) - 1); + tcg_gen_gvec_sari(vece, rd_ofs, rm_ofs, shift, opr_sz, max_sz); +} + +void gen_gvec_ushr(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, + int64_t shift, uint32_t opr_sz, uint32_t max_sz) +{ + /* Unsigned shift out of range results in all-zero-bits */ + if (shift >= (8 << vece)) { + tcg_gen_gvec_dup_imm(vece, rd_ofs, opr_sz, max_sz, 0); + } else { + tcg_gen_gvec_shri(vece, rd_ofs, rm_ofs, shift, opr_sz, max_sz); + } +} + static void gen_ssra8_i64(TCGv_i64 d, TCGv_i64 a, int64_t shift) { tcg_gen_vec_sar8i_i64(a, a, shift); diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 53022f4fc08..032bd336502 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -10452,21 +10452,7 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u, break; case 0x00: /* SSHR / USHR */ - if (is_u) { - if (shift == 8 << size) { - /* Shift count the same size as element size produces zero. */ - tcg_gen_gvec_dup_imm(size, vec_full_reg_offset(s, rd), - is_q ? 16 : 8, vec_full_reg_size(s), 0); - return; - } - gvec_fn = tcg_gen_gvec_shri; - } else { - /* Shift count the same size as element size produces all sign. */ - if (shift == 8 << size) { - shift -= 1; - } - gvec_fn = tcg_gen_gvec_sari; - } + gvec_fn = is_u ? gen_gvec_ushr : gen_gvec_sshr; break; case 0x04: /* SRSHR / URSHR (rounding) */ diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 13cd31aad42..a31a78c3478 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -1099,29 +1099,8 @@ DO_2SH(VRSHR_S, gen_gvec_srshr) DO_2SH(VRSHR_U, gen_gvec_urshr) DO_2SH(VRSRA_S, gen_gvec_srsra) DO_2SH(VRSRA_U, gen_gvec_ursra) - -static bool trans_VSHR_S_2sh(DisasContext *s, arg_2reg_shift *a) -{ - /* Signed shift out of range results in all-sign-bits */ - a->shift = MIN(a->shift, (8 << a->size) - 1); - return do_vector_2sh(s, a, tcg_gen_gvec_sari); -} - -static void gen_zero_rd_2sh(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, - int64_t shift, uint32_t oprsz, uint32_t maxsz) -{ - tcg_gen_gvec_dup_imm(vece, rd_ofs, oprsz, maxsz, 0); -} - -static bool trans_VSHR_U_2sh(DisasContext *s, arg_2reg_shift *a) -{ - /* Shift out of range is architecturally valid and results in zero. */ - if (a->shift >= (8 << a->size)) { - return do_vector_2sh(s, a, gen_zero_rd_2sh); - } else { - return do_vector_2sh(s, a, tcg_gen_gvec_shri); - } -} +DO_2SH(VSHR_S, gen_gvec_sshr) +DO_2SH(VSHR_U, gen_gvec_ushr) static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a, NeonGenTwo64OpEnvFn *fn) From patchwork Thu Sep 19 13:10:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829622 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319971wrn; Thu, 19 Sep 2024 06:18:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUaSVd2ExY2+zExiErT9VYnPWFzOUiWt4LojruKTFqqoUuCewTVqhUnmkJfD7ddcdgMAzbTpw==@linaro.org X-Google-Smtp-Source: AGHT+IEwnh2SoXFQhqafRkeOYnN94zE6ZDdaWAqTgZ6pHODM74ETth7qqSwyxqK2EHps8eQlSWNT X-Received: by 2002:a05:690c:f88:b0:6de:1e2:d638 with SMTP id 00721157ae682-6de01e3333fmr55386737b3.3.1726751935437; Thu, 19 Sep 2024 06:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751935; cv=none; d=google.com; s=arc-20240605; b=EnnPkEH1bw6zP9EnvygMdhIRkzJfTeMzzISbKgShEQL7NrUwisrxPAY+K6dU1tSkK0 VtgcyHtlm+Y6bGKYHyLmaqhs6zpO2ekzIUU8ZBuQnNLBFa5ZSRpUTloTBS+QixLMWUn4 +oh8mrZycuqgSslKN3lDsOWgAHP2fBU7KTUZiTtSfzKV6OrPJaFzXar8Pabmi9/d/3Ms 8DDVDq6foiXkS5sqi19xR8rJGau8BPRMas90Qjmef2z33eodGcl7YBneUmcL9xgOLOGy Z1P67ffUSNmqX2D/iQyb4TI06w4VrOLBLsiB6PeHjujftqzvtZOGiXVKS3iOnr11qC4i nqzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dD+vF7VmxRugqVzyEsydLmIdMP99vP2j/3rSmzOsQ5c=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=G+FHU1GBq5VgwAuTS0kL8N4uYWEgwNn+BhoVXBqLPQClQ/m6dijNWjbhq76PueKRJf LNXrN9slXBrRba4u66iUcO9uGF9kv1+kG6K8XoxxKHY92URKLnS78OBDjYSCVWTUDRK3 V9DCYLmILpItfU6sR644gNezlVhTf55l+lEHesnxXvZV4NPPUfCuLo25LuzK4DnPQOiu zUe7mCdyrUW/KlWSeqnkF10qDOry2LaykJ3h+xVQb8i05fA54BY9d2Etl6zW3xQAjICv 4AkyDcvHsuChqCmX6WmMTWMWeZKCer3zIBTPDygJ/tPeJQGOCNsXYVKqWXMRw93xTwV1 wYGQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tzJSv8VA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c75e56199csi5170336d6.290.2024.09.19.06.18.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tzJSv8VA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwk-0006Dd-KT; Thu, 19 Sep 2024 09:11:46 -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 1srGwP-00053B-Ue for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:26 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwJ-00011p-4K for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:22 -0400 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2f7528f4658so7180291fa.3 for ; Thu, 19 Sep 2024 06:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751477; x=1727356277; 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=dD+vF7VmxRugqVzyEsydLmIdMP99vP2j/3rSmzOsQ5c=; b=tzJSv8VA1zW6A+t11i35McsanVxF/r6zQR/xanefWltxoABYFHhmMxOfNLHp4UvQHr Y1B4TAOm91RhHU2CqhruC2rAX6K6LN62uW5aLETd9Jf8eJiEhlHJgczvshy8VRQpVzGz G4/I/kw9zY1kwbEfOnmvemQYcK46/+F/vacL4rwIadEQye8BJcQppE4n9UCqUierzzXy X4N5fgOumI+m0CUV0GESFwzVzsl5FOm2o8G8LZequP11oXGHoPyXipU/McvROXBZcfMj y2HGc8ad22NgKsIAZxRMBaczO8Y6LMhiEyD9bv44QwZ/q7JgSQDC+DyhwkPEIBbL2Oup 6Auw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751477; x=1727356277; 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=dD+vF7VmxRugqVzyEsydLmIdMP99vP2j/3rSmzOsQ5c=; b=wPqcAMETC6NTMXRpQEiQdtul7cDRTepMeQiSqSxHkaSTjTeFeoqGprZNjgoIjLc3D8 57Q0UOweJyXgoNIQ4WX6cCwtTku5gbYnHzjH9ac3YYaMx+ydoXwbjs/PNC/CK5LrFl74 d3wtpcI0RmMENZIgiruPNNpuaPYhJu6PtH7epQ07ZGUWxirWMkkPQXyN/Ul7qqJWmXQt COJ/1Na5kyHi1T5Znf2XPeBGHV5mrWziiircnoBH8x40i8RqnnE4dgJSjti5uVpiNY2U ruzfCpILDlK1PKSDRYo9jRwhF51cCZRKZ3mFN+ABeSx9e8mFWJYCnyrkRfoPNzV7aFJv ptEA== X-Gm-Message-State: AOJu0YwU9IPz1NXiBGkWERIUrGYzkVM2ErlrtNyYAziQokSQPrt30dRd 9z7Q+QmstooqsOYONeZ/SRzubPrn8CQg21zHEXd46OGCG+GmAA05/FYJBptkNLteffHZum6kkKZ 4 X-Received: by 2002:a2e:4e11:0:b0:2f3:b582:a914 with SMTP id 38308e7fff4ca-2f791b5cf4amr100144841fa.41.1726751476597; Thu, 19 Sep 2024 06:11:16 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:16 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/38] target/arm: Fix whitespace near gen_srshr64_i64 Date: Thu, 19 Sep 2024 14:10:43 +0100 Message-Id: <20240919131106.3362543-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x230.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-16-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/gengvec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 33c5084ea64..3abdc572022 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -304,7 +304,7 @@ void gen_srshr32_i32(TCGv_i32 d, TCGv_i32 a, int32_t sh) tcg_gen_add_i32(d, d, t); } - void gen_srshr64_i64(TCGv_i64 d, TCGv_i64 a, int64_t sh) +void gen_srshr64_i64(TCGv_i64 d, TCGv_i64 a, int64_t sh) { TCGv_i64 t = tcg_temp_new_i64(); From patchwork Thu Sep 19 13:10:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829609 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp317235wrn; Thu, 19 Sep 2024 06:13:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVLJyL9Xt3vtqEPWnzuPMVt8mYlv+HstP6iIF41EJBL0hAvX6T//tknWpQ+OyDQqZLgyrELAg==@linaro.org X-Google-Smtp-Source: AGHT+IG4p9X4G7GTIqWb9E5KqfJEvhjNYsmiFcamAQLDgI+jp7W5lNF6HGfUzBIf5LwwKrxKtpkh X-Received: by 2002:a05:6122:904:b0:4fc:e3c2:2c71 with SMTP id 71dfb90a1353d-5032d38a589mr18303251e0c.2.1726751639490; Thu, 19 Sep 2024 06:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751639; cv=none; d=google.com; s=arc-20240605; b=IfFrEtHQ5nYrkGEkvgJ7c8tLx/bbZOINI8nEEhYEex9Kjl4q5MMZ624abh/4WID1mS PyENnb6Cu762RvQDJaTKYngsnzZVURlNpVLX3E/U3FJtbJ9CBE201BnfiiaZqts/nUqU B3/dinrVYRRzmUKO7cylMZ1wMKzhhnnDPjCbM+R/1ama0MbxzICVR+M9De21rtjk+LxJ HwzKU8RupXl7Zh/g8ADEyWJZjEgOt/0zBzAXH+sFqVv1n1/H07+MbBUwvz76ql53pW7Z yGqK52oYHoSYApKtMQmhrCOlD5dzYFjtsYH1M0Z+bHUVQ3qbWzhU9w1+z28YBROxYyce NY7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=fpOs0+mUwzbgPWpwOknTrCElHgPZU3jh3MxojSjqfxI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=RFeCoVhakW51RHE4NBUjS+9Y9YJCoJVHfKEEwC2/hIV2G9UtcUZ4gzAjQfleu8hv3i 1qxRc7CBTRDC6PFmp6n0YGgrz0Inhla0oHxYVkFtXyNR02+CYDKxdWluqyOZOzGDpxmy AfS1UYUZS/0IOiO2wdiLaXZRiuIU2glgxaFLJtXe0gEpLtYYzirciKMs9U/ZYKnLmWZy pUiBIrvNHu9J51IR6HAIuYdXwIscKYR05uNsO4Qz1UoonDGIEkeXVwc33/HUzfPwcpC4 yWxCBaUojzWAGmIQ88Kv10SCdANbkmT+fTC/hbqw+VpyZyw2W+T97h4WiNWLnOcvvZfc MyUA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bQWPuqmq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-503d876498csi109661e0c.323.2024.09.19.06.13.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:13:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bQWPuqmq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwj-00066w-5C; Thu, 19 Sep 2024 09:11:45 -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 1srGwP-00050K-7O for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:25 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwJ-000129-4Y for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:22 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42cb60aff1eso7821115e9.0 for ; Thu, 19 Sep 2024 06:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751477; x=1727356277; 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=fpOs0+mUwzbgPWpwOknTrCElHgPZU3jh3MxojSjqfxI=; b=bQWPuqmqAzC5OCLtUl8mRbC0+ZhBQ/GzYzEh8zPAr1GaMgms5wPye+akY3Lg4gu4TN fwe1Idw5V9ShlYsVCANY2rcfsJC7HLLv6rc0JxJwSMDXoCHJvbJxOohDcX9f5MyDVFJK L/0a8BtudquYZFRsx+Vtul8bj/mWG4lopoTacaKbojnFdaKG+g9wK4m4nklE3raPpQyz Id6jXj140FjZa8b64kM/v34lZlmw8pLnW2NyFJ4UGl8E/vODoeOoxohb6xRADfWezhqa 3rrj8JF3pKigf+hw+omvTqnBiXH+SzQnjvXlG0X2qyOfQk4FXJoqnp3S2tTFInTduIJw DPxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751477; x=1727356277; 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=fpOs0+mUwzbgPWpwOknTrCElHgPZU3jh3MxojSjqfxI=; b=VwxYVNtg4p95oNUGf2NAT8N9gPo9us3qp/RHG0st9X551O0NQ4AovmWp4SjHzvbsYy J50eTVOoC69m6HYtVKS8QBxdp5na4zzjHgemlgoLaxCQbi2gpHwDVMPo64eZbY5Cv7OG u85Iq/VdgXC9HOebOGSJiPM8lfMUC25hQ17uAQpSBbqYDEWhEaOLJDIjUG9YkRnU+4Dl 5Ox9kNpPz0yi1gVnz/oatfCiKFCNAtEN0lX9leeREeggh3334ASbsRAvjH2bZI0JVUbw onUCESybcJ64Ys9ilHrWpUqNkVwSBheiqD/rlUU9pqpG1jZsJs95s/kRtsMPWUM6G3fh sDIA== X-Gm-Message-State: AOJu0Yy9cZL4Vt4FlcXIKuFNI6jwnTjTS7/huLG5JhB2u+pIU52+rc/L yuxbEjULqVbi5YFaYC6LFlJfJ+8zRz4h2dAORc39nk4fJkpdYW0Sy8S3htOx+dhHjlgrNQ88m1F p X-Received: by 2002:a05:600c:1d24:b0:42c:bf79:78f7 with SMTP id 5b1f17b1804b1-42cdb591224mr199088195e9.32.1726751477265; Thu, 19 Sep 2024 06:11:17 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:16 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/38] target/arm: Convert handle_vec_simd_shri to decodetree Date: Thu, 19 Sep 2024 14:10:44 +0100 Message-Id: <20240919131106.3362543-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This includes SSHR, USHR, SSRA, USRA, SRSHR, URSHR, SRSRA, URSRA, SRI. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-17-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 63 ++++++++++++++++++++++++- target/arm/tcg/translate-a64.c | 86 +++++++++++----------------------- 2 files changed, 89 insertions(+), 60 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 278d7873c21..74ba1fa07c9 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -34,6 +34,7 @@ &rrx_e rd rn rm idx esz &rrrr_e rd rn rm ra esz &qrr_e q rd rn esz +&qrri_e q rd rn imm esz &qrrr_e q rd rn rm esz &qrrx_e q rd rn rm idx esz &qrrrr_e q rd rn rm ra esz @@ -1185,11 +1186,71 @@ FMINV_s 0110 1110 10 11000 01111 10 ..... ..... @rr_q1e2 FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd -# Advanced SIMD Modified Immediate +# Advanced SIMD Modified Immediate / Shift by Immediate %abcdefgh 16:3 5:5 +# Right shifts are encoded as N - shift, where N is the element size in bits. +%neon_rshift_i6 16:6 !function=rsub_64 +%neon_rshift_i5 16:5 !function=rsub_32 +%neon_rshift_i4 16:4 !function=rsub_16 +%neon_rshift_i3 16:3 !function=rsub_8 + +@q_shri_b . q:1 .. ..... 0001 ... ..... . rn:5 rd:5 \ + &qrri_e esz=0 imm=%neon_rshift_i3 +@q_shri_h . q:1 .. ..... 001 .... ..... . rn:5 rd:5 \ + &qrri_e esz=1 imm=%neon_rshift_i4 +@q_shri_s . q:1 .. ..... 01 ..... ..... . rn:5 rd:5 \ + &qrri_e esz=2 imm=%neon_rshift_i5 +@q_shri_d . 1 .. ..... 1 ...... ..... . rn:5 rd:5 \ + &qrri_e esz=3 imm=%neon_rshift_i6 q=1 + FMOVI_v_h 0 q:1 00 1111 00000 ... 1111 11 ..... rd:5 %abcdefgh # MOVI, MVNI, ORR, BIC, FMOV are all intermixed via cmode. Vimm 0 q:1 op:1 0 1111 00000 ... cmode:4 01 ..... rd:5 %abcdefgh + +SSHR_v 0.00 11110 .... ... 00000 1 ..... ..... @q_shri_b +SSHR_v 0.00 11110 .... ... 00000 1 ..... ..... @q_shri_h +SSHR_v 0.00 11110 .... ... 00000 1 ..... ..... @q_shri_s +SSHR_v 0.00 11110 .... ... 00000 1 ..... ..... @q_shri_d + +USHR_v 0.10 11110 .... ... 00000 1 ..... ..... @q_shri_b +USHR_v 0.10 11110 .... ... 00000 1 ..... ..... @q_shri_h +USHR_v 0.10 11110 .... ... 00000 1 ..... ..... @q_shri_s +USHR_v 0.10 11110 .... ... 00000 1 ..... ..... @q_shri_d + +SSRA_v 0.00 11110 .... ... 00010 1 ..... ..... @q_shri_b +SSRA_v 0.00 11110 .... ... 00010 1 ..... ..... @q_shri_h +SSRA_v 0.00 11110 .... ... 00010 1 ..... ..... @q_shri_s +SSRA_v 0.00 11110 .... ... 00010 1 ..... ..... @q_shri_d + +USRA_v 0.10 11110 .... ... 00010 1 ..... ..... @q_shri_b +USRA_v 0.10 11110 .... ... 00010 1 ..... ..... @q_shri_h +USRA_v 0.10 11110 .... ... 00010 1 ..... ..... @q_shri_s +USRA_v 0.10 11110 .... ... 00010 1 ..... ..... @q_shri_d + +SRSHR_v 0.00 11110 .... ... 00100 1 ..... ..... @q_shri_b +SRSHR_v 0.00 11110 .... ... 00100 1 ..... ..... @q_shri_h +SRSHR_v 0.00 11110 .... ... 00100 1 ..... ..... @q_shri_s +SRSHR_v 0.00 11110 .... ... 00100 1 ..... ..... @q_shri_d + +URSHR_v 0.10 11110 .... ... 00100 1 ..... ..... @q_shri_b +URSHR_v 0.10 11110 .... ... 00100 1 ..... ..... @q_shri_h +URSHR_v 0.10 11110 .... ... 00100 1 ..... ..... @q_shri_s +URSHR_v 0.10 11110 .... ... 00100 1 ..... ..... @q_shri_d + +SRSRA_v 0.00 11110 .... ... 00110 1 ..... ..... @q_shri_b +SRSRA_v 0.00 11110 .... ... 00110 1 ..... ..... @q_shri_h +SRSRA_v 0.00 11110 .... ... 00110 1 ..... ..... @q_shri_s +SRSRA_v 0.00 11110 .... ... 00110 1 ..... ..... @q_shri_d + +URSRA_v 0.10 11110 .... ... 00110 1 ..... ..... @q_shri_b +URSRA_v 0.10 11110 .... ... 00110 1 ..... ..... @q_shri_h +URSRA_v 0.10 11110 .... ... 00110 1 ..... ..... @q_shri_s +URSRA_v 0.10 11110 .... ... 00110 1 ..... ..... @q_shri_d + +SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @q_shri_b +SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @q_shri_h +SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @q_shri_s +SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @q_shri_d diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 032bd336502..5c76cdf1013 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6959,6 +6959,28 @@ static bool trans_Vimm(DisasContext *s, arg_Vimm *a) return true; } +/* + * Advanced SIMD Shift by Immediate + */ + +static bool do_vec_shift_imm(DisasContext *s, arg_qrri_e *a, GVecGen2iFn *fn) +{ + if (fp_access_check(s)) { + gen_gvec_fn2i(s, a->q, a->rd, a->rn, a->imm, fn, a->esz); + } + return true; +} + +TRANS(SSHR_v, do_vec_shift_imm, a, gen_gvec_sshr) +TRANS(USHR_v, do_vec_shift_imm, a, gen_gvec_ushr) +TRANS(SSRA_v, do_vec_shift_imm, a, gen_gvec_ssra) +TRANS(USRA_v, do_vec_shift_imm, a, gen_gvec_usra) +TRANS(SRSHR_v, do_vec_shift_imm, a, gen_gvec_srshr) +TRANS(URSHR_v, do_vec_shift_imm, a, gen_gvec_urshr) +TRANS(SRSRA_v, do_vec_shift_imm, a, gen_gvec_srsra) +TRANS(URSRA_v, do_vec_shift_imm, a, gen_gvec_ursra) +TRANS(SRI_v, do_vec_shift_imm, a, gen_gvec_sri) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -10423,53 +10445,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) } } -/* SSHR[RA]/USHR[RA] - Vector shift right (optional rounding/accumulate) */ -static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u, - int immh, int immb, int opcode, int rn, int rd) -{ - int size = 32 - clz32(immh) - 1; - int immhb = immh << 3 | immb; - int shift = 2 * (8 << size) - immhb; - GVecGen2iFn *gvec_fn; - - if (extract32(immh, 3, 1) && !is_q) { - unallocated_encoding(s); - return; - } - tcg_debug_assert(size <= 3); - - if (!fp_access_check(s)) { - return; - } - - switch (opcode) { - case 0x02: /* SSRA / USRA (accumulate) */ - gvec_fn = is_u ? gen_gvec_usra : gen_gvec_ssra; - break; - - case 0x08: /* SRI */ - gvec_fn = gen_gvec_sri; - break; - - case 0x00: /* SSHR / USHR */ - gvec_fn = is_u ? gen_gvec_ushr : gen_gvec_sshr; - break; - - case 0x04: /* SRSHR / URSHR (rounding) */ - gvec_fn = is_u ? gen_gvec_urshr : gen_gvec_srshr; - break; - - case 0x06: /* SRSRA / URSRA (accum + rounding) */ - gvec_fn = is_u ? gen_gvec_ursra : gen_gvec_srsra; - break; - - default: - g_assert_not_reached(); - } - - gen_gvec_fn2i(s, is_q, rd, rn, shift, gvec_fn, size); -} - /* SHL/SLI - Vector shift left */ static void handle_vec_simd_shli(DisasContext *s, bool is_q, bool insert, int immh, int immb, int opcode, int rn, int rd) @@ -10610,18 +10585,6 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x08: /* SRI */ - if (!is_u) { - unallocated_encoding(s); - return; - } - /* fall through */ - case 0x00: /* SSHR / USHR */ - case 0x02: /* SSRA / USRA (accumulate) */ - case 0x04: /* SRSHR / URSHR (rounding) */ - case 0x06: /* SRSRA / URSRA (accum + rounding) */ - handle_vec_simd_shri(s, is_q, is_u, immh, immb, opcode, rn, rd); - break; case 0x0a: /* SHL / SLI */ handle_vec_simd_shli(s, is_q, is_u, immh, immb, opcode, rn, rd); break; @@ -10660,6 +10623,11 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) handle_simd_shift_fpint_conv(s, false, is_q, is_u, immh, immb, rn, rd); return; default: + case 0x00: /* SSHR / USHR */ + case 0x02: /* SSRA / USRA (accumulate) */ + case 0x04: /* SRSHR / URSHR (rounding) */ + case 0x06: /* SRSRA / URSRA (accum + rounding) */ + case 0x08: /* SRI */ unallocated_encoding(s); return; } From patchwork Thu Sep 19 13:10:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829620 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319844wrn; Thu, 19 Sep 2024 06:18:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWz7DYzWUr55qIBZUtO+3ZDpmYWQjr7oxtGWpmkyraHLRtgKl3V0x91bpMb+oVsahRTBqJF/w==@linaro.org X-Google-Smtp-Source: AGHT+IGwnI2PtPOsaVijiBTqIgSvIIIxUlogwq+sonWq69qMq8pk0gYI7qZ90X4Q+N1A1wCtUQzu X-Received: by 2002:a05:620a:4588:b0:7a3:785a:dc1c with SMTP id af79cd13be357-7a9e5f7a780mr3936580685a.50.1726751919163; Thu, 19 Sep 2024 06:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751919; cv=none; d=google.com; s=arc-20240605; b=Qdh9JscZ8popFrbbpf+/4g6eOJoOYze8xyQmOEc8S4DsVRa7f3e15DpoDJQqksQmpU JaGbbydhZKxKrjNy8JDMGPm4jem02xGjpzSUitgY7oEQcaM24KelEB+6jb1v4+BaQbDY KB91OxcuwxjkAC33Vb84/G+6DBv44CSuA/WqgWVCZ79nWA9cMXco1j1qQe95xfMrf0qs 3hklDy6W9n16AgxVGWwWCmuQZQf37UWTGCooRoyUW7K7HW4717Zi1rw/mwFTxQX5hcUV xDZBOA9Q5SAkGLIKq3SnGSWyrlanflqE31X+b/KF0ZwnSm9LzulgSxM1sp89Om48y1fi LYKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=GQ8ITgrrInqmC6fIynxS3+7ZpXl54Hyy3K8cBEEh+Kk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=khwD1JJOHohyjuP0w+0t7VZJOxcBpiBOvVHUvokFv3nIQvB19gKZ74WRP1IpoNFIIT nYyw0NXRe/wJZnCGf3B3jVXHNFwhe/h0xJonvzyRYW1v4eAWmVgqN1gqTJeG8zI0mw8a bCud2mp2KShSFj9gyiH7rvz8MHOsEmltBBbDTHYZm6rmcjrK+NHyy9R6Y6EGSAqJdpJp 0Vb41pHfvqMGSmF5sGYGIjItZZz1FBMRfaP3lu/MCHl3n0LKntGthRob3UDHghkUn23E mphmm7RMCqNO/T8XedKS9zYy76ds25rDfR1uXxny96x3gcgTwUJQQtnvcA8KEcUjhuAU Xt2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Sf1z9/eo"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb08f34cfsi186567085a.546.2024.09.19.06.18.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Sf1z9/eo"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwk-0006Cg-BF; Thu, 19 Sep 2024 09:11:46 -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 1srGwQ-00056d-Rm for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:26 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwK-00012L-Mm for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:22 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42cba0dc922so6504085e9.3 for ; Thu, 19 Sep 2024 06:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751478; x=1727356278; 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=GQ8ITgrrInqmC6fIynxS3+7ZpXl54Hyy3K8cBEEh+Kk=; b=Sf1z9/eoNelu7GzUj3I94F1BKMdn7q2IaVpe/oOnRcgLdfwbBrQboGopNIYh6oveR+ wa2f9AOOocOjE1E9xMy8bfqSrYgk3rtYYthcoaPgWDSrM8PRxm2RXm2/Gqo6v6Wiy+7R E8U7KHaizhyByhhGclntbceTErMtNSPfUzoihJpO1We/1ll9M0fCAHLNa1Gp2vgnJbzA 8Bxk+70iAv+1sOdXCZtPBvLQzhyi7zF9CnZpQxssM8gT4AYkzTwGJc/SBC+JCB/362mf Nt+pkIpPYPp79ItD94vFcCHu5+Y+92qcbPwBO17dRIBxUIjkYNKPui82IG3rOdiCgv5P u9lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751478; x=1727356278; 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=GQ8ITgrrInqmC6fIynxS3+7ZpXl54Hyy3K8cBEEh+Kk=; b=YtryM0t10FlVcW7d1+N7u5HZCd3rJYdOMn8j5/FBdF2qGYVX7PvXCaQ0WlwYG023rW yu8Ea3O+MQSYdKR4JcSE37cKvj9vR2BdxrPZW0vvO+yp63VCpLGNj7NFanJWVTdt/dyZ jRQ9XbsIwUiUkyyXTJ/kMkfgQNeoFtxCTnNTWbHnFnCaD70bVWdACnxUPB3G1KVmGXlB FCrME7SrI4zMGhdiefJGNVrYosCEpsym7duTVEJcgG5dMK9sH9Cd81WWYkVKZLXtTRit DUN5FRltn6DSrOvKX58nX4H11uadNt1PeZaiOwV65ukBgR0os2qKaJP+qPP8eev10jjJ PJLQ== X-Gm-Message-State: AOJu0Yxb4Oc+R9Js5oJOVcsdCZ5GBCBWx3U3KovBzmFVLEFDVrPJixiJ icNU5nuVrCI90cCi4gZxrY0eeF4iPdcYQPPf8fgtv9jgIFuukOP8yPUyoZHQaS3BNHZDYjUtK7H P X-Received: by 2002:a05:600c:1e1a:b0:426:5fbe:bf75 with SMTP id 5b1f17b1804b1-42cdb567190mr204726725e9.23.1726751477752; Thu, 19 Sep 2024 06:11:17 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:17 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/38] target/arm: Convert handle_vec_simd_shli to decodetree Date: Thu, 19 Sep 2024 14:10:45 +0100 Message-Id: <20240919131106.3362543-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This includes SHL and SLI. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-18-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 15 +++++++++++++++ target/arm/tcg/translate-a64.c | 33 +++------------------------------ 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 74ba1fa07c9..77b860a3f2c 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1205,6 +1205,11 @@ FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=%esz_hsd @q_shri_d . 1 .. ..... 1 ...... ..... . rn:5 rd:5 \ &qrri_e esz=3 imm=%neon_rshift_i6 q=1 +@q_shli_b . q:1 .. ..... 0001 imm:3 ..... . rn:5 rd:5 &qrri_e esz=0 +@q_shli_h . q:1 .. ..... 001 imm:4 ..... . rn:5 rd:5 &qrri_e esz=1 +@q_shli_s . q:1 .. ..... 01 imm:5 ..... . rn:5 rd:5 &qrri_e esz=2 +@q_shli_d . 1 .. ..... 1 imm:6 ..... . rn:5 rd:5 &qrri_e esz=3 q=1 + FMOVI_v_h 0 q:1 00 1111 00000 ... 1111 11 ..... rd:5 %abcdefgh # MOVI, MVNI, ORR, BIC, FMOV are all intermixed via cmode. @@ -1254,3 +1259,13 @@ SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @q_shri_b SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @q_shri_h SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @q_shri_s SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @q_shri_d + +SHL_v 0.00 11110 .... ... 01010 1 ..... ..... @q_shli_b +SHL_v 0.00 11110 .... ... 01010 1 ..... ..... @q_shli_h +SHL_v 0.00 11110 .... ... 01010 1 ..... ..... @q_shli_s +SHL_v 0.00 11110 .... ... 01010 1 ..... ..... @q_shli_d + +SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @q_shli_b +SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @q_shli_h +SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @q_shli_s +SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @q_shli_d diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 5c76cdf1013..1225aac6654 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6980,6 +6980,8 @@ TRANS(URSHR_v, do_vec_shift_imm, a, gen_gvec_urshr) TRANS(SRSRA_v, do_vec_shift_imm, a, gen_gvec_srsra) TRANS(URSRA_v, do_vec_shift_imm, a, gen_gvec_ursra) TRANS(SRI_v, do_vec_shift_imm, a, gen_gvec_sri) +TRANS(SHL_v, do_vec_shift_imm, a, tcg_gen_gvec_shli) +TRANS(SLI_v, do_vec_shift_imm, a, gen_gvec_sli); /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the @@ -10445,33 +10447,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) } } -/* SHL/SLI - Vector shift left */ -static void handle_vec_simd_shli(DisasContext *s, bool is_q, bool insert, - int immh, int immb, int opcode, int rn, int rd) -{ - int size = 32 - clz32(immh) - 1; - int immhb = immh << 3 | immb; - int shift = immhb - (8 << size); - - /* Range of size is limited by decode: immh is a non-zero 4 bit field */ - assert(size >= 0 && size <= 3); - - if (extract32(immh, 3, 1) && !is_q) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - if (insert) { - gen_gvec_fn2i(s, is_q, rd, rn, shift, gen_gvec_sli, size); - } else { - gen_gvec_fn2i(s, is_q, rd, rn, shift, tcg_gen_gvec_shli, size); - } -} - /* USHLL/SHLL - Vector shift left with widening */ static void handle_vec_simd_wshli(DisasContext *s, bool is_q, bool is_u, int immh, int immb, int opcode, int rn, int rd) @@ -10585,9 +10560,6 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x0a: /* SHL / SLI */ - handle_vec_simd_shli(s, is_q, is_u, immh, immb, opcode, rn, rd); - break; case 0x10: /* SHRN */ case 0x11: /* RSHRN / SQRSHRUN */ if (is_u) { @@ -10628,6 +10600,7 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) case 0x04: /* SRSHR / URSHR (rounding) */ case 0x06: /* SRSRA / URSRA (accum + rounding) */ case 0x08: /* SRI */ + case 0x0a: /* SHL / SLI */ unallocated_encoding(s); return; } From patchwork Thu Sep 19 13:10:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829615 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319061wrn; Thu, 19 Sep 2024 06:17:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUxWP0kjyfmJlFLOxPpK6RWgbNhP2Wuy80JJNBfko/vi40ct6ILRNL4bGwK3xz8cndy3S+Atw==@linaro.org X-Google-Smtp-Source: AGHT+IGvTxE7a2Y5xnGHcdTFW9tudQA0N66kFe3NlGOlYCeVEg17qTtimyF70N35/3k8S7tyWtpU X-Received: by 2002:a05:620a:28d5:b0:7a9:b9c6:ab4d with SMTP id af79cd13be357-7a9e5f7a992mr3894052885a.51.1726751826840; Thu, 19 Sep 2024 06:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751826; cv=none; d=google.com; s=arc-20240605; b=c0GQrcuNman7HuvQrWjYQdgVHi5muqvlrCSixuz108EnTayaL5n147TCGYsR1x4KUN BhmGhzjkodEjcjCMn6Tqthg3YRKGSua0S7eWZ1rHv/ywzZExubcrVwj19jWkejg3Fin0 ebUnhR/tgwcqcHxbEelaXMK5TB+5cLIDood5wr/pibJyUiG9gv+8X6SKRm83T+e6dPOY vQpLILsWqzCgm+EasWnugYVEU9Q3DxYWxsjF9y/9Qjuga10qNiWkCkxaDPpn3xpbozfP gQTzWbUUBL0R1snZzgPRqJ2sSlZlPB+myAKysPIhQ1U6D1lQsaKV9tCkPERVLHLcbb2S 7Qqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2wdk0UxISnpYZXSzl9mBlpBWDXNtfPgycdSZ7wgD7Uw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bMxnZjeSsOnqUO/g7wvWoGycG/NHdEdajvH8k7SJVW8F0KZoOvprayRR5Sji578GGR xfJfrd1/Lq+lMbeSHyHBIEa6EXeKI6pI8lvJ9iEuqxM48Ul3T7kY+iT/qFm6t4hupd5h zgclJXjs9r8tOKJ4UZ79O9z22C2ee13lNXaJ4IBAMcAV5N06+Tv+YMVQVJP2BDucgspf Kb45CRAEQiCS2ni5Guy2ceZgrSnEaOJ+HbmxLIOOC2QlwULSL7PlxzGqERMp2VnPHn2o m7uFuGuA1a/wUgA5bU54RFE7AuQD+3+pl361Sm1Fdp3SxubA+5jMMaTp2sqL448W4HwT UcRA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iiequgpR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb0910099si178177985a.715.2024.09.19.06.17.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:17:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iiequgpR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwq-0006au-KQ; Thu, 19 Sep 2024 09:11:52 -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 1srGwQ-00056x-Uj for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:26 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwK-00012Q-Vq for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:23 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2f7657f9f62so9237331fa.3 for ; Thu, 19 Sep 2024 06:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751478; x=1727356278; 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=2wdk0UxISnpYZXSzl9mBlpBWDXNtfPgycdSZ7wgD7Uw=; b=iiequgpRfX9UaZeMfSpgILz5BOu2vdRGDPb6WZG+sOq1Lihgh3T+WoA8p+7PSufs3I 02mYw6PSMassPp/vHAIaDxMXxVhKxT1hwK8hbmNI9s7i1VPeOzsYZjtL+8hvCfdeGVBw 8epaTFlLdRqO7f7dUiEgQS88qlK3wP4YeKVZggNSrW2OC7OU5Qtf+XQ5Mwhaze/r73d0 J5hgL8luLyF78erqQ9emJSeGYoZzxKs+Vm/h32TSONhDmYikFWwB7VY1FHT+JtFr4zPX HQRbp2e3LRky1sStgupXZzALXWzT1TJwESRE6XBz72OfPM6gnYwQbRh6p93OKkqxVvG9 6bNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751478; x=1727356278; 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=2wdk0UxISnpYZXSzl9mBlpBWDXNtfPgycdSZ7wgD7Uw=; b=th5KCLh/oYJhdviOXQxMOmPoGlyMWIArvsiDjXqnF3XqGK7ARnrCKxFDCkfivETWDx vOvVEiM8vlTDvpn3a7bSbZCMvAFCp+eRyAcTZhdEtBFyAoXMFYPCXOuaMP1SI3yJQbT3 TmFnSw8uSpfygPAbJozvyv3VZ0qsiU57bR8iv7pFmL/B6dUxTKyW6Wh3zvu6Ix+V2tD1 q9TjyBaagiHBFJFXe++vaSxbBpbm2z8CRHVn4ptP50LMtg9CSnMTX8L08EEffD4D32io M5ZuPVY/3oojAEdVAZTiZftuoQKlv11pGA11ddSYipiSQBrPVV4JzPbcbHYfK2zK8w4g oSVQ== X-Gm-Message-State: AOJu0YzLUibAkVo6wV6+dAWViUfPGj8WslNGkH+bRd8ds/GBiYwTR+G4 4iVsfkGc0iDsB79dbSjPBN6Vmc4GC7hplXMLcj2EhazL6DKnfmawTvxwgXWLsciqHEaPvCbEQMB 1 X-Received: by 2002:a05:651c:a0a:b0:2f7:c215:4f33 with SMTP id 38308e7fff4ca-2f7c2155066mr20428091fa.27.1726751478283; Thu, 19 Sep 2024 06:11:18 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:17 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/38] target/arm: Use {, s}extract in handle_vec_simd_wshli Date: Thu, 19 Sep 2024 14:10:46 +0100 Message-Id: <20240919131106.3362543-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x231.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Combine the right shift with the extension via the tcg extract operations. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-19-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 1225aac6654..740620074ad 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -10477,8 +10477,11 @@ static void handle_vec_simd_wshli(DisasContext *s, bool is_q, bool is_u, read_vec_element(s, tcg_rn, rn, is_q ? 1 : 0, MO_64); for (i = 0; i < elements; i++) { - tcg_gen_shri_i64(tcg_rd, tcg_rn, i * esize); - ext_and_shift_reg(tcg_rd, tcg_rd, size | (!is_u << 2), 0); + if (is_u) { + tcg_gen_extract_i64(tcg_rd, tcg_rn, i * esize, esize); + } else { + tcg_gen_sextract_i64(tcg_rd, tcg_rn, i * esize, esize); + } tcg_gen_shli_i64(tcg_rd, tcg_rd, shift); write_vec_element(s, tcg_rd, rd, i, size + 1); } From patchwork Thu Sep 19 13:10:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829618 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319687wrn; Thu, 19 Sep 2024 06:18:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWFO8SQdERcOz7I92qKSGGCbLPzTQLCq8MI7jQDL0UzTUkQXW6EWFdH+PPtEOt1pWkafRWs7A==@linaro.org X-Google-Smtp-Source: AGHT+IFaI6sbreE9buLjwc1E5g5T1Wh6N1H3T3nciAanIOAKJNr4MINhxPdJUNMTvoMS10CY1uzA X-Received: by 2002:a05:620a:246:b0:7ab:3511:4eda with SMTP id af79cd13be357-7ab35114fc0mr2829561085a.34.1726751901937; Thu, 19 Sep 2024 06:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751901; cv=none; d=google.com; s=arc-20240605; b=DQ7gRkKBtfvXASNhQODD++xKya4sbirWO44JFm7M/FnADAscn/4kk4CEn/ikYCimYL Hjo62+Q8wEHndae4f094iRoGU4v6zy1J3iiv79Idf9czEVsl83D2lqyc5jgPK+E5qyWd 1HS1DE6FPSluwUCJOioMclDZHMcR197pD/SdL8GTXn9IXx3vIkRW0KLrCkwxgBiW/RJ8 vfTXBR071k84WSF12ltqYZL39BV2drxaj2J9tzoih1RtSOuhnLDBOFzXidStjs9fdUAo wRceui37GHPqXUURClXSooiJO8ReOUWm/yUEAHhriGcB7OGmfV4V+kDp2+JZej9bsQ0L s7QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=H9QwZiNqYLltMuDoQvmE1DmwxE5VRVv3eEWgjc3dK6I=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Ujzg8SsUJIGSZmjH2SspG9F5uSw77aXOHCv2VxHreXVC68ej6yZE+XfXXnRAc1nmgO UANAJy0BNNxc/8LXLqGpuIMT0SbB+sCSdDLzQCoESJrBhJW+Vm46rDKwqGwch+N5AFjW VWxa0faY/9HQZqnM41xMD0BsaHnWpI1RwI/PrI/cX0YrRTC0yOw9dIMWCJS+YlOp4/Xt zbtb+79VraHX+ipFkySI+DCvL2fa/J5eVp6QBxdEiQN/Y5o4X1tzbNFmWoAjYAhHV+8A VKyKV1FGEBu9gUqUTCcP8GGe0rhsQSJ60Ji9Z0ZBbn6PTq7xaLbw1VqDDK0iuLK1j9EJ 3BVg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nsR13Wuq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c75e4538fdsi18564896d6.20.2024.09.19.06.18.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nsR13Wuq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwp-0006Ws-Gy; Thu, 19 Sep 2024 09:11:51 -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 1srGwQ-00056n-TA for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:26 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwL-00012q-0B for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:24 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42cb58d810eso12322495e9.0 for ; Thu, 19 Sep 2024 06:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751479; x=1727356279; 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=H9QwZiNqYLltMuDoQvmE1DmwxE5VRVv3eEWgjc3dK6I=; b=nsR13Wuqlz3rQkBRgJMXIpZmaq0k1nDZTNyZzpdXWRAC1WBi1doSYfllJdvu7AeZuQ J4MvSOKhd1C086v6XtP11JME/6r7EvIE5CNDQtCR2UaZnYAPo5Hsi01PNKVJ4smG+5LW nqJnhFEogYToN9wgwwdYyELvpYikW3Jug9mF1/f+HnY0XWMeU8BqXRCl62ueUxTG/RIi R6PvUc5i1FvJlbaojEQC2FvqEUyKu2fOp1lTyLVG464dydeXQnpNlvi9gHKvbSbPaJ/o t/WGYaFKHxkAB/1KjeP7no9Bo9Avp8T3GLQrUqS17TCAZ8O/bwtkdA4WR9ffSynkFMlP ywJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751479; x=1727356279; 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=H9QwZiNqYLltMuDoQvmE1DmwxE5VRVv3eEWgjc3dK6I=; b=O1afxa0ywJ6sRyqJgDIRdGkbP6IYqNHNhOCG02ZUu9X6dVsnFS7lNcgZyvqJ0TOOtE u3A1Z/WZ0gMjcQfeBokW7hOjrZQntw0SD5+TA4E/728iV0VbhZusJF2xmO+Db1w37wHi zNVJbtRasW/26KRgB7gHC5laGFnnkts/e44GtWj9TxS2STIpXH9ob4DFQs11hGHkPOAI NneXE1xzSz9xDDpdNL9o2zqgXUdCxlil7acpd/xiHPDkfngLvoK3KwgY065DHukjerr0 05nyEAGRS2BW4WqAPxoeWzaED1fXherg6ckQviHyLv0IuDPNK3O+kuK8/qPO7pOFvJuo eMCQ== X-Gm-Message-State: AOJu0YybdEMbPFwoE4QokoL7Z0TPfi1gUhPaLM0LMwSbEy6lhyVyE2oX gqrD+N0dy/aS/ulJEwY4usuiGN/m5krCEULO2fdXDxN2n+M+wdVx5cjYBddXNlQYCyjyIW5NXg7 h X-Received: by 2002:a05:600c:4592:b0:42c:bd4d:e8d6 with SMTP id 5b1f17b1804b1-42e743f8850mr19522425e9.3.1726751478906; Thu, 19 Sep 2024 06:11:18 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:18 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/38] target/arm: Convert SSHLL, USHLL to decodetree Date: Thu, 19 Sep 2024 14:10:47 +0100 Message-Id: <20240919131106.3362543-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-20-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 8 ++++ target/arm/tcg/translate-a64.c | 81 ++++++++++++++++------------------ 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 77b860a3f2c..bf67f8a357a 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1269,3 +1269,11 @@ SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @q_shli_b SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @q_shli_h SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @q_shli_s SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @q_shli_d + +SSHLL_v 0.00 11110 .... ... 10100 1 ..... ..... @q_shli_b +SSHLL_v 0.00 11110 .... ... 10100 1 ..... ..... @q_shli_h +SSHLL_v 0.00 11110 .... ... 10100 1 ..... ..... @q_shli_s + +USHLL_v 0.10 11110 .... ... 10100 1 ..... ..... @q_shli_b +USHLL_v 0.10 11110 .... ... 10100 1 ..... ..... @q_shli_h +USHLL_v 0.10 11110 .... ... 10100 1 ..... ..... @q_shli_s diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 740620074ad..e00d7fbf484 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6983,6 +6983,42 @@ TRANS(SRI_v, do_vec_shift_imm, a, gen_gvec_sri) TRANS(SHL_v, do_vec_shift_imm, a, tcg_gen_gvec_shli) TRANS(SLI_v, do_vec_shift_imm, a, gen_gvec_sli); +static bool do_vec_shift_imm_wide(DisasContext *s, arg_qrri_e *a, bool is_u) +{ + TCGv_i64 tcg_rn, tcg_rd; + int esz = a->esz; + int esize; + + if (!fp_access_check(s)) { + return true; + } + + /* + * For the LL variants the store is larger than the load, + * so if rd == rn we would overwrite parts of our input. + * So load everything right now and use shifts in the main loop. + */ + tcg_rd = tcg_temp_new_i64(); + tcg_rn = tcg_temp_new_i64(); + read_vec_element(s, tcg_rn, a->rn, a->q, MO_64); + + esize = 8 << esz; + for (int i = 0, elements = 8 >> esz; i < elements; i++) { + if (is_u) { + tcg_gen_extract_i64(tcg_rd, tcg_rn, i * esize, esize); + } else { + tcg_gen_sextract_i64(tcg_rd, tcg_rn, i * esize, esize); + } + tcg_gen_shli_i64(tcg_rd, tcg_rd, a->imm); + write_vec_element(s, tcg_rd, a->rd, i, esz + 1); + } + clear_vec_high(s, true, a->rd); + return true; +} + +TRANS(SSHLL_v, do_vec_shift_imm_wide, a, false) +TRANS(USHLL_v, do_vec_shift_imm_wide, a, true) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -10447,47 +10483,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) } } -/* USHLL/SHLL - Vector shift left with widening */ -static void handle_vec_simd_wshli(DisasContext *s, bool is_q, bool is_u, - int immh, int immb, int opcode, int rn, int rd) -{ - int size = 32 - clz32(immh) - 1; - int immhb = immh << 3 | immb; - int shift = immhb - (8 << size); - int dsize = 64; - int esize = 8 << size; - int elements = dsize/esize; - TCGv_i64 tcg_rn = tcg_temp_new_i64(); - TCGv_i64 tcg_rd = tcg_temp_new_i64(); - int i; - - if (size >= 3) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - /* For the LL variants the store is larger than the load, - * so if rd == rn we would overwrite parts of our input. - * So load everything right now and use shifts in the main loop. - */ - read_vec_element(s, tcg_rn, rn, is_q ? 1 : 0, MO_64); - - for (i = 0; i < elements; i++) { - if (is_u) { - tcg_gen_extract_i64(tcg_rd, tcg_rn, i * esize, esize); - } else { - tcg_gen_sextract_i64(tcg_rd, tcg_rn, i * esize, esize); - } - tcg_gen_shli_i64(tcg_rd, tcg_rd, shift); - write_vec_element(s, tcg_rd, rd, i, size + 1); - } - clear_vec_high(s, true, rd); -} - /* SHRN/RSHRN - Shift right with narrowing (and potential rounding) */ static void handle_vec_simd_shrn(DisasContext *s, bool is_q, int immh, int immb, int opcode, int rn, int rd) @@ -10577,9 +10572,6 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) handle_vec_simd_sqshrn(s, false, is_q, is_u, is_u, immh, immb, opcode, rn, rd); break; - case 0x14: /* SSHLL / USHLL */ - handle_vec_simd_wshli(s, is_q, is_u, immh, immb, opcode, rn, rd); - break; case 0x1c: /* SCVTF / UCVTF */ handle_simd_shift_intfp_conv(s, false, is_q, is_u, immh, immb, opcode, rn, rd); @@ -10604,6 +10596,7 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) case 0x06: /* SRSRA / URSRA (accum + rounding) */ case 0x08: /* SRI */ case 0x0a: /* SHL / SLI */ + case 0x14: /* SSHLL / USHLL */ unallocated_encoding(s); return; } From patchwork Thu Sep 19 13:10:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829614 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp318319wrn; Thu, 19 Sep 2024 06:15:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXOaXVgjowa9NjVWCeInqZHon7zYH1PBOzPWfaLIqHx0/ijO7Plf0XvIAvPUkhPvhw1ScUYVw==@linaro.org X-Google-Smtp-Source: AGHT+IGbvCWDyVuqMfBL4iZqqQyMyE7UvSyDD+IYWSq1ZHIE9e+jJaDjTJLxEqM0urGYSpvQfMdB X-Received: by 2002:ac8:5792:0:b0:456:89a6:ec00 with SMTP id d75a77b69052e-458603cc3afmr428075631cf.39.1726751754059; Thu, 19 Sep 2024 06:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751754; cv=none; d=google.com; s=arc-20240605; b=k0ZZzd4FMKK3NtAcBsai7PACcv9dal4ofsMOBV0cDqlWtxrCcHHdh5V2b2pbR1qfec sBYDZ/79Yzm7DF44DkGdMwl9b2jgQoEvcmfGI1/ENThpxY9y5dYBXM7Txgor4TvSSsB2 RuBwRd2iM6pnEwpE1tbzfyKiVkXlKcPiCLE0cDEkXHtrhd6Jz3VL8lyY/SBnk9L8dIrA YojVuYn0YcmpJqwzOmOF1y725kt7rbNs0XDafs3HZM1gcceCiZvarjWspeVqXbYdjFHJ lY9ebnpLq7nXBYHWeXbEveIvG8/4N7VoDrQpvkiQ1331nCWjdqSlrqh/LHb0vhM2SQDA IAMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yf5jA5r/LiTidTjtVYYfDoxqsArZsXgE0SdNZZtYWBY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Jp5FKDuTIn5U2T1+t4m5F4CRKyxa4bW5cCkzieCYnEPo9zfT+8H43VlObZC3gdsO6U HzIKNV6u8wUTjHMUfYsEYoCwGEWR08qjPDqSuE626/fniQhe8UJOiOnw580bKjAfcZr7 9mAlRyShTYzU0TQ511RvfUdF75gcW16oNOmGx0pQoggUXauGVEro0biRASy50o+vGS1X dFb3vGyP2Sy2wCA/4E2JxFe7LRwEJ34Z3FwzKE4vQWhF8Vru8V2qytidCOeq15OjRgma 4ky21Py3lAVAVDQ9Dfpfi8mvGGFTIK3+jIXCN2Cz16UaRi4woiE6eOFyT+AFrRwa9rAv Xw5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e9eC+Q+w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45b17955ac3si18963031cf.707.2024.09.19.06.15.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:15:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e9eC+Q+w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwp-0006Ut-2T; Thu, 19 Sep 2024 09:11:51 -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 1srGwR-00057i-51 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:28 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwL-00012x-1K for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:24 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42cb1758e41so6678785e9.1 for ; Thu, 19 Sep 2024 06:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751479; x=1727356279; 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=yf5jA5r/LiTidTjtVYYfDoxqsArZsXgE0SdNZZtYWBY=; b=e9eC+Q+w/vOV+T+WsuJL7LRi8OEfnN9CurdodskSY8yslueDPQRwusDdiQ4vJdDs4K YrlCcrp1pcVcAKrdozzaA5gTpbCmxKfpkGUCjZQhPOXX1PyZC7tQi/45A8PPqvD8rmMR nQ23OyAEKPNM58ZHpl10sI0dImNMZmgMcvFdpJWiqbK9FpkM87RI5EOBqywGy683DZKr 9GXrnDEnHvubS9p/DO+mh9gGdmX+CwkdOX2Jwtdfe0pPFPv2Z4UZrqYm++rLGPOW3JC2 W0w7LAgJLkfzat26VAvkDepwDCrPWnRhltXML6QkjjxPbFSaZ16N9FyFQkaJyelBmQJ8 fqOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751479; x=1727356279; 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=yf5jA5r/LiTidTjtVYYfDoxqsArZsXgE0SdNZZtYWBY=; b=dPT1G7o3WbbNTqgPXPbnygodbG4p4zVjfIO4b/azAEeXaPPeKHs61vtX22XUF5aJQI qiE9jPGdZ41TFotBj1h4NKHYNt3yV+k0RMZuRdroKUWOmHto1RQ9Ylg9Q+bczqj0cG1a kc5DJlLcLLF4N0N4GKfRIYAuUvIrzcpjwbfwzQJtn+3mNldXg+d+KIFSjB7iDCYrYOyp /pRMBFXPfyi/gh81d0afSAMtwzObYtxslnd1tl4sdSXsSpDXuqJm69hBepnr7jGH9gr2 IKV5yjSbgVZv6trTg5VcZsR3AMzgj6cXuSZggfpXQZHwpL3BXOq8DWA9kdnKwKX2725u LBgg== X-Gm-Message-State: AOJu0Yxrg79GoG0LK32l/1mUg+P96sqqvI48sr5iw0V/PAOsz5ocirYR jUDKepvW8XgUkT+qV9KXQZK8RurFEUk8zY4ouueR3BkZhND9OhvWUBEKDsRPhsqaSYMojNL5qs3 N X-Received: by 2002:a05:600c:1c29:b0:426:51dc:f6cd with SMTP id 5b1f17b1804b1-42d9082b956mr122029505e9.18.1726751479457; Thu, 19 Sep 2024 06:11:19 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:19 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/38] target/arm: Push tcg_rnd into handle_shri_with_rndacc Date: Thu, 19 Sep 2024 14:10:48 +0100 Message-Id: <20240919131106.3362543-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson We always pass the same value for round; compute it within common code. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-21-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index e00d7fbf484..e59236330ad 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9205,11 +9205,10 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) * the vector and scalar code. */ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, - TCGv_i64 tcg_rnd, bool accumulate, + bool round, bool accumulate, bool is_u, int size, int shift) { bool extended_result = false; - bool round = tcg_rnd != NULL; int ext_lshift = 0; TCGv_i64 tcg_src_hi; @@ -9227,6 +9226,7 @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, /* Deal with the rounding step */ if (round) { + TCGv_i64 tcg_rnd = tcg_constant_i64(1ull << (shift - 1)); if (extended_result) { TCGv_i64 tcg_zero = tcg_constant_i64(0); if (!is_u) { @@ -9294,7 +9294,6 @@ static void handle_scalar_simd_shri(DisasContext *s, bool insert = false; TCGv_i64 tcg_rn; TCGv_i64 tcg_rd; - TCGv_i64 tcg_round; if (!extract32(immh, 3, 1)) { unallocated_encoding(s); @@ -9320,12 +9319,6 @@ static void handle_scalar_simd_shri(DisasContext *s, break; } - if (round) { - tcg_round = tcg_constant_i64(1ULL << (shift - 1)); - } else { - tcg_round = NULL; - } - tcg_rn = read_fp_dreg(s, rn); tcg_rd = (accumulate || insert) ? read_fp_dreg(s, rd) : tcg_temp_new_i64(); @@ -9339,7 +9332,7 @@ static void handle_scalar_simd_shri(DisasContext *s, tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_rn, 0, esize - shift); } } else { - handle_shri_with_rndacc(tcg_rd, tcg_rn, tcg_round, + handle_shri_with_rndacc(tcg_rd, tcg_rn, round, accumulate, is_u, size, shift); } @@ -9392,7 +9385,7 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, int elements = is_scalar ? 1 : (64 / esize); bool round = extract32(opcode, 0, 1); MemOp ldop = (size + 1) | (is_u_shift ? 0 : MO_SIGN); - TCGv_i64 tcg_rn, tcg_rd, tcg_round; + TCGv_i64 tcg_rn, tcg_rd; TCGv_i32 tcg_rd_narrowed; TCGv_i64 tcg_final; @@ -9437,15 +9430,9 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, tcg_rd_narrowed = tcg_temp_new_i32(); tcg_final = tcg_temp_new_i64(); - if (round) { - tcg_round = tcg_constant_i64(1ULL << (shift - 1)); - } else { - tcg_round = NULL; - } - for (i = 0; i < elements; i++) { read_vec_element(s, tcg_rn, rn, i, ldop); - handle_shri_with_rndacc(tcg_rd, tcg_rn, tcg_round, + handle_shri_with_rndacc(tcg_rd, tcg_rn, round, false, is_u_shift, size+1, shift); narrowfn(tcg_rd_narrowed, tcg_env, tcg_rd); tcg_gen_extu_i32_i64(tcg_rd, tcg_rd_narrowed); @@ -10495,7 +10482,6 @@ static void handle_vec_simd_shrn(DisasContext *s, bool is_q, int shift = (2 * esize) - immhb; bool round = extract32(opcode, 0, 1); TCGv_i64 tcg_rn, tcg_rd, tcg_final; - TCGv_i64 tcg_round; int i; if (extract32(immh, 3, 1)) { @@ -10512,15 +10498,9 @@ static void handle_vec_simd_shrn(DisasContext *s, bool is_q, tcg_final = tcg_temp_new_i64(); read_vec_element(s, tcg_final, rd, is_q ? 1 : 0, MO_64); - if (round) { - tcg_round = tcg_constant_i64(1ULL << (shift - 1)); - } else { - tcg_round = NULL; - } - for (i = 0; i < elements; i++) { read_vec_element(s, tcg_rn, rn, i, size+1); - handle_shri_with_rndacc(tcg_rd, tcg_rn, tcg_round, + handle_shri_with_rndacc(tcg_rd, tcg_rn, round, false, true, size+1, shift); tcg_gen_deposit_i64(tcg_final, tcg_final, tcg_rd, esize * i, esize); From patchwork Thu Sep 19 13:10:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829616 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319502wrn; Thu, 19 Sep 2024 06:18:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXHkO2NnCb5yGuCes6JB2PdSp/M7Cxlsfs5NYRTSeI0yXexyayiHuO2zRsLx8om2L1HRJOFKQ==@linaro.org X-Google-Smtp-Source: AGHT+IEVQDYgTgB/LBg9TU4BCt3wsp5a8uxDbJWNvdELzk5zbZP9PUknIzQ+nQcAvAson4S6AzWc X-Received: by 2002:a05:6214:5a13:b0:6c5:b886:ebe8 with SMTP id 6a1803df08f44-6c5b886ec21mr114981026d6.38.1726751880876; Thu, 19 Sep 2024 06:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751880; cv=none; d=google.com; s=arc-20240605; b=USOpCG5JBp/RxVpqvKUct9LvLEc9U92Wa0boDU0KfhDtLcEx0+CMZ6p4B//jlKwhlT wg7dt9Sc/WTFX3EG1SXPZdjr/+ZxgjEfIThqegb6MPRSdi/siGQh/xpQQYybHWL3q9Br 2G9Zf5Bzng28BGpg41YiW72Cm5ndSZErOBbfUSVXjPOTG2ADVbe4bYk48x8uphccVBI8 kV6RZMbhtgtHcz0FxWbEZKrvMMcdQwUeNcxSkwiQSJt6hfEkkVWt5KtKIz/HX9JP0t4d vyU/7uhn9YNV6Z52JAhM3cN9HbqbBaNHssqDVAKCa74Pp1z9ZaJVsHXYDHk0NHh+JNO+ bf0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7scyfkuSJmy4vO3ArcLRWxGnGFS5Tga2npXVxbFfSXI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Scts3oIbHNxYPn122TZxvCt3ulWaMREEgLtN/tDO7ZOl8LGzmkFcV5omrTRXv7+A0o B8EdlTMjqX6Y4lHu8jFosiJFX12BKAlLV3w7pqTSU7ylOZkcjwvcBxqYw9z+WCTjzPuX JAESHuYxD+OiKkH5oR2upA0xfwRsyk1p2yoOjj5iAte1jX9IdylS43+cVltgtvalY1Bd YET0kburRES022RbsoQL7HBhtrKopDDDSur7dOQ6se+1sYUUFKJod6fB5URIkDMTSj+S sat1L8PRj+hp2Av+I/VWPBzapFZFGEIp8YAKQxAIx29d55f30Xzq6FZuhQnB3C8gXsfL lr8g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gSGIETtn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c75e585eeesi18160066d6.424.2024.09.19.06.18.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gSGIETtn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwl-0006HF-Ig; Thu, 19 Sep 2024 09:11:47 -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 1srGwR-000597-EW for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:28 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwM-000134-Ob for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:27 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42cb5b3c57eso7634895e9.2 for ; Thu, 19 Sep 2024 06:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751480; x=1727356280; 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=7scyfkuSJmy4vO3ArcLRWxGnGFS5Tga2npXVxbFfSXI=; b=gSGIETtnJj499svUM6UhSUYvSrIM3gzUPR9weUsGqXRuoS/FXUbKjyVgwyp9oIObNC p41vBryIzq2Xk2FC2ZOdsCklzgraoYJpcuzyg0/FVgw7N/Io8iW2FRE4yd2uClOH/8Pt 04v4Pq0h5i9IKH1RgdthV7pVPVOxMh2H1SeSZseQwd+BgqQutYx64QnQUWNdlusH82LH A6+9NMmLU3iDKPibJEDRYVrSw8f9rNF171ZWVUx6CoB/Ul+B5TIB/4XguF+GGx3vuHcd vnE5NkJeom7rOJIzaIpYx9Nqs6A1lk8mKsI5dQrJGzEsVrEmCxPsHGnfK3WhH8+AXi4V PF9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751480; x=1727356280; 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=7scyfkuSJmy4vO3ArcLRWxGnGFS5Tga2npXVxbFfSXI=; b=gaN9JgVVtfOa9iJnAM2wJDO9MYY9kwbmxF0fUKklzjcEY1il8/l3F8H4PBJZkU0lHX BPji5bjgUfBolEgRftwNK9m39sFKYMIgOUeE3mR5jEE3ZsqD/UKxk55jsDGWSbCRPUTI O2mLNTPC+CSW27GBOQwPIsYdIAg4b1enhkJTWLDPms58uTEEd82bv0HBJvNrqj7Vezq5 g+1Zzn8d/p0XpLw4nM/lDseiI3oQh0FjJeYA4QLDL7jgmQbTMEAQGMCesNV9NEH+M3zR PBGBNG9fneGzWn8eIcV9gNhDuo7hqSfsd3EjbAmBxdIJ7+yq0VD/7zILdcERq4zthtMI 1eeQ== X-Gm-Message-State: AOJu0Yz45qYiSb1uxE6Q+i8YsoaYWc1CrapBnPEJjYEYnnyEg8kmzJuK yc7rBivHQHHFHahdI5heE9la1dQ+yJk1afSDitaDV4s68nS1mev4LhMtpCcYa03ejdwlgWwziDW P X-Received: by 2002:a05:600c:45cf:b0:42c:bad0:6c1c with SMTP id 5b1f17b1804b1-42cdb54e480mr165111785e9.18.1726751480014; Thu, 19 Sep 2024 06:11:20 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:19 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/38] target/arm: Split out subroutines of handle_shri_with_rndacc Date: Thu, 19 Sep 2024 14:10:49 +0100 Message-Id: <20240919131106.3362543-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson There isn't a lot of commonality along the different paths of handle_shri_with_rndacc. Split them out to separate functions, which will be usable during the decodetree conversion. Simplify 64-bit rounding operations to not require double-word arithmetic. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-22-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 138 ++++++++++++++++++++------------- 1 file changed, 82 insertions(+), 56 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index e59236330ad..f4deacd5548 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7019,6 +7019,78 @@ static bool do_vec_shift_imm_wide(DisasContext *s, arg_qrri_e *a, bool is_u) TRANS(SSHLL_v, do_vec_shift_imm_wide, a, false) TRANS(USHLL_v, do_vec_shift_imm_wide, a, true) +static void gen_sshr_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + assert(shift >= 0 && shift <= 64); + tcg_gen_sari_i64(dst, src, MIN(shift, 63)); +} + +static void gen_ushr_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + assert(shift >= 0 && shift <= 64); + if (shift == 64) { + tcg_gen_movi_i64(dst, 0); + } else { + tcg_gen_shri_i64(dst, src, shift); + } +} + +static void gen_srshr_bhs(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + assert(shift >= 0 && shift <= 32); + if (shift) { + TCGv_i64 rnd = tcg_constant_i64(1ull << (shift - 1)); + tcg_gen_add_i64(dst, src, rnd); + tcg_gen_sari_i64(dst, dst, shift); + } else { + tcg_gen_mov_i64(dst, src); + } +} + +static void gen_urshr_bhs(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + assert(shift >= 0 && shift <= 32); + if (shift) { + TCGv_i64 rnd = tcg_constant_i64(1ull << (shift - 1)); + tcg_gen_add_i64(dst, src, rnd); + tcg_gen_shri_i64(dst, dst, shift); + } else { + tcg_gen_mov_i64(dst, src); + } +} + +static void gen_srshr_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + assert(shift >= 0 && shift <= 64); + if (shift == 0) { + tcg_gen_mov_i64(dst, src); + } else if (shift == 64) { + /* Extension of sign bit (0,-1) plus sign bit (0,1) is zero. */ + tcg_gen_movi_i64(dst, 0); + } else { + TCGv_i64 rnd = tcg_temp_new_i64(); + tcg_gen_extract_i64(rnd, src, shift - 1, 1); + tcg_gen_sari_i64(dst, src, shift); + tcg_gen_add_i64(dst, dst, rnd); + } +} + +static void gen_urshr_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + assert(shift >= 0 && shift <= 64); + if (shift == 0) { + tcg_gen_mov_i64(dst, src); + } else if (shift == 64) { + /* Rounding will propagate bit 63 into bit 64. */ + tcg_gen_shri_i64(dst, src, 63); + } else { + TCGv_i64 rnd = tcg_temp_new_i64(); + tcg_gen_extract_i64(rnd, src, shift - 1, 1); + tcg_gen_shri_i64(dst, src, shift); + tcg_gen_add_i64(dst, dst, rnd); + } +} + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -9208,69 +9280,23 @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, bool round, bool accumulate, bool is_u, int size, int shift) { - bool extended_result = false; - int ext_lshift = 0; - TCGv_i64 tcg_src_hi; - - if (round && size == 3) { - extended_result = true; - ext_lshift = 64 - shift; - tcg_src_hi = tcg_temp_new_i64(); - } else if (shift == 64) { - if (!accumulate && is_u) { - /* result is zero */ - tcg_gen_movi_i64(tcg_res, 0); - return; - } - } - - /* Deal with the rounding step */ - if (round) { - TCGv_i64 tcg_rnd = tcg_constant_i64(1ull << (shift - 1)); - if (extended_result) { - TCGv_i64 tcg_zero = tcg_constant_i64(0); - if (!is_u) { - /* take care of sign extending tcg_res */ - tcg_gen_sari_i64(tcg_src_hi, tcg_src, 63); - tcg_gen_add2_i64(tcg_src, tcg_src_hi, - tcg_src, tcg_src_hi, - tcg_rnd, tcg_zero); - } else { - tcg_gen_add2_i64(tcg_src, tcg_src_hi, - tcg_src, tcg_zero, - tcg_rnd, tcg_zero); - } + if (!round) { + if (is_u) { + gen_ushr_d(tcg_src, tcg_src, shift); } else { - tcg_gen_add_i64(tcg_src, tcg_src, tcg_rnd); + gen_sshr_d(tcg_src, tcg_src, shift); } - } - - /* Now do the shift right */ - if (round && extended_result) { - /* extended case, >64 bit precision required */ - if (ext_lshift == 0) { - /* special case, only high bits matter */ - tcg_gen_mov_i64(tcg_src, tcg_src_hi); + } else if (size == MO_64) { + if (is_u) { + gen_urshr_d(tcg_src, tcg_src, shift); } else { - tcg_gen_shri_i64(tcg_src, tcg_src, shift); - tcg_gen_shli_i64(tcg_src_hi, tcg_src_hi, ext_lshift); - tcg_gen_or_i64(tcg_src, tcg_src, tcg_src_hi); + gen_srshr_d(tcg_src, tcg_src, shift); } } else { if (is_u) { - if (shift == 64) { - /* essentially shifting in 64 zeros */ - tcg_gen_movi_i64(tcg_src, 0); - } else { - tcg_gen_shri_i64(tcg_src, tcg_src, shift); - } + gen_urshr_bhs(tcg_src, tcg_src, shift); } else { - if (shift == 64) { - /* effectively extending the sign-bit */ - tcg_gen_sari_i64(tcg_src, tcg_src, 63); - } else { - tcg_gen_sari_i64(tcg_src, tcg_src, shift); - } + gen_srshr_bhs(tcg_src, tcg_src, shift); } } From patchwork Thu Sep 19 13:10:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829624 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319981wrn; Thu, 19 Sep 2024 06:18:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXEPg9b1VjrzFe3nBeFCkOJWnHhl+qskV8SaqYup8rQqDsRgcFyl2GmzcRZfDXoaUC9WFhyMA==@linaro.org X-Google-Smtp-Source: AGHT+IHpQFrsuxfB22WGagecwV2UhkO28ZmvqcAya5YzpGGmrDICHYap8vDPjN2TAeZvKOvCHNBm X-Received: by 2002:a05:620a:4013:b0:7a9:bd68:462e with SMTP id af79cd13be357-7a9e5ef6732mr3626856485a.20.1726751935862; Thu, 19 Sep 2024 06:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751935; cv=none; d=google.com; s=arc-20240605; b=gyIgqUOAY9kdOK9Wm/SwhEc/q8NtuU8rcllBi+sgT5a7FdSM/UZ1/HWWyy0LQLaAGT hzEkPzkSWrZYa5ZOe/iv1gcUfiTH9qRq77jUWX/q6Q0QMi2Fb7NhiE27G6WWFkmtk0Vt HA9rzpJDILxKSSq2QcqZFn9uuGNmm1Yey8Llgq51lCBE4NhhaeRadz8i8jFZsKTOMv4k tbVFC/PX9dytKuc2eC4pgiO4Z1vOaIWizONS04V88ol6NQouCjriliaUqIacdIDUZ2vT t4SJFm5dRbVX24xIoXN0OBG9q4A5Fr7PVgB1xau2vywFyz50GUVyTXBqVhQucgtd2wvA SHVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HA8GnKY7Cg0oYJJE2cemBK/bV9pLniArQxYNPHVXFRM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ZDMGsy5QyXoqBS1P9g7c1Z+BfB3A15YE4U5QXJPChr8fPiu2kunqzWSwYYVOS3ZM3l rkGFYqI9wAaz9jFEZU90iVk7W+N8PKDlqla6eUFxvq+RpMdUpfmiNFx9wVlSYLWcQztE yJTBSI8sWfOz858KP2vPKdR+QJJWkfyUU+BnDD4ncDCdN4xKSCIfjaT28GO9Of8Tzvgc cQWdkva1KrX1iZCZn4CsnHEZmoFpJ4EWwGVT3VXFwECaJoo+RFJTKTPB7FaL5QZFyVxh 2Dqf+vjsFl8s1l0nGm8BMf1W6CDRptLwGwS7C4uOTW8PAttCtirMSChheoshTPYf98ss qyTA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HJH4yB8n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb08e15a3si177886785a.440.2024.09.19.06.18.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HJH4yB8n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwk-0006Ea-SQ; Thu, 19 Sep 2024 09:11:46 -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 1srGwV-0005N9-8H for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwM-00013T-Um for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:28 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2f759688444so6776851fa.1 for ; Thu, 19 Sep 2024 06:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751481; x=1727356281; 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=HA8GnKY7Cg0oYJJE2cemBK/bV9pLniArQxYNPHVXFRM=; b=HJH4yB8nCwcRl7cxt7hvwmCgBNGviAv+qVDTDl8UuDAEV3mVijSY/DifVFqTFFMkws eWnIJUM03D8liNAd3lygEV5sutXlV7jIdKDvPvoTZmKdYVyxv2pg+WYbMHh0zD8XAF/O cy8cVxfATFhwj7jEQ21HAlswUwQleQQv7IXtC1riv8+E7l8XVHTlrWupZbYjumSzHtD2 TrzXn1fB9fhWTV2t79N9Wm1ojIkM9sDU3rIZ5knYg2ffRrLmDuiNlAiIsjZXmSSVF4M3 I8AhWbTQhXtN5WIJRYr44Qt6B2kbgQyZf+2HmesFxJTud2gOtIyWFBygWPi4VrQmRvCC aVsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751481; x=1727356281; 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=HA8GnKY7Cg0oYJJE2cemBK/bV9pLniArQxYNPHVXFRM=; b=v0thx4ui2ZYd+ZLkvHbaovfyTBehP/K2ErGLJXPjfYbZHcSxs5IcF7K1McCFwqcUJy PZZxhxiZRNqoys7z1DoJ+VYcLWzMXymgkKv8IK9NKCCGhknLGG3nHuRP1+VMaOY/zpE7 ShE0DX8kgUh+LkH8e4CQE/1QgsFFIyCwJLEwd8xLm7Sr0bDhkWkU/3QndSJkqv1wGEHl P+gfyenycWVj7AFR5qx4+Orf1EGguQ1fxCeiCmcEFDfTcjIZS8pc1bBaue5VGqYq1uD8 u4kPKmjykwu2PHuJDobYMwBoHsZ7CUjlyAf6GgARlMVMtqmYQv05f3H4xCfCrleJUTy+ mW8g== X-Gm-Message-State: AOJu0Yzyq5Dajttm4e2rAQSIb1nfGbWIYj/fV2XtSNpTH9nzw8EIS8zC 79hGSINS+b6MIFhdmsFHa8Br79hWrYWb0w5WzBm1ZABx7PlXGwow2d/2y9sjD73wadq6QzafW2z W X-Received: by 2002:a05:651c:502:b0:2f1:a19b:d5a4 with SMTP id 38308e7fff4ca-2f787ed88cbmr138211651fa.22.1726751480549; Thu, 19 Sep 2024 06:11:20 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:20 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/38] target/arm: Convert SHRN, RSHRN to decodetree Date: Thu, 19 Sep 2024 14:10:50 +0100 Message-Id: <20240919131106.3362543-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22d.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-23-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 8 +++ target/arm/tcg/translate-a64.c | 95 +++++++++++++++++----------------- 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index bf67f8a357a..164ed575b9f 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1277,3 +1277,11 @@ SSHLL_v 0.00 11110 .... ... 10100 1 ..... ..... @q_shli_s USHLL_v 0.10 11110 .... ... 10100 1 ..... ..... @q_shli_b USHLL_v 0.10 11110 .... ... 10100 1 ..... ..... @q_shli_h USHLL_v 0.10 11110 .... ... 10100 1 ..... ..... @q_shli_s + +SHRN_v 0.00 11110 .... ... 10000 1 ..... ..... @q_shri_b +SHRN_v 0.00 11110 .... ... 10000 1 ..... ..... @q_shri_h +SHRN_v 0.00 11110 .... ... 10000 1 ..... ..... @q_shri_s + +RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_b +RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_h +RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_s diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index f4deacd5548..8871087af0a 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7091,6 +7091,51 @@ static void gen_urshr_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) } } +static bool do_vec_shift_imm_narrow(DisasContext *s, arg_qrri_e *a, + WideShiftImmFn * const fns[3], MemOp sign) +{ + TCGv_i64 tcg_rn, tcg_rd; + int esz = a->esz; + int esize; + WideShiftImmFn *fn; + + tcg_debug_assert(esz >= MO_8 && esz <= MO_32); + + if (!fp_access_check(s)) { + return true; + } + + tcg_rn = tcg_temp_new_i64(); + tcg_rd = tcg_temp_new_i64(); + tcg_gen_movi_i64(tcg_rd, 0); + + fn = fns[esz]; + esize = 8 << esz; + for (int i = 0, elements = 8 >> esz; i < elements; i++) { + read_vec_element(s, tcg_rn, a->rn, i, (esz + 1) | sign); + fn(tcg_rn, tcg_rn, a->imm); + tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_rn, esize * i, esize); + } + + write_vec_element(s, tcg_rd, a->rd, a->q, MO_64); + clear_vec_high(s, a->q, a->rd); + return true; +} + +static WideShiftImmFn * const shrn_fns[] = { + tcg_gen_shri_i64, + tcg_gen_shri_i64, + gen_ushr_d, +}; +TRANS(SHRN_v, do_vec_shift_imm_narrow, a, shrn_fns, 0) + +static WideShiftImmFn * const rshrn_fns[] = { + gen_urshr_bhs, + gen_urshr_bhs, + gen_urshr_d, +}; +TRANS(RSHRN_v, do_vec_shift_imm_narrow, a, rshrn_fns, 0) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -10496,52 +10541,6 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) } } -/* SHRN/RSHRN - Shift right with narrowing (and potential rounding) */ -static void handle_vec_simd_shrn(DisasContext *s, bool is_q, - int immh, int immb, int opcode, int rn, int rd) -{ - int immhb = immh << 3 | immb; - int size = 32 - clz32(immh) - 1; - int dsize = 64; - int esize = 8 << size; - int elements = dsize/esize; - int shift = (2 * esize) - immhb; - bool round = extract32(opcode, 0, 1); - TCGv_i64 tcg_rn, tcg_rd, tcg_final; - int i; - - if (extract32(immh, 3, 1)) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - tcg_rn = tcg_temp_new_i64(); - tcg_rd = tcg_temp_new_i64(); - tcg_final = tcg_temp_new_i64(); - read_vec_element(s, tcg_final, rd, is_q ? 1 : 0, MO_64); - - for (i = 0; i < elements; i++) { - read_vec_element(s, tcg_rn, rn, i, size+1); - handle_shri_with_rndacc(tcg_rd, tcg_rn, round, - false, true, size+1, shift); - - tcg_gen_deposit_i64(tcg_final, tcg_final, tcg_rd, esize * i, esize); - } - - if (!is_q) { - write_vec_element(s, tcg_final, rd, 0, MO_64); - } else { - write_vec_element(s, tcg_final, rd, 1, MO_64); - } - - clear_vec_high(s, is_q, rd); -} - - /* AdvSIMD shift by immediate * 31 30 29 28 23 22 19 18 16 15 11 10 9 5 4 0 * +---+---+---+-------------+------+------+--------+---+------+------+ @@ -10564,13 +10563,13 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x10: /* SHRN */ + case 0x10: /* SHRN / SQSHRUN */ case 0x11: /* RSHRN / SQRSHRUN */ if (is_u) { handle_vec_simd_sqshrn(s, false, is_q, false, true, immh, immb, opcode, rn, rd); } else { - handle_vec_simd_shrn(s, is_q, immh, immb, opcode, rn, rd); + unallocated_encoding(s); } break; case 0x12: /* SQSHRN / UQSHRN */ From patchwork Thu Sep 19 13:10:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829627 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320025wrn; Thu, 19 Sep 2024 06:19:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXINVxEOQNoT1KjwxVof/0GXJSEQ12QF1o0G1Lfq6kUn4AXEnEdtf3Lg71ExMco6udjTher/w==@linaro.org X-Google-Smtp-Source: AGHT+IGqFWDg5prslepAqwjZexWCup26DmYzD5k16n1LnpPSkqqXMR+K8kqSbDAmS0ZDoiohXQLa X-Received: by 2002:a05:620a:470c:b0:7a9:a389:c13e with SMTP id af79cd13be357-7ab30d33370mr3254942385a.18.1726751941003; Thu, 19 Sep 2024 06:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751940; cv=none; d=google.com; s=arc-20240605; b=UdxDbaYnFxiefD7pJGV5Gjnf3sVgWZ/9HnImI71EUKekWC877toSseItPZ9zxonoa+ X8ho+4Bk64G+glomyNO7qvSTAa5/yZNaXFA4auOgVU21L7pPWa3lBfoS3KtRR2Kk4l2i MMDHGrijq8XSkNKSaWTp5bTQi+FsXjOar/UybjH36ElUbPaV/moL6S9vhQutlJQDCKiv SmTwdLZi6aJUI+1VLuxhkdES3c6Rr3PJWAX9mRaUQ5yXFpyd8a+uFr8xNe77kLIAgm8s +zjfojeoANppVIE8wZSRJCn/WTrNt1UQFS1ULRmJrCxtRn7pXEPi0hZlArtft18u7YBp lEUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=XX9yQIi8b1jQQJvaC2GRnD/Cmm1wrhN5NgL/btQuSgQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=aBjH5Q+4lhaYIvSb7bSxFGJWZOX8jfroxCXtuZRHlWBVI6+PkFi8bcRgIxvOsYCJ1X +n2zqDn0c/NfexpW2vwwPsnaC/pRPoLadtcl2a6Dr7ySXqaW0fBqgrWwKIGZ0tjdLy7J IeZGHWT2Ua2B/xJtAw9L1Ssw/oYHLLZlQDXQ/n7VNW1fie5xQiM7EH5/H6dwoRlfpYbE iz7NStui/3tkjQXGJKgXsrCM6VrKUumAw1QlDteuGbtxqxV/5gZ5vtyOp0KnORVMsBGZ HIHMYHUrSmBbXxEzo6RTvhkc4/3x/hprVWPzDIrEJPF5jdpnUcsjzAMoH+KIbO6jFLLd ce0g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U2C8IrKZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb07f7db6si189622585a.108.2024.09.19.06.19.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:19:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U2C8IrKZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwn-0006O4-3n; Thu, 19 Sep 2024 09:11:49 -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 1srGwV-0005NM-9h for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwO-00013W-3w for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:29 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42cb9a0c300so7127385e9.0 for ; Thu, 19 Sep 2024 06:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751481; x=1727356281; 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=XX9yQIi8b1jQQJvaC2GRnD/Cmm1wrhN5NgL/btQuSgQ=; b=U2C8IrKZiPaoTXMlQFEJml1Tq9OgpLFSbniP/wHkZPbb+1c1lBMDBg4aHITONhLtW6 Vih8Xo1D0hoqJ//ITf/nGtI9W6GVtIrqeNVhCMdlU4mR2dXqCHSk2wDbVhye4R3ekERL 6RbDHr+dJe+iVoAvqxEZUpBTLk/XIX1x4z+gnFtRqUJjwz/KoHJdSqv8oKM8n/o4D5QM /fibRXIe1zgealDtQhaC2NwPxIi9f+1GqDogLd0GCuzPniUQr4gO00WREC16Qxe7gjMP AR1BSk+byIhPhooc6WoiTd/6yf/RVhnxMn3uEuEa/AF1xfgKDcj6hDOjaRatWSiiDSPW yZZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751481; x=1727356281; 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=XX9yQIi8b1jQQJvaC2GRnD/Cmm1wrhN5NgL/btQuSgQ=; b=iXKclPbzgffNIZXVl0Z5P8+gzWcknIY7N/fxvis5+o4UmPV8jRxdB8o78Eu//jNbt6 tQrDSQVOEPkLrK6L3wzrjlDTAyTepImoFfMs50FM3GefouOqygoRQvbU7p+nzcD5r1gL r/qe9mQSVQDZteQi+Axy+j1K1zSiUOBmWl3IvJEZFnvfpLOXa+nnz2xMA32JE8m3oFM3 ut2HvqMzRlO2uXCJJM4hcFfAP2Cy4t/fODCPUSObZWxJBWxJ5Cb2Q6WY4A4gt5gaQZ3q roWy0Amf6lXBfNjCFCQbvkw0GCtxlp1oR/F+C3CoGEhjJpZ6c9w5EPXWr3moHPEin8oa hZKw== X-Gm-Message-State: AOJu0YzTq40THo1GuLIfsdyVUzxIIuxXAXetDEtpzI864LeKMuS9sr3/ s2yL3UHiXkfW9oUN+5la2AIUK96sH3zvIf4wHhmbTdNj0kIt40/i6I7NqLq2firrtDdDVIXU80m i X-Received: by 2002:a05:600c:1d12:b0:42c:b22e:fc23 with SMTP id 5b1f17b1804b1-42cdb53b958mr199714655e9.15.1726751481142; Thu, 19 Sep 2024 06:11:21 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:20 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/38] target/arm: Convert handle_scalar_simd_shri to decodetree Date: Thu, 19 Sep 2024 14:10:51 +0100 Message-Id: <20240919131106.3362543-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This includes SSHR, USHR, SSRA, USRA, SRSHR, URSHR, SRSRA, URSRA, SRI. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-24-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 16 ++++ target/arm/tcg/translate-a64.c | 140 ++++++++++++++++----------------- 2 files changed, 86 insertions(+), 70 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 164ed575b9f..6c2362b3bbc 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -30,6 +30,7 @@ &rri_sf rd rn imm sf &i imm &rr_e rd rn esz +&rri_e rd rn imm esz &rrr_e rd rn rm esz &rrx_e rd rn rm idx esz &rrrr_e rd rn rm ra esz @@ -1285,3 +1286,18 @@ SHRN_v 0.00 11110 .... ... 10000 1 ..... ..... @q_shri_s RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_b RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_h RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_s + +# Advanced SIMD scalar shift by immediate + +@shri_d .... ..... 1 ...... ..... . rn:5 rd:5 \ + &rri_e esz=3 imm=%neon_rshift_i6 + +SSHR_s 0101 11110 .... ... 00000 1 ..... ..... @shri_d +USHR_s 0111 11110 .... ... 00000 1 ..... ..... @shri_d +SSRA_s 0101 11110 .... ... 00010 1 ..... ..... @shri_d +USRA_s 0111 11110 .... ... 00010 1 ..... ..... @shri_d +SRSHR_s 0101 11110 .... ... 00100 1 ..... ..... @shri_d +URSHR_s 0111 11110 .... ... 00100 1 ..... ..... @shri_d +SRSRA_s 0101 11110 .... ... 00110 1 ..... ..... @shri_d +URSRA_s 0111 11110 .... ... 00110 1 ..... ..... @shri_d +SRI_s 0111 11110 .... ... 01000 1 ..... ..... @shri_d diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 8871087af0a..efd93a7f234 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7035,6 +7035,18 @@ static void gen_ushr_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) } } +static void gen_ssra_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + gen_sshr_d(src, src, shift); + tcg_gen_add_i64(dst, dst, src); +} + +static void gen_usra_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + gen_ushr_d(src, src, shift); + tcg_gen_add_i64(dst, dst, src); +} + static void gen_srshr_bhs(TCGv_i64 dst, TCGv_i64 src, int64_t shift) { assert(shift >= 0 && shift <= 32); @@ -7091,6 +7103,27 @@ static void gen_urshr_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) } } +static void gen_srsra_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + gen_srshr_d(src, src, shift); + tcg_gen_add_i64(dst, dst, src); +} + +static void gen_ursra_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + gen_urshr_d(src, src, shift); + tcg_gen_add_i64(dst, dst, src); +} + +static void gen_sri_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + /* If shift is 64, dst is unchanged. */ + if (shift != 64) { + tcg_gen_shri_i64(src, src, shift); + tcg_gen_deposit_i64(dst, dst, src, 0, 64 - shift); + } +} + static bool do_vec_shift_imm_narrow(DisasContext *s, arg_qrri_e *a, WideShiftImmFn * const fns[3], MemOp sign) { @@ -7136,6 +7169,38 @@ static WideShiftImmFn * const rshrn_fns[] = { }; TRANS(RSHRN_v, do_vec_shift_imm_narrow, a, rshrn_fns, 0) +/* + * Advanced SIMD Scalar Shift by Immediate + */ + +static bool do_scalar_shift_imm(DisasContext *s, arg_rri_e *a, + WideShiftImmFn *fn, bool accumulate, + MemOp sign) +{ + if (fp_access_check(s)) { + TCGv_i64 rd = tcg_temp_new_i64(); + TCGv_i64 rn = tcg_temp_new_i64(); + + read_vec_element(s, rn, a->rn, 0, a->esz | sign); + if (accumulate) { + read_vec_element(s, rd, a->rd, 0, a->esz | sign); + } + fn(rd, rn, a->imm); + write_fp_dreg(s, a->rd, rd); + } + return true; +} + +TRANS(SSHR_s, do_scalar_shift_imm, a, gen_sshr_d, false, 0) +TRANS(USHR_s, do_scalar_shift_imm, a, gen_ushr_d, false, 0) +TRANS(SSRA_s, do_scalar_shift_imm, a, gen_ssra_d, true, 0) +TRANS(USRA_s, do_scalar_shift_imm, a, gen_usra_d, true, 0) +TRANS(SRSHR_s, do_scalar_shift_imm, a, gen_srshr_d, false, 0) +TRANS(URSHR_s, do_scalar_shift_imm, a, gen_urshr_d, false, 0) +TRANS(SRSRA_s, do_scalar_shift_imm, a, gen_srsra_d, true, 0) +TRANS(URSRA_s, do_scalar_shift_imm, a, gen_ursra_d, true, 0) +TRANS(SRI_s, do_scalar_shift_imm, a, gen_sri_d, true, 0) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -9352,64 +9417,6 @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, } } -/* SSHR[RA]/USHR[RA] - Scalar shift right (optional rounding/accumulate) */ -static void handle_scalar_simd_shri(DisasContext *s, - bool is_u, int immh, int immb, - int opcode, int rn, int rd) -{ - const int size = 3; - int immhb = immh << 3 | immb; - int shift = 2 * (8 << size) - immhb; - bool accumulate = false; - bool round = false; - bool insert = false; - TCGv_i64 tcg_rn; - TCGv_i64 tcg_rd; - - if (!extract32(immh, 3, 1)) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - switch (opcode) { - case 0x02: /* SSRA / USRA (accumulate) */ - accumulate = true; - break; - case 0x04: /* SRSHR / URSHR (rounding) */ - round = true; - break; - case 0x06: /* SRSRA / URSRA (accum + rounding) */ - accumulate = round = true; - break; - case 0x08: /* SRI */ - insert = true; - break; - } - - tcg_rn = read_fp_dreg(s, rn); - tcg_rd = (accumulate || insert) ? read_fp_dreg(s, rd) : tcg_temp_new_i64(); - - if (insert) { - /* shift count same as element size is valid but does nothing; - * special case to avoid potential shift by 64. - */ - int esize = 8 << size; - if (shift != esize) { - tcg_gen_shri_i64(tcg_rn, tcg_rn, shift); - tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_rn, 0, esize - shift); - } - } else { - handle_shri_with_rndacc(tcg_rd, tcg_rn, round, - accumulate, is_u, size, shift); - } - - write_fp_dreg(s, rd, tcg_rd); -} - /* SHL/SLI - Scalar shift left */ static void handle_scalar_simd_shli(DisasContext *s, bool insert, int immh, int immb, int opcode, @@ -9893,18 +9900,6 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x08: /* SRI */ - if (!is_u) { - unallocated_encoding(s); - return; - } - /* fall through */ - case 0x00: /* SSHR / USHR */ - case 0x02: /* SSRA / USRA */ - case 0x04: /* SRSHR / URSHR */ - case 0x06: /* SRSRA / URSRA */ - handle_scalar_simd_shri(s, is_u, immh, immb, opcode, rn, rd); - break; case 0x0a: /* SHL / SLI */ handle_scalar_simd_shli(s, is_u, immh, immb, opcode, rn, rd); break; @@ -9940,6 +9935,11 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) handle_simd_shift_fpint_conv(s, true, false, is_u, immh, immb, rn, rd); break; default: + case 0x00: /* SSHR / USHR */ + case 0x02: /* SSRA / USRA */ + case 0x04: /* SRSHR / URSHR */ + case 0x06: /* SRSRA / URSRA */ + case 0x08: /* SRI */ unallocated_encoding(s); break; } From patchwork Thu Sep 19 13:10:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829629 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320220wrn; Thu, 19 Sep 2024 06:19:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXrZ8LsGdF9Lzt+rKk6TMMkFIyRvvM8zzR28rOss5TwYw8+nhZx5JypRIRzrdFQ/dh1Pxtl1w==@linaro.org X-Google-Smtp-Source: AGHT+IHpk759ySqvuG/CJiKY0UlDdriLxsrwZwwt/bzJL7msrFXeSdZ/pppguXQL3nJtdYbCR+QW X-Received: by 2002:a05:690c:f13:b0:648:baba:542f with SMTP id 00721157ae682-6dbb69c1dc8mr240337757b3.0.1726751960916; Thu, 19 Sep 2024 06:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751960; cv=none; d=google.com; s=arc-20240605; b=kPGACBGSdo37iCLnTjE3lCvgkD1/0iHQgfWen0dNojI3IzLrZVlvkrVoyWIBJNNe7k zSAGrXEHaoMqAdhz2zWXaxGUWPo53G5XBBXmyXJ0YbVZiR/7ezSkoc94idB7w9O4wubF m9lN6pV1NPZ1UQSWgf6fY3HJfCQw1XK/eJa1HUtbIrwFg17ndwcpMA//NhSgGzuZAklQ V4l4IzYn5Ni2wWdAtHn+n6fd1FU5UddNNQOeGhfAPr0Gu1e1aYYXlfcKG7LzO92E6lJs zZOEH+MBurONCu07qgt8Frb1ICI5o2VjRmjM+B1eXb73dwK4tEVX6w4Wg6NqOT9Nf1xH XS8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=65GoK7jjLDjdYPKDwe9YM8X2eiP0HXrBJnIC4AyohQU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=dbpU+yT4tpMQAxY9pfvG/u8x16IN8Z9r0rVtaCAdsCpnckAjmSGIzG4i9WjLTk68jQ wsbsJDTxS++O1q3Huml9ulpjZAvJxXQsNcMr7qNn6g7QXyKuvSnA6BeczVFIHQMAZxqZ deea6wIGp12Z47JgyhVI4sz09kRr8ckKBP6JjUOvqGmOPhcnxNfK64lRfICVF1gAqxQz nxTGd7Eoe2WaZyxXrZs6uz6sPTtma4yliDbk1iwO4Zm/1SHN4fcgeq/i3uDOVRvq42Ch Ey+XcTKCNrgbz8eXpx72UNcRgPQQ3/3rXQJ5Tlljo1PF6ELTt3wKRW+pB42pDINXvT8p Qz5w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h8eVY03X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb08e16a0si180280485a.465.2024.09.19.06.19.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:19:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h8eVY03X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwi-00064N-7m; Thu, 19 Sep 2024 09:11:44 -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 1srGwV-0005NG-9B for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwQ-00013f-NV for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:29 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42cbc38a997so5489415e9.1 for ; Thu, 19 Sep 2024 06:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751482; x=1727356282; 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=65GoK7jjLDjdYPKDwe9YM8X2eiP0HXrBJnIC4AyohQU=; b=h8eVY03X+hHR/l6mMWlx91CkmoKXYvemnvzwJW2jyDolp+t76EY72mbA6UGs+iUbXY 1YX9RqACaAzIHCPdk3okXzXOmrzM0DX8dG9LltvkjOYrJAbRJgUBVt1PDDz3E7QyElz6 lkMv20feMam5LAMP0X0qcpBb6LBkEe1tf+g9keCEB88U6AqZ70twqw3+0K2ti6KGf9RF id2apltSjpfFoH0qLOMgfQOM+PlXSODSH71bV6ZyELeQdOuBju3cIexaAqt+Ox6Cd1S6 1OMtkwpOVc7Tq86LvPIWpPNUDQhqqbQddSR0ATvReI4PvVi8ERsDe1FLG7dEGjSTulWi HI6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751482; x=1727356282; 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=65GoK7jjLDjdYPKDwe9YM8X2eiP0HXrBJnIC4AyohQU=; b=oJnJVEkKuary0JotoVY/+ZJNL85d0wEJ4Qz+5FAP9yeHXKlhWC2kQFcyCF9bxxHUkP vPbwSB2JILntvwhMgPDZwO7iZV2jZ/YerEL7NTKNqOn9eU4bv7wPn3n8MmYILR8Mitn4 8N8c8Mddvo1E9Et1GncGjO2izP6aLO+7Nyn0cZia653voBqkEvJ+/jHqu8na14e175Zz /df3d2O04ZThek6e18TOnNMYdeNTafJkzsrA+DnDoAT97cweWvH+LHzmAVWIYqH9OcWt VrOjHexGKH8cTxaD7DKUS08JeOOV/7C7OQzrkvw6h5o2OWoo7uKbaqp9Cy++95pysFB/ m6dQ== X-Gm-Message-State: AOJu0YxCqArduzw8RTdd1g/BYnx0pmV3VfpLZp5+9tc7m08PoLLqZYzj Q8pygnp32oQOIt+JT/brNzcEfRAq0t1uEz9FlImxircS2s9Cphzzz+0D+c6nY9QSnw9HTpsIRP0 2 X-Received: by 2002:a05:600c:19ce:b0:424:8743:86b4 with SMTP id 5b1f17b1804b1-42e74406533mr18458475e9.6.1726751482123; Thu, 19 Sep 2024 06:11:22 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:21 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/38] target/arm: Convert handle_scalar_simd_shli to decodetree Date: Thu, 19 Sep 2024 14:10:52 +0100 Message-Id: <20240919131106.3362543-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This includes SHL and SLI. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-25-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 4 ++++ target/arm/tcg/translate-a64.c | 44 +++++++--------------------------- 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 6c2362b3bbc..96803fe6e4c 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1291,6 +1291,7 @@ RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_s @shri_d .... ..... 1 ...... ..... . rn:5 rd:5 \ &rri_e esz=3 imm=%neon_rshift_i6 +@shli_d .... ..... 1 imm:6 ..... . rn:5 rd:5 &rri_e esz=3 SSHR_s 0101 11110 .... ... 00000 1 ..... ..... @shri_d USHR_s 0111 11110 .... ... 00000 1 ..... ..... @shri_d @@ -1301,3 +1302,6 @@ URSHR_s 0111 11110 .... ... 00100 1 ..... ..... @shri_d SRSRA_s 0101 11110 .... ... 00110 1 ..... ..... @shri_d URSRA_s 0111 11110 .... ... 00110 1 ..... ..... @shri_d SRI_s 0111 11110 .... ... 01000 1 ..... ..... @shri_d + +SHL_s 0101 11110 .... ... 01010 1 ..... ..... @shli_d +SLI_s 0111 11110 .... ... 01010 1 ..... ..... @shli_d diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index efd93a7f234..934746d2f2c 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7124,6 +7124,11 @@ static void gen_sri_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) } } +static void gen_sli_d(TCGv_i64 dst, TCGv_i64 src, int64_t shift) +{ + tcg_gen_deposit_i64(dst, dst, src, shift, 64 - shift); +} + static bool do_vec_shift_imm_narrow(DisasContext *s, arg_qrri_e *a, WideShiftImmFn * const fns[3], MemOp sign) { @@ -7201,6 +7206,9 @@ TRANS(SRSRA_s, do_scalar_shift_imm, a, gen_srsra_d, true, 0) TRANS(URSRA_s, do_scalar_shift_imm, a, gen_ursra_d, true, 0) TRANS(SRI_s, do_scalar_shift_imm, a, gen_sri_d, true, 0) +TRANS(SHL_s, do_scalar_shift_imm, a, tcg_gen_shli_i64, false, 0) +TRANS(SLI_s, do_scalar_shift_imm, a, gen_sli_d, true, 0) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -9417,38 +9425,6 @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, } } -/* SHL/SLI - Scalar shift left */ -static void handle_scalar_simd_shli(DisasContext *s, bool insert, - int immh, int immb, int opcode, - int rn, int rd) -{ - int size = 32 - clz32(immh) - 1; - int immhb = immh << 3 | immb; - int shift = immhb - (8 << size); - TCGv_i64 tcg_rn; - TCGv_i64 tcg_rd; - - if (!extract32(immh, 3, 1)) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - tcg_rn = read_fp_dreg(s, rn); - tcg_rd = insert ? read_fp_dreg(s, rd) : tcg_temp_new_i64(); - - if (insert) { - tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_rn, shift, 64 - shift); - } else { - tcg_gen_shli_i64(tcg_rd, tcg_rn, shift); - } - - write_fp_dreg(s, rd, tcg_rd); -} - /* SQSHRN/SQSHRUN - Saturating (signed/unsigned) shift right with * (signed/unsigned) narrowing */ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, @@ -9900,9 +9876,6 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x0a: /* SHL / SLI */ - handle_scalar_simd_shli(s, is_u, immh, immb, opcode, rn, rd); - break; case 0x1c: /* SCVTF, UCVTF */ handle_simd_shift_intfp_conv(s, true, false, is_u, immh, immb, opcode, rn, rd); @@ -9940,6 +9913,7 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) case 0x04: /* SRSHR / URSHR */ case 0x06: /* SRSRA / URSRA */ case 0x08: /* SRI */ + case 0x0a: /* SHL / SLI */ unallocated_encoding(s); break; } From patchwork Thu Sep 19 13:10:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829634 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320674wrn; Thu, 19 Sep 2024 06:20:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWweBT5tkg7GaulDJFuDKB1DPUsskp6kn73zNcAd9RRyobymmeYWaxgQLE6nAh7sxTdNqBsFA==@linaro.org X-Google-Smtp-Source: AGHT+IGkoSO7BfAkoHQMc2OIIxa5K+/oXQhI3OCa9bUWdoF+j3QUznLtumHTdpgw3erjHprxWTxO X-Received: by 2002:ac8:5e52:0:b0:458:3917:1b98 with SMTP id d75a77b69052e-45b160af5f6mr52745031cf.20.1726752023268; Thu, 19 Sep 2024 06:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726752023; cv=none; d=google.com; s=arc-20240605; b=AHsCj9lQt6l0zLynWovZiQRc0CVVqGca5NRrjPO3LjtsSrHjwLg3t8oPpnkQ94jdqL pHrh/5W6Uv8+3d9rfRVZ//foP+Zg0UDFaMRcoz+IaN4Wc2Tq+yk1XsM2iOdTxQjQfGkP s7lhnUlpBpXI3MxDEzmA6eyhGs6EJYgFCkuh1/apEcRkTRJqibOmu6Iwg2rNXb6j3/CP gxvZtHLvzllPvOZ1mClgSlkfkX8VYycOm/ENKH/ndDUfSf02u5dR6PIR3rMjz6KPanlH xO6CGFc+3h3EufYbG3kYC9ir/4f08y28R6C02kH4k3caDdqzxvL/A96El4ce0k2dY/qz gUmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cTwcqBrt3QmM2OEYUAdbYAQf7QkGQA7HzVCPapnp4q4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ONvIZueyeUK20T1Ub5vCAJNEf1ETdYYP696SL1+TPLTIo7GR42vNQkcIaiSZSSfwC6 agGCsl3oZNpt78uJE+Ppcse8QpPDmpP4ZniQln/Jufw8aBdpz4xsyRF4GAODP+iw7xPw 6yh6Ql2vqA5GfMSr90C5lEkIiYvTpdarWMYDTf9PzGi139SBX42flkWMikoh1+hWliTX Z7Ji/qHQr60Ko9jVjqX6of9hFymDjDzgGI3yQLCG5O9117X68F8JmNP0j5/z2Vdz9Cdu mV8dc7/9lj7cQJ9j00oK4kyXnfbG+IOmPxGfrJSkK5YXbQmpybQOsGAEGeRS/7qMfxnU TrOg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ix8NYpr9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45b178ed873si17849131cf.314.2024.09.19.06.20.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ix8NYpr9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwm-0006JO-1a; Thu, 19 Sep 2024 09:11:48 -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 1srGwV-0005N8-8Z for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwQ-00013l-Mm for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:29 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42cb8dac900so7634615e9.3 for ; Thu, 19 Sep 2024 06:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751483; x=1727356283; 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=cTwcqBrt3QmM2OEYUAdbYAQf7QkGQA7HzVCPapnp4q4=; b=ix8NYpr9wuRVC2YFIwpSglvovbDrmR2on+SSv2H8hqPg+Fae/KzAJJ6GR2yEwQoFmN XKZRh+jv4WVUbyMOxWNllHLEcRDzSHV25Fvd7EuYO5N0jNzhBi+5zFB/XQb6p3Hq6guh xJeNgu901KbWvMu3rKr1u4OXGGXC4PaItQEVuLy4SOW4oKvX2cNUdQoAA4aBGV9Mo7xB jeQb8fvqjD/RwVcAeRmNuhd8/1s81Xh419HLEiX7ISHRxIIVOnhd/msFz67wt9SE3erq VyNw1woqCAEGm+tqGTeCw8pgPXCW+0XZERRgXriN42OZ7/KXJOX92CTQ10K1+919mh81 yMYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751483; x=1727356283; 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=cTwcqBrt3QmM2OEYUAdbYAQf7QkGQA7HzVCPapnp4q4=; b=Hp/tKUa/oZe0oIqb7Q/PseGiOYaOIJRPI11PtiZO7ibMWjgtIt7Vk2ZVlUJaxlFpZ5 4LO4Rop+gEXVTgGGRstgNttQQQ3srjwpn67hDhDRz4ylm8ZZ/JvJgEkw/jvsCG2Oq8TB imjkdjTQkFghm9DjL0jfw0Id4UIAjmRQZxIYB2nQ/H6Di3iAYfzov9592so9x8jImd99 FEiXaZhjlXE93P++MbuL7D1iydxjj38fI2ITrFAKHLVUCRGxvBTt4LNLoOnZfumwaFtW DpKgG8/V7o0ZyTQIgwRlRY2N9/2yYJaBm7ZCKjBjG5SVjFKGwqT9fXyQ0X6dLunxMLdd OBBw== X-Gm-Message-State: AOJu0YyqlD4e+3/O6OvTe/4TclDd2WH9Oj/uXW9UjHqJD8obSwJNdYRh 2dLPua95oLSCZQnwg82WRgmNhdyYhdeXgvYYq6il6LB1h7SPkK/z/+NHb8Ztk5YOasv5hbO+UCK f X-Received: by 2002:a05:600c:3514:b0:42c:df67:1d35 with SMTP id 5b1f17b1804b1-42cdf671f9emr199227395e9.1.1726751482611; Thu, 19 Sep 2024 06:11:22 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:22 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/38] target/arm: Convert VQSHL, VQSHLU to gvec Date: Thu, 19 Sep 2024 14:10:53 +0100 Message-Id: <20240919131106.3362543-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-26-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.h | 12 ++++ target/arm/tcg/translate.h | 7 ++ target/arm/tcg/neon-dp.decode | 6 +- target/arm/tcg/gengvec.c | 36 +++++++++++ target/arm/tcg/neon_helper.c | 33 ++++++++++ target/arm/tcg/translate-neon.c | 110 +------------------------------- 6 files changed, 94 insertions(+), 110 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index b463be38c52..b40589d329f 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -324,6 +324,18 @@ DEF_HELPER_FLAGS_5(neon_uqrshl_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32 DEF_HELPER_FLAGS_5(neon_uqrshl_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(neon_uqrshl_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(neon_uqrshl_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_sqshli_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_sqshli_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_sqshli_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_sqshli_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_uqshli_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_uqshli_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_uqshli_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_uqshli_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_sqshlui_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_sqshlui_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_sqshlui_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(neon_sqshlui_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_srshl_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_srshl_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 45990ae2928..7721c627e9d 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -471,6 +471,13 @@ void gen_neon_sqrshl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, void gen_neon_uqrshl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); +void gen_neon_sqshli(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + int64_t c, uint32_t opr_sz, uint32_t max_sz); +void gen_neon_uqshli(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + int64_t c, uint32_t opr_sz, uint32_t max_sz); +void gen_neon_sqshlui(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + int64_t c, uint32_t opr_sz, uint32_t max_sz); + void gen_gvec_shadd(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); void gen_gvec_uhadd(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, diff --git a/target/arm/tcg/neon-dp.decode b/target/arm/tcg/neon-dp.decode index 788578c8fa1..e883c6ab585 100644 --- a/target/arm/tcg/neon-dp.decode +++ b/target/arm/tcg/neon-dp.decode @@ -291,17 +291,17 @@ VSLI_2sh 1111 001 1 1 . ...... .... 0101 . . . 1 .... @2reg_shl_s VSLI_2sh 1111 001 1 1 . ...... .... 0101 . . . 1 .... @2reg_shl_h VSLI_2sh 1111 001 1 1 . ...... .... 0101 . . . 1 .... @2reg_shl_b -VQSHLU_64_2sh 1111 001 1 1 . ...... .... 0110 . . . 1 .... @2reg_shl_d +VQSHLU_2sh 1111 001 1 1 . ...... .... 0110 . . . 1 .... @2reg_shl_d VQSHLU_2sh 1111 001 1 1 . ...... .... 0110 . . . 1 .... @2reg_shl_s VQSHLU_2sh 1111 001 1 1 . ...... .... 0110 . . . 1 .... @2reg_shl_h VQSHLU_2sh 1111 001 1 1 . ...... .... 0110 . . . 1 .... @2reg_shl_b -VQSHL_S_64_2sh 1111 001 0 1 . ...... .... 0111 . . . 1 .... @2reg_shl_d +VQSHL_S_2sh 1111 001 0 1 . ...... .... 0111 . . . 1 .... @2reg_shl_d VQSHL_S_2sh 1111 001 0 1 . ...... .... 0111 . . . 1 .... @2reg_shl_s VQSHL_S_2sh 1111 001 0 1 . ...... .... 0111 . . . 1 .... @2reg_shl_h VQSHL_S_2sh 1111 001 0 1 . ...... .... 0111 . . . 1 .... @2reg_shl_b -VQSHL_U_64_2sh 1111 001 1 1 . ...... .... 0111 . . . 1 .... @2reg_shl_d +VQSHL_U_2sh 1111 001 1 1 . ...... .... 0111 . . . 1 .... @2reg_shl_d VQSHL_U_2sh 1111 001 1 1 . ...... .... 0111 . . . 1 .... @2reg_shl_s VQSHL_U_2sh 1111 001 1 1 . ...... .... 0111 . . . 1 .... @2reg_shl_h VQSHL_U_2sh 1111 001 1 1 . ...... .... 0111 . . . 1 .... @2reg_shl_b diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 3abdc572022..f652520b652 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -1313,6 +1313,42 @@ void gen_neon_uqrshl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, opr_sz, max_sz, 0, fns[vece]); } +void gen_neon_sqshli(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + int64_t c, uint32_t opr_sz, uint32_t max_sz) +{ + static gen_helper_gvec_2_ptr * const fns[] = { + gen_helper_neon_sqshli_b, gen_helper_neon_sqshli_h, + gen_helper_neon_sqshli_s, gen_helper_neon_sqshli_d, + }; + tcg_debug_assert(vece <= MO_64); + tcg_debug_assert(c >= 0 && c <= (8 << vece)); + tcg_gen_gvec_2_ptr(rd_ofs, rn_ofs, tcg_env, opr_sz, max_sz, c, fns[vece]); +} + +void gen_neon_uqshli(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + int64_t c, uint32_t opr_sz, uint32_t max_sz) +{ + static gen_helper_gvec_2_ptr * const fns[] = { + gen_helper_neon_uqshli_b, gen_helper_neon_uqshli_h, + gen_helper_neon_uqshli_s, gen_helper_neon_uqshli_d, + }; + tcg_debug_assert(vece <= MO_64); + tcg_debug_assert(c >= 0 && c <= (8 << vece)); + tcg_gen_gvec_2_ptr(rd_ofs, rn_ofs, tcg_env, opr_sz, max_sz, c, fns[vece]); +} + +void gen_neon_sqshlui(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + int64_t c, uint32_t opr_sz, uint32_t max_sz) +{ + static gen_helper_gvec_2_ptr * const fns[] = { + gen_helper_neon_sqshlui_b, gen_helper_neon_sqshlui_h, + gen_helper_neon_sqshlui_s, gen_helper_neon_sqshlui_d, + }; + tcg_debug_assert(vece <= MO_64); + tcg_debug_assert(c >= 0 && c <= (8 << vece)); + tcg_gen_gvec_2_ptr(rd_ofs, rn_ofs, tcg_env, opr_sz, max_sz, c, fns[vece]); +} + void gen_uqadd_bhs(TCGv_i64 res, TCGv_i64 qc, TCGv_i64 a, TCGv_i64 b, MemOp esz) { uint64_t max = MAKE_64BIT_MASK(0, 8 << esz); diff --git a/target/arm/tcg/neon_helper.c b/target/arm/tcg/neon_helper.c index 082bfd88adf..739e16e4411 100644 --- a/target/arm/tcg/neon_helper.c +++ b/target/arm/tcg/neon_helper.c @@ -141,6 +141,19 @@ void HELPER(name)(void *vd, void *vn, void *vm, void *venv, uint32_t desc) \ clear_tail(d, opr_sz, simd_maxsz(desc)); \ } +#define NEON_GVEC_VOP2i_ENV(name, vtype) \ +void HELPER(name)(void *vd, void *vn, void *venv, uint32_t desc) \ +{ \ + intptr_t i, opr_sz = simd_oprsz(desc); \ + int imm = simd_data(desc); \ + vtype *d = vd, *n = vn; \ + CPUARMState *env = venv; \ + for (i = 0; i < opr_sz / sizeof(vtype); i++) { \ + NEON_FN(d[i], n[i], imm); \ + } \ + clear_tail(d, opr_sz, simd_maxsz(desc)); \ +} + /* Pairwise operations. */ /* For 32-bit elements each segment only contains a single element, so the elementwise and pairwise operations are the same. */ @@ -271,22 +284,26 @@ uint64_t HELPER(neon_rshl_u64)(uint64_t val, uint64_t shift) (dest = do_uqrshl_bhs(src1, (int8_t)src2, 8, false, env->vfp.qc)) NEON_VOP_ENV(qshl_u8, neon_u8, 4) NEON_GVEC_VOP2_ENV(neon_uqshl_b, uint8_t) +NEON_GVEC_VOP2i_ENV(neon_uqshli_b, uint8_t) #undef NEON_FN #define NEON_FN(dest, src1, src2) \ (dest = do_uqrshl_bhs(src1, (int8_t)src2, 16, false, env->vfp.qc)) NEON_VOP_ENV(qshl_u16, neon_u16, 2) NEON_GVEC_VOP2_ENV(neon_uqshl_h, uint16_t) +NEON_GVEC_VOP2i_ENV(neon_uqshli_h, uint16_t) #undef NEON_FN #define NEON_FN(dest, src1, src2) \ (dest = do_uqrshl_bhs(src1, (int8_t)src2, 32, false, env->vfp.qc)) NEON_GVEC_VOP2_ENV(neon_uqshl_s, uint32_t) +NEON_GVEC_VOP2i_ENV(neon_uqshli_s, uint32_t) #undef NEON_FN #define NEON_FN(dest, src1, src2) \ (dest = do_uqrshl_d(src1, (int8_t)src2, false, env->vfp.qc)) NEON_GVEC_VOP2_ENV(neon_uqshl_d, uint64_t) +NEON_GVEC_VOP2i_ENV(neon_uqshli_d, uint64_t) #undef NEON_FN uint32_t HELPER(neon_qshl_u32)(CPUARMState *env, uint32_t val, uint32_t shift) @@ -303,22 +320,26 @@ uint64_t HELPER(neon_qshl_u64)(CPUARMState *env, uint64_t val, uint64_t shift) (dest = do_sqrshl_bhs(src1, (int8_t)src2, 8, false, env->vfp.qc)) NEON_VOP_ENV(qshl_s8, neon_s8, 4) NEON_GVEC_VOP2_ENV(neon_sqshl_b, int8_t) +NEON_GVEC_VOP2i_ENV(neon_sqshli_b, int8_t) #undef NEON_FN #define NEON_FN(dest, src1, src2) \ (dest = do_sqrshl_bhs(src1, (int8_t)src2, 16, false, env->vfp.qc)) NEON_VOP_ENV(qshl_s16, neon_s16, 2) NEON_GVEC_VOP2_ENV(neon_sqshl_h, int16_t) +NEON_GVEC_VOP2i_ENV(neon_sqshli_h, int16_t) #undef NEON_FN #define NEON_FN(dest, src1, src2) \ (dest = do_sqrshl_bhs(src1, (int8_t)src2, 32, false, env->vfp.qc)) NEON_GVEC_VOP2_ENV(neon_sqshl_s, int32_t) +NEON_GVEC_VOP2i_ENV(neon_sqshli_s, int32_t) #undef NEON_FN #define NEON_FN(dest, src1, src2) \ (dest = do_sqrshl_d(src1, (int8_t)src2, false, env->vfp.qc)) NEON_GVEC_VOP2_ENV(neon_sqshl_d, int64_t) +NEON_GVEC_VOP2i_ENV(neon_sqshli_d, int64_t) #undef NEON_FN uint32_t HELPER(neon_qshl_s32)(CPUARMState *env, uint32_t val, uint32_t shift) @@ -334,11 +355,13 @@ uint64_t HELPER(neon_qshl_s64)(CPUARMState *env, uint64_t val, uint64_t shift) #define NEON_FN(dest, src1, src2) \ (dest = do_suqrshl_bhs(src1, (int8_t)src2, 8, false, env->vfp.qc)) NEON_VOP_ENV(qshlu_s8, neon_s8, 4) +NEON_GVEC_VOP2i_ENV(neon_sqshlui_b, int8_t) #undef NEON_FN #define NEON_FN(dest, src1, src2) \ (dest = do_suqrshl_bhs(src1, (int8_t)src2, 16, false, env->vfp.qc)) NEON_VOP_ENV(qshlu_s16, neon_s16, 2) +NEON_GVEC_VOP2i_ENV(neon_sqshlui_h, int16_t) #undef NEON_FN uint32_t HELPER(neon_qshlu_s32)(CPUARMState *env, uint32_t val, uint32_t shift) @@ -351,6 +374,16 @@ uint64_t HELPER(neon_qshlu_s64)(CPUARMState *env, uint64_t val, uint64_t shift) return do_suqrshl_d(val, (int8_t)shift, false, env->vfp.qc); } +#define NEON_FN(dest, src1, src2) \ + (dest = do_suqrshl_bhs(src1, (int8_t)src2, 32, false, env->vfp.qc)) +NEON_GVEC_VOP2i_ENV(neon_sqshlui_s, int32_t) +#undef NEON_FN + +#define NEON_FN(dest, src1, src2) \ + (dest = do_suqrshl_d(src1, (int8_t)src2, false, env->vfp.qc)) +NEON_GVEC_VOP2i_ENV(neon_sqshlui_d, int64_t) +#undef NEON_FN + #define NEON_FN(dest, src1, src2) \ (dest = do_uqrshl_bhs(src1, (int8_t)src2, 8, true, env->vfp.qc)) NEON_VOP_ENV(qrshl_u8, neon_u8, 4) diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index a31a78c3478..6dd70d1c539 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -1101,113 +1101,9 @@ DO_2SH(VRSRA_S, gen_gvec_srsra) DO_2SH(VRSRA_U, gen_gvec_ursra) DO_2SH(VSHR_S, gen_gvec_sshr) DO_2SH(VSHR_U, gen_gvec_ushr) - -static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a, - NeonGenTwo64OpEnvFn *fn) -{ - /* - * 2-reg-and-shift operations, size == 3 case, where the - * function needs to be passed tcg_env. - */ - TCGv_i64 constimm; - int pass; - - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { - return false; - } - - /* UNDEF accesses to D16-D31 if they don't exist. */ - if (!dc_isar_feature(aa32_simd_r32, s) && - ((a->vd | a->vm) & 0x10)) { - return false; - } - - if ((a->vm | a->vd) & a->q) { - return false; - } - - if (!vfp_access_check(s)) { - return true; - } - - /* - * To avoid excessive duplication of ops we implement shift - * by immediate using the variable shift operations. - */ - constimm = tcg_constant_i64(dup_const(a->size, a->shift)); - - for (pass = 0; pass < a->q + 1; pass++) { - TCGv_i64 tmp = tcg_temp_new_i64(); - - read_neon_element64(tmp, a->vm, pass, MO_64); - fn(tmp, tcg_env, tmp, constimm); - write_neon_element64(tmp, a->vd, pass, MO_64); - } - return true; -} - -static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a, - NeonGenTwoOpEnvFn *fn) -{ - /* - * 2-reg-and-shift operations, size < 3 case, where the - * helper needs to be passed tcg_env. - */ - TCGv_i32 constimm, tmp; - int pass; - - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { - return false; - } - - /* UNDEF accesses to D16-D31 if they don't exist. */ - if (!dc_isar_feature(aa32_simd_r32, s) && - ((a->vd | a->vm) & 0x10)) { - return false; - } - - if ((a->vm | a->vd) & a->q) { - return false; - } - - if (!vfp_access_check(s)) { - return true; - } - - /* - * To avoid excessive duplication of ops we implement shift - * by immediate using the variable shift operations. - */ - constimm = tcg_constant_i32(dup_const(a->size, a->shift)); - tmp = tcg_temp_new_i32(); - - for (pass = 0; pass < (a->q ? 4 : 2); pass++) { - read_neon_element32(tmp, a->vm, pass, MO_32); - fn(tmp, tcg_env, tmp, constimm); - write_neon_element32(tmp, a->vd, pass, MO_32); - } - return true; -} - -#define DO_2SHIFT_ENV(INSN, FUNC) \ - static bool trans_##INSN##_64_2sh(DisasContext *s, arg_2reg_shift *a) \ - { \ - return do_2shift_env_64(s, a, gen_helper_neon_##FUNC##64); \ - } \ - static bool trans_##INSN##_2sh(DisasContext *s, arg_2reg_shift *a) \ - { \ - static NeonGenTwoOpEnvFn * const fns[] = { \ - gen_helper_neon_##FUNC##8, \ - gen_helper_neon_##FUNC##16, \ - gen_helper_neon_##FUNC##32, \ - }; \ - assert(a->size < ARRAY_SIZE(fns)); \ - return do_2shift_env_32(s, a, fns[a->size]); \ - } - -DO_2SHIFT_ENV(VQSHLU, qshlu_s) -DO_2SHIFT_ENV(VQSHL_U, qshl_u) -DO_2SHIFT_ENV(VQSHL_S, qshl_s) +DO_2SH(VQSHLU, gen_neon_sqshlui) +DO_2SH(VQSHL_U, gen_neon_uqshli) +DO_2SH(VQSHL_S, gen_neon_sqshli) static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, NeonGenTwo64OpFn *shiftfn, From patchwork Thu Sep 19 13:10:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829635 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320727wrn; Thu, 19 Sep 2024 06:20:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXS3Kxs+OYb537Z8vgNm1Er8BDuWyWJoJJrb+gTbBgG5hLstbg66NKlJpWvEG4F29ZEAMpUJQ==@linaro.org X-Google-Smtp-Source: AGHT+IEC17mAJfBDd+xk5YrbBdLB5LMsz7IcvG509r3yRDwJQ2EWIHywVVgYZJ69z9Di93HEMePK X-Received: by 2002:ac8:7f0f:0:b0:451:d859:202d with SMTP id d75a77b69052e-4599d2ba36cmr339612791cf.54.1726752028046; Thu, 19 Sep 2024 06:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726752028; cv=none; d=google.com; s=arc-20240605; b=R50sgjOLSV9dWMGMCjCXFy8GNNnX2Q95iQgS3cwj3Us04UkMe4FIhBbtveAokN/QWU Zi0AsoE+3aBBqWZ41b4qjEU05gQ27uOcUKBozRgjouiP4L9191GexWzi4TI0NGAgcFD5 RtfXu36nYS8USPf+Ukd9lPPe03NyPZ6KpAlfG4iWHjgKoNYH3SYT2ChXGha7t0SkPrf5 m4l0jz4I1OjpTf+7d3emNEyTGerrwIcYX6scEUTs8MAWkFhE5HbG/xT/d+ahoSLxmqJ/ GWTQtxxFwBZMTcTHTXmLLEE4w2+YQwxjtf9W63cJxSZn/pFHwYwnRJL1kF0aKdxD2HPa pE2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=fMVTkS6JZktWRMeERzzPscqVkFhjmgzyPEGQWzW6mPU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=GmrKtcG+Ysze/ccc/U0gJ07vn5P1fdzv+t9cKcbdhxrraSC7aby0fiF6q0pjVwbZAi KCL+x3FTCvHeawXG5eoOvs1x6YzzF/CPhMMYRz2IZ9A9l9KK+t0JOpJoEae0fomsOf90 npWjfGcpYw+aBa6usVyeeuZSehjTLNR6lDtA9Dn7cEgKDN7k7TyaXrig0JCoxe8A0yU7 iEtV5A8EhjUZDkK9l/p9/LpNiCKjwRWomxoeEIX0NnHJKbpin+cK6NB0W6wURykeVHpA aXTleUza9Oc67+vIwoigD1PfjxBjjPyF7IRW4aX62l6W0bVYVc6JKg4znkJINBhCCdZV qNJg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wCES+RQw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45b17914fbbsi17999951cf.446.2024.09.19.06.20.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:20:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wCES+RQw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwm-0006JG-1D; Thu, 19 Sep 2024 09:11:48 -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 1srGwV-0005OR-Hz for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwQ-00013v-Nh for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:31 -0400 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2f7ba97ebaaso7105531fa.2 for ; Thu, 19 Sep 2024 06:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751483; x=1727356283; 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=fMVTkS6JZktWRMeERzzPscqVkFhjmgzyPEGQWzW6mPU=; b=wCES+RQwcCNMI5XP8cm91IL7/uMzcYtsZcrfxrs1qNq09TLgzMGnPh9Z4vAf5Vd31v UQ7kbe5kVOhahodDby5biPYV1bDNFC0gMCbP3gZFQsXPQbog+Z/v6VPeDFwMRHknr3Ok 5cJHtsd/OGALaZfkzR3r/fhtdbvO8ADLUuplb838yK7wtbw1NNvIwQ3qFut7hLOQExqI 8TQpWS+kmOcssXaY3O8IvXI/PQXktqGFMXFWPNgkaqbBayVIgb7c4JZu1ShQLE/tCio+ uH07rwaS6HIIeiwbbeTVPj2OK7vW5mkbNcQcKx/Rxhkvy0Qi7xjalnhlRwZddfcoJ9Me b+LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751483; x=1727356283; 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=fMVTkS6JZktWRMeERzzPscqVkFhjmgzyPEGQWzW6mPU=; b=wBtbxw17lgFRlbxaBtm2g08PVcc85pxF36QdcTwygRaLeta4+7hIE+jkfu/EloT6o/ iqvFx7ssbOVEKBPN7Fp4Vd3OfeEqbQKo4RAKqOcAH66e0C+HD8H1IQHnTW2TpTfAI/An /3HlgTK9xvchkuAUjUk3HAol2KHiEv12ocrwIVJRqyICctnnrumsEhAqkJCchLEv1I5w 4uh7htzCxlEgETOPqk4XFNOoK1TqdSwkT9yzwhXatYEbrQbCGHbwR9uC0E3fLbfJdDoY tbXScSoDy57XJhM+uXwPAmsDlhS5WdTm1t+U8sxokMqy2LhyuesfLakZPHPA7uFE7l3M QE4A== X-Gm-Message-State: AOJu0Yy+Q+VrKaSm74/41MzgGSEnsLvPvoh4y50HCe1gB3LQ9n+siViW Tt94ERmc1Lu8gXGYk8okqMmpHmuko6LhzX+aopGh0YlDZhOZnMQlmSBPe+A0VnFML/briIzJ1uH 9 X-Received: by 2002:a2e:be22:0:b0:2f7:663c:48d7 with SMTP id 38308e7fff4ca-2f787f44965mr154879771fa.39.1726751483206; Thu, 19 Sep 2024 06:11:23 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:22 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/38] target/arm: Widen NeonGenNarrowEnvFn return to 64 bits Date: Thu, 19 Sep 2024 14:10:54 +0100 Message-Id: <20240919131106.3362543-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x236.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson While these functions really do return a 32-bit value, widening the return type means that we need do less marshalling between TCG types. Remove NeonGenNarrowEnvFn typedef; add NeonGenOne64OpEnvFn. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-id: 20240912024114.1097832-27-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.h | 22 ++++++------ target/arm/tcg/translate.h | 2 +- target/arm/tcg/neon_helper.c | 43 ++++++++++++++--------- target/arm/tcg/translate-a64.c | 60 ++++++++++++++++++--------------- target/arm/tcg/translate-neon.c | 44 ++++++++++++------------ 5 files changed, 93 insertions(+), 78 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index b40589d329f..58919b670ef 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -375,17 +375,17 @@ DEF_HELPER_3(neon_qrdmulh_s32, i32, env, i32, i32) DEF_HELPER_4(neon_qrdmlah_s32, i32, env, s32, s32, s32) DEF_HELPER_4(neon_qrdmlsh_s32, i32, env, s32, s32, s32) -DEF_HELPER_1(neon_narrow_u8, i32, i64) -DEF_HELPER_1(neon_narrow_u16, i32, i64) -DEF_HELPER_2(neon_unarrow_sat8, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_u8, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_s8, i32, env, i64) -DEF_HELPER_2(neon_unarrow_sat16, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_u16, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_s16, i32, env, i64) -DEF_HELPER_2(neon_unarrow_sat32, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_u32, i32, env, i64) -DEF_HELPER_2(neon_narrow_sat_s32, i32, env, i64) +DEF_HELPER_1(neon_narrow_u8, i64, i64) +DEF_HELPER_1(neon_narrow_u16, i64, i64) +DEF_HELPER_2(neon_unarrow_sat8, i64, env, i64) +DEF_HELPER_2(neon_narrow_sat_u8, i64, env, i64) +DEF_HELPER_2(neon_narrow_sat_s8, i64, env, i64) +DEF_HELPER_2(neon_unarrow_sat16, i64, env, i64) +DEF_HELPER_2(neon_narrow_sat_u16, i64, env, i64) +DEF_HELPER_2(neon_narrow_sat_s16, i64, env, i64) +DEF_HELPER_2(neon_unarrow_sat32, i64, env, i64) +DEF_HELPER_2(neon_narrow_sat_u32, i64, env, i64) +DEF_HELPER_2(neon_narrow_sat_s32, i64, env, i64) DEF_HELPER_1(neon_narrow_high_u8, i32, i64) DEF_HELPER_1(neon_narrow_high_u16, i32, i64) DEF_HELPER_1(neon_narrow_round_high_u8, i32, i64) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 7721c627e9d..5a2e10d64d5 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -605,13 +605,13 @@ typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32, typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); -typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); typedef void NeonGenTwoOpWidenFn(TCGv_i64, TCGv_i32, TCGv_i32); typedef void NeonGenOneSingleOpFn(TCGv_i32, TCGv_i32, TCGv_ptr); typedef void NeonGenTwoSingleOpFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); typedef void NeonGenTwoDoubleOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); typedef void NeonGenOne64OpFn(TCGv_i64, TCGv_i64); +typedef void NeonGenOne64OpEnvFn(TCGv_i64, TCGv_env, TCGv_i64); typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); diff --git a/target/arm/tcg/neon_helper.c b/target/arm/tcg/neon_helper.c index 739e16e4411..93b2076c64f 100644 --- a/target/arm/tcg/neon_helper.c +++ b/target/arm/tcg/neon_helper.c @@ -598,13 +598,15 @@ NEON_VOP_ENV(qrdmulh_s32, neon_s32, 1) #undef NEON_FN #undef NEON_QDMULH32 -uint32_t HELPER(neon_narrow_u8)(uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_narrow_u8)(uint64_t x) { return (x & 0xffu) | ((x >> 8) & 0xff00u) | ((x >> 16) & 0xff0000u) | ((x >> 24) & 0xff000000u); } -uint32_t HELPER(neon_narrow_u16)(uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_narrow_u16)(uint64_t x) { return (x & 0xffffu) | ((x >> 16) & 0xffff0000u); } @@ -635,7 +637,8 @@ uint32_t HELPER(neon_narrow_round_high_u16)(uint64_t x) return ((x >> 16) & 0xffff) | ((x >> 32) & 0xffff0000); } -uint32_t HELPER(neon_unarrow_sat8)(CPUARMState *env, uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_unarrow_sat8)(CPUARMState *env, uint64_t x) { uint16_t s; uint8_t d; @@ -662,7 +665,8 @@ uint32_t HELPER(neon_unarrow_sat8)(CPUARMState *env, uint64_t x) return res; } -uint32_t HELPER(neon_narrow_sat_u8)(CPUARMState *env, uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_narrow_sat_u8)(CPUARMState *env, uint64_t x) { uint16_t s; uint8_t d; @@ -685,7 +689,8 @@ uint32_t HELPER(neon_narrow_sat_u8)(CPUARMState *env, uint64_t x) return res; } -uint32_t HELPER(neon_narrow_sat_s8)(CPUARMState *env, uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_narrow_sat_s8)(CPUARMState *env, uint64_t x) { int16_t s; uint8_t d; @@ -708,7 +713,8 @@ uint32_t HELPER(neon_narrow_sat_s8)(CPUARMState *env, uint64_t x) return res; } -uint32_t HELPER(neon_unarrow_sat16)(CPUARMState *env, uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_unarrow_sat16)(CPUARMState *env, uint64_t x) { uint32_t high; uint32_t low; @@ -728,10 +734,11 @@ uint32_t HELPER(neon_unarrow_sat16)(CPUARMState *env, uint64_t x) high = 0xffff; SET_QC(); } - return low | (high << 16); + return deposit32(low, 16, 16, high); } -uint32_t HELPER(neon_narrow_sat_u16)(CPUARMState *env, uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_narrow_sat_u16)(CPUARMState *env, uint64_t x) { uint32_t high; uint32_t low; @@ -745,10 +752,11 @@ uint32_t HELPER(neon_narrow_sat_u16)(CPUARMState *env, uint64_t x) high = 0xffff; SET_QC(); } - return low | (high << 16); + return deposit32(low, 16, 16, high); } -uint32_t HELPER(neon_narrow_sat_s16)(CPUARMState *env, uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_narrow_sat_s16)(CPUARMState *env, uint64_t x) { int32_t low; int32_t high; @@ -762,10 +770,11 @@ uint32_t HELPER(neon_narrow_sat_s16)(CPUARMState *env, uint64_t x) high = (high >> 31) ^ 0x7fff; SET_QC(); } - return (uint16_t)low | (high << 16); + return deposit32(low, 16, 16, high); } -uint32_t HELPER(neon_unarrow_sat32)(CPUARMState *env, uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_unarrow_sat32)(CPUARMState *env, uint64_t x) { if (x & 0x8000000000000000ull) { SET_QC(); @@ -778,7 +787,8 @@ uint32_t HELPER(neon_unarrow_sat32)(CPUARMState *env, uint64_t x) return x; } -uint32_t HELPER(neon_narrow_sat_u32)(CPUARMState *env, uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_narrow_sat_u32)(CPUARMState *env, uint64_t x) { if (x > 0xffffffffu) { SET_QC(); @@ -787,13 +797,14 @@ uint32_t HELPER(neon_narrow_sat_u32)(CPUARMState *env, uint64_t x) return x; } -uint32_t HELPER(neon_narrow_sat_s32)(CPUARMState *env, uint64_t x) +/* Only the low 32-bits of output are significant. */ +uint64_t HELPER(neon_narrow_sat_s32)(CPUARMState *env, uint64_t x) { if ((int64_t)x != (int32_t)x) { SET_QC(); - return ((int64_t)x >> 63) ^ 0x7fffffff; + return (uint32_t)((int64_t)x >> 63) ^ 0x7fffffff; } - return x; + return (uint32_t)x; } uint64_t HELPER(neon_widen_u8)(uint32_t x) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 934746d2f2c..7918720d9b0 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9439,11 +9439,9 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, int elements = is_scalar ? 1 : (64 / esize); bool round = extract32(opcode, 0, 1); MemOp ldop = (size + 1) | (is_u_shift ? 0 : MO_SIGN); - TCGv_i64 tcg_rn, tcg_rd; - TCGv_i32 tcg_rd_narrowed; - TCGv_i64 tcg_final; + TCGv_i64 tcg_rn, tcg_rd, tcg_final; - static NeonGenNarrowEnvFn * const signed_narrow_fns[4][2] = { + static NeonGenOne64OpEnvFn * const signed_narrow_fns[4][2] = { { gen_helper_neon_narrow_sat_s8, gen_helper_neon_unarrow_sat8 }, { gen_helper_neon_narrow_sat_s16, @@ -9452,13 +9450,13 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, gen_helper_neon_unarrow_sat32 }, { NULL, NULL }, }; - static NeonGenNarrowEnvFn * const unsigned_narrow_fns[4] = { + static NeonGenOne64OpEnvFn * const unsigned_narrow_fns[4] = { gen_helper_neon_narrow_sat_u8, gen_helper_neon_narrow_sat_u16, gen_helper_neon_narrow_sat_u32, NULL }; - NeonGenNarrowEnvFn *narrowfn; + NeonGenOne64OpEnvFn *narrowfn; int i; @@ -9481,15 +9479,13 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, tcg_rn = tcg_temp_new_i64(); tcg_rd = tcg_temp_new_i64(); - tcg_rd_narrowed = tcg_temp_new_i32(); tcg_final = tcg_temp_new_i64(); for (i = 0; i < elements; i++) { read_vec_element(s, tcg_rn, rn, i, ldop); handle_shri_with_rndacc(tcg_rd, tcg_rn, round, false, is_u_shift, size+1, shift); - narrowfn(tcg_rd_narrowed, tcg_env, tcg_rd); - tcg_gen_extu_i32_i64(tcg_rd, tcg_rd_narrowed); + narrowfn(tcg_rd, tcg_env, tcg_rd); if (i == 0) { tcg_gen_extract_i64(tcg_final, tcg_rd, 0, esize); } else { @@ -10228,35 +10224,35 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, * in the source becomes a size element in the destination). */ int pass; - TCGv_i32 tcg_res[2]; + TCGv_i64 tcg_res[2]; int destelt = is_q ? 2 : 0; int passes = scalar ? 1 : 2; if (scalar) { - tcg_res[1] = tcg_constant_i32(0); + tcg_res[1] = tcg_constant_i64(0); } for (pass = 0; pass < passes; pass++) { TCGv_i64 tcg_op = tcg_temp_new_i64(); - NeonGenNarrowFn *genfn = NULL; - NeonGenNarrowEnvFn *genenvfn = NULL; + NeonGenOne64OpFn *genfn = NULL; + NeonGenOne64OpEnvFn *genenvfn = NULL; if (scalar) { read_vec_element(s, tcg_op, rn, pass, size + 1); } else { read_vec_element(s, tcg_op, rn, pass, MO_64); } - tcg_res[pass] = tcg_temp_new_i32(); + tcg_res[pass] = tcg_temp_new_i64(); switch (opcode) { case 0x12: /* XTN, SQXTUN */ { - static NeonGenNarrowFn * const xtnfns[3] = { + static NeonGenOne64OpFn * const xtnfns[3] = { gen_helper_neon_narrow_u8, gen_helper_neon_narrow_u16, - tcg_gen_extrl_i64_i32, + tcg_gen_ext32u_i64, }; - static NeonGenNarrowEnvFn * const sqxtunfns[3] = { + static NeonGenOne64OpEnvFn * const sqxtunfns[3] = { gen_helper_neon_unarrow_sat8, gen_helper_neon_unarrow_sat16, gen_helper_neon_unarrow_sat32, @@ -10270,7 +10266,7 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, } case 0x14: /* SQXTN, UQXTN */ { - static NeonGenNarrowEnvFn * const fns[3][2] = { + static NeonGenOne64OpEnvFn * const fns[3][2] = { { gen_helper_neon_narrow_sat_s8, gen_helper_neon_narrow_sat_u8 }, { gen_helper_neon_narrow_sat_s16, @@ -10284,7 +10280,9 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, case 0x16: /* FCVTN, FCVTN2 */ /* 32 bit to 16 bit or 64 bit to 32 bit float conversion */ if (size == 2) { - gen_helper_vfp_fcvtsd(tcg_res[pass], tcg_op, tcg_env); + TCGv_i32 tmp = tcg_temp_new_i32(); + gen_helper_vfp_fcvtsd(tmp, tcg_op, tcg_env); + tcg_gen_extu_i32_i64(tcg_res[pass], tmp); } else { TCGv_i32 tcg_lo = tcg_temp_new_i32(); TCGv_i32 tcg_hi = tcg_temp_new_i32(); @@ -10294,21 +10292,29 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, tcg_gen_extr_i64_i32(tcg_lo, tcg_hi, tcg_op); gen_helper_vfp_fcvt_f32_to_f16(tcg_lo, tcg_lo, fpst, ahp); gen_helper_vfp_fcvt_f32_to_f16(tcg_hi, tcg_hi, fpst, ahp); - tcg_gen_deposit_i32(tcg_res[pass], tcg_lo, tcg_hi, 16, 16); + tcg_gen_deposit_i32(tcg_lo, tcg_lo, tcg_hi, 16, 16); + tcg_gen_extu_i32_i64(tcg_res[pass], tcg_lo); } break; case 0x36: /* BFCVTN, BFCVTN2 */ { TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); - gen_helper_bfcvt_pair(tcg_res[pass], tcg_op, fpst); + TCGv_i32 tmp = tcg_temp_new_i32(); + gen_helper_bfcvt_pair(tmp, tcg_op, fpst); + tcg_gen_extu_i32_i64(tcg_res[pass], tmp); } break; case 0x56: /* FCVTXN, FCVTXN2 */ - /* 64 bit to 32 bit float conversion - * with von Neumann rounding (round to odd) - */ - assert(size == 2); - gen_helper_fcvtx_f64_to_f32(tcg_res[pass], tcg_op, tcg_env); + { + /* + * 64 bit to 32 bit float conversion + * with von Neumann rounding (round to odd) + */ + TCGv_i32 tmp = tcg_temp_new_i32(); + assert(size == 2); + gen_helper_fcvtx_f64_to_f32(tmp, tcg_op, tcg_env); + tcg_gen_extu_i32_i64(tcg_res[pass], tmp); + } break; default: g_assert_not_reached(); @@ -10322,7 +10328,7 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, } for (pass = 0; pass < 2; pass++) { - write_vec_element_i32(s, tcg_res[pass], rd, destelt + pass, MO_32); + write_vec_element(s, tcg_res[pass], rd, destelt + pass, MO_32); } clear_vec_high(s, is_q, rd); } diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 6dd70d1c539..9c8829ad7d2 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -1107,11 +1107,10 @@ DO_2SH(VQSHL_S, gen_neon_sqshli) static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, NeonGenTwo64OpFn *shiftfn, - NeonGenNarrowEnvFn *narrowfn) + NeonGenOne64OpEnvFn *narrowfn) { /* 2-reg-and-shift narrowing-shift operations, size == 3 case */ - TCGv_i64 constimm, rm1, rm2; - TCGv_i32 rd; + TCGv_i64 constimm, rm1, rm2, rd; if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { return false; @@ -1138,7 +1137,7 @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, constimm = tcg_constant_i64(-a->shift); rm1 = tcg_temp_new_i64(); rm2 = tcg_temp_new_i64(); - rd = tcg_temp_new_i32(); + rd = tcg_temp_new_i64(); /* Load both inputs first to avoid potential overwrite if rm == rd */ read_neon_element64(rm1, a->vm, 0, MO_64); @@ -1146,18 +1145,18 @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, shiftfn(rm1, rm1, constimm); narrowfn(rd, tcg_env, rm1); - write_neon_element32(rd, a->vd, 0, MO_32); + write_neon_element64(rd, a->vd, 0, MO_32); shiftfn(rm2, rm2, constimm); narrowfn(rd, tcg_env, rm2); - write_neon_element32(rd, a->vd, 1, MO_32); + write_neon_element64(rd, a->vd, 1, MO_32); return true; } static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, NeonGenTwoOpFn *shiftfn, - NeonGenNarrowEnvFn *narrowfn) + NeonGenOne64OpEnvFn *narrowfn) { /* 2-reg-and-shift narrowing-shift operations, size < 3 case */ TCGv_i32 constimm, rm1, rm2, rm3, rm4; @@ -1212,16 +1211,16 @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, tcg_gen_concat_i32_i64(rtmp, rm1, rm2); - narrowfn(rm1, tcg_env, rtmp); - write_neon_element32(rm1, a->vd, 0, MO_32); + narrowfn(rtmp, tcg_env, rtmp); + write_neon_element64(rtmp, a->vd, 0, MO_32); shiftfn(rm3, rm3, constimm); shiftfn(rm4, rm4, constimm); tcg_gen_concat_i32_i64(rtmp, rm3, rm4); - narrowfn(rm3, tcg_env, rtmp); - write_neon_element32(rm3, a->vd, 1, MO_32); + narrowfn(rtmp, tcg_env, rtmp); + write_neon_element64(rtmp, a->vd, 1, MO_32); return true; } @@ -1236,17 +1235,17 @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, return do_2shift_narrow_32(s, a, FUNC, NARROWFUNC); \ } -static void gen_neon_narrow_u32(TCGv_i32 dest, TCGv_ptr env, TCGv_i64 src) +static void gen_neon_narrow_u32(TCGv_i64 dest, TCGv_ptr env, TCGv_i64 src) { - tcg_gen_extrl_i64_i32(dest, src); + tcg_gen_ext32u_i64(dest, src); } -static void gen_neon_narrow_u16(TCGv_i32 dest, TCGv_ptr env, TCGv_i64 src) +static void gen_neon_narrow_u16(TCGv_i64 dest, TCGv_ptr env, TCGv_i64 src) { gen_helper_neon_narrow_u16(dest, src); } -static void gen_neon_narrow_u8(TCGv_i32 dest, TCGv_ptr env, TCGv_i64 src) +static void gen_neon_narrow_u8(TCGv_i64 dest, TCGv_ptr env, TCGv_i64 src) { gen_helper_neon_narrow_u8(dest, src); } @@ -2837,10 +2836,9 @@ static bool trans_VZIP(DisasContext *s, arg_2misc *a) } static bool do_vmovn(DisasContext *s, arg_2misc *a, - NeonGenNarrowEnvFn *narrowfn) + NeonGenOne64OpEnvFn *narrowfn) { - TCGv_i64 rm; - TCGv_i32 rd0, rd1; + TCGv_i64 rm, rd0, rd1; if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { return false; @@ -2865,22 +2863,22 @@ static bool do_vmovn(DisasContext *s, arg_2misc *a, } rm = tcg_temp_new_i64(); - rd0 = tcg_temp_new_i32(); - rd1 = tcg_temp_new_i32(); + rd0 = tcg_temp_new_i64(); + rd1 = tcg_temp_new_i64(); read_neon_element64(rm, a->vm, 0, MO_64); narrowfn(rd0, tcg_env, rm); read_neon_element64(rm, a->vm, 1, MO_64); narrowfn(rd1, tcg_env, rm); - write_neon_element32(rd0, a->vd, 0, MO_32); - write_neon_element32(rd1, a->vd, 1, MO_32); + write_neon_element64(rd0, a->vd, 0, MO_32); + write_neon_element64(rd1, a->vd, 1, MO_32); return true; } #define DO_VMOVN(INSN, FUNC) \ static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ { \ - static NeonGenNarrowEnvFn * const narrowfn[] = { \ + static NeonGenOne64OpEnvFn * const narrowfn[] = { \ FUNC##8, \ FUNC##16, \ FUNC##32, \ From patchwork Thu Sep 19 13:10:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829606 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316896wrn; Thu, 19 Sep 2024 06:13:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU63Nw03+oMW1ITADEOE/W3H/pl0eMjkVDqF9vts+FnQv1/o1DBaqggrnkmRAGc5GJ3GiSuzQ==@linaro.org X-Google-Smtp-Source: AGHT+IGB0Vm7PtoYHQueGtcA9r8Ull+PpIsC8d5iZ420FguWUY6y1v0GEYyzXLUQT0aRUDSP0mNR X-Received: by 2002:a05:6358:d0e:b0:1b8:32b5:4e90 with SMTP id e5c5f4694b2df-1bc39688315mr527184955d.27.1726751600353; Thu, 19 Sep 2024 06:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751600; cv=none; d=google.com; s=arc-20240605; b=B5sODhl/Hm6/4dHpt5xKkjd23TSACskO7IhPlEUsqlxpzqayvHThi7ZNvkMuV42TVm sO8v66fpVBl7nZ8YXvKBxoFQ907raGT5TZRPdBS3h0J4DpQWR9KhHTc2H+IukoYFVuWM /JTTDUGFuPPIgFe3gC7aWxGNo4sNiZY7p2C7JHVz10128usYUB9bQUG1QKoAjI0ykUu2 61IMzkceJW7sXztECVMw3SqNWI6+OanWUHJ9OfrWA2Hf122ytdN+jnnQW+gJrSS1nMns qDbVjqzlZe9RkV9+QShyEL4S8pxf/O1rnVZkxyVFrLHHZFfMsk7pLtRgFtVkOQyNv7iA FB9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wY+6Wzf1rUpv4L8A+yggR6ArSeO7x3xvS/bCz9HnCdY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ZVDChxepL9byMpZffv22dSVPve78QZNrLRDoMAeIN0ukO00KVWrlTkpx2bbolgbptO USdZokaOMpwNMZCNgHEIZ2LASE+IbuKl/2bv4z1b6Z3GRj4Fpm45BvrW8Tw5HfIiU9PL OkWcGAP9WdRug/hwRIsoF8+s1uf9jTJOWrj98Aa8uzHZHridUbr5AlmabZ4hKSvO8J04 wJ91mnNGAjv3SjnVVpA06wmyghGs/Am/LJCVDZuOJU4Su4qjRFBUM/aNgcddL+8pbTiK J4CWAcOa5dNCkXhwEM7GCdm+CAen1fbuTTZ4iw2OOj1apelntt0l0xQ/jcRfYVK2/kat danA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y46xasJa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5035b929159si2239268e0c.56.2024.09.19.06.13.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:13:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y46xasJa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwu-0006oq-8R; Thu, 19 Sep 2024 09:11:56 -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 1srGwV-0005N0-6R for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwQ-000141-Mm for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:29 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-42cbe624c59so7157915e9.3 for ; Thu, 19 Sep 2024 06:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751484; x=1727356284; 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=wY+6Wzf1rUpv4L8A+yggR6ArSeO7x3xvS/bCz9HnCdY=; b=Y46xasJaVYU+QtyI101rBqg/xiKZWcLz9ZKuYSzFfoghyM5mIVGHLUJhk6jYaZmBYA +dv9vjwO8sm1pAkLDhQ/lW6VrBigDdPy1awBQA2Sf176/NYfaiLryMuQpyallcH99sWa 5xDGcb6NZ1MsxlUiUYrjwpivThzqxlWGSx2qFUDF7v8U92uZXHReKslk/Q0FlY+kk+8j K19ogT2dsWR8zD5d/E1i77qTUNh9EsxrAH487G33ypwS7TJhAQORDFU21QriPSkH+XF3 n98h1F76G3m0lhG58yr45k1Jfw+HqWVm8XvQrVAPj3+BBQTSm5XwrlV5WHnnsFBK+k2q 0MHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751484; x=1727356284; 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=wY+6Wzf1rUpv4L8A+yggR6ArSeO7x3xvS/bCz9HnCdY=; b=X58B9M8h6ma2N6A1NlGvbkA542KKh0GETeuxQ7qvxh8RcR7ikIqLs+qO95/g1XlZ4z NKQOogGh3yjwe3+rmWlyCzoPIbWAhx9y1u02ACRt8p7FlrHRQ56qfpQm6tlPtCrbgPOX I7o/fxW7rcshFcFRy8yymqFUZYp4CfmA5SbXNXgh9kpfClDm8HJJpcrM5qO8rRFeni40 CRt9E6VKmWOSuifK4XVnH6xPLgI2uCucOXH+pMHcTaoVCFAlEEl5ZyaUXIwrUQMw2nS9 azClHe/Hc1pbkxkT8gWhuOkt2E5XA3PY5EzA3SDW5O5p8eaaKd8NLiyNOYBzJxczdRKp 1nng== X-Gm-Message-State: AOJu0Yx4ucndfPxniLNDRzIJXPhP61P+BtZ6PcyVZ/HKmDIR2/1AkCsD Nx8Qd/TC3fM6oSQKB0X7hQvtwRhmQQ5GyYlfCPJxUaQxKrFkgxrMod6oLK/wkWi6GxnjPWVBF57 Q X-Received: by 2002:a05:600c:4746:b0:426:51ce:bb14 with SMTP id 5b1f17b1804b1-42d964f3612mr153557325e9.30.1726751483801; Thu, 19 Sep 2024 06:11:23 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:23 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/38] target/arm: Convert SQSHL, UQSHL, SQSHLU (immediate) to decodetree Date: Thu, 19 Sep 2024 14:10:55 +0100 Message-Id: <20240919131106.3362543-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-28-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 36 +++++- target/arm/tcg/translate-a64.c | 223 ++++++++++++++------------------- 2 files changed, 128 insertions(+), 131 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 96803fe6e4c..63e04ddfcde 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1287,11 +1287,30 @@ RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_b RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_h RSHRN_v 0.00 11110 .... ... 10001 1 ..... ..... @q_shri_s +SQSHL_vi 0.00 11110 .... ... 01110 1 ..... ..... @q_shli_b +SQSHL_vi 0.00 11110 .... ... 01110 1 ..... ..... @q_shli_h +SQSHL_vi 0.00 11110 .... ... 01110 1 ..... ..... @q_shli_s +SQSHL_vi 0.00 11110 .... ... 01110 1 ..... ..... @q_shli_d + +UQSHL_vi 0.10 11110 .... ... 01110 1 ..... ..... @q_shli_b +UQSHL_vi 0.10 11110 .... ... 01110 1 ..... ..... @q_shli_h +UQSHL_vi 0.10 11110 .... ... 01110 1 ..... ..... @q_shli_s +UQSHL_vi 0.10 11110 .... ... 01110 1 ..... ..... @q_shli_d + +SQSHLU_vi 0.10 11110 .... ... 01100 1 ..... ..... @q_shli_b +SQSHLU_vi 0.10 11110 .... ... 01100 1 ..... ..... @q_shli_h +SQSHLU_vi 0.10 11110 .... ... 01100 1 ..... ..... @q_shli_s +SQSHLU_vi 0.10 11110 .... ... 01100 1 ..... ..... @q_shli_d + # Advanced SIMD scalar shift by immediate @shri_d .... ..... 1 ...... ..... . rn:5 rd:5 \ &rri_e esz=3 imm=%neon_rshift_i6 -@shli_d .... ..... 1 imm:6 ..... . rn:5 rd:5 &rri_e esz=3 + +@shli_b .... ..... 0001 imm:3 ..... . rn:5 rd:5 &rri_e esz=0 +@shli_h .... ..... 001 imm:4 ..... . rn:5 rd:5 &rri_e esz=1 +@shli_s .... ..... 01 imm:5 ..... . rn:5 rd:5 &rri_e esz=2 +@shli_d .... ..... 1 imm:6 ..... . rn:5 rd:5 &rri_e esz=3 SSHR_s 0101 11110 .... ... 00000 1 ..... ..... @shri_d USHR_s 0111 11110 .... ... 00000 1 ..... ..... @shri_d @@ -1305,3 +1324,18 @@ SRI_s 0111 11110 .... ... 01000 1 ..... ..... @shri_d SHL_s 0101 11110 .... ... 01010 1 ..... ..... @shli_d SLI_s 0111 11110 .... ... 01010 1 ..... ..... @shli_d + +SQSHL_si 0101 11110 .... ... 01110 1 ..... ..... @shli_b +SQSHL_si 0101 11110 .... ... 01110 1 ..... ..... @shli_h +SQSHL_si 0101 11110 .... ... 01110 1 ..... ..... @shli_s +SQSHL_si 0101 11110 .... ... 01110 1 ..... ..... @shli_d + +UQSHL_si 0111 11110 .... ... 01110 1 ..... ..... @shli_b +UQSHL_si 0111 11110 .... ... 01110 1 ..... ..... @shli_h +UQSHL_si 0111 11110 .... ... 01110 1 ..... ..... @shli_s +UQSHL_si 0111 11110 .... ... 01110 1 ..... ..... @shli_d + +SQSHLU_si 0111 11110 .... ... 01100 1 ..... ..... @shli_b +SQSHLU_si 0111 11110 .... ... 01100 1 ..... ..... @shli_h +SQSHLU_si 0111 11110 .... ... 01100 1 ..... ..... @shli_s +SQSHLU_si 0111 11110 .... ... 01100 1 ..... ..... @shli_d diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 7918720d9b0..77324e0145f 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6982,6 +6982,9 @@ TRANS(URSRA_v, do_vec_shift_imm, a, gen_gvec_ursra) TRANS(SRI_v, do_vec_shift_imm, a, gen_gvec_sri) TRANS(SHL_v, do_vec_shift_imm, a, tcg_gen_gvec_shli) TRANS(SLI_v, do_vec_shift_imm, a, gen_gvec_sli); +TRANS(SQSHL_vi, do_vec_shift_imm, a, gen_neon_sqshli) +TRANS(UQSHL_vi, do_vec_shift_imm, a, gen_neon_uqshli) +TRANS(SQSHLU_vi, do_vec_shift_imm, a, gen_neon_sqshlui) static bool do_vec_shift_imm_wide(DisasContext *s, arg_qrri_e *a, bool is_u) { @@ -7209,6 +7212,92 @@ TRANS(SRI_s, do_scalar_shift_imm, a, gen_sri_d, true, 0) TRANS(SHL_s, do_scalar_shift_imm, a, tcg_gen_shli_i64, false, 0) TRANS(SLI_s, do_scalar_shift_imm, a, gen_sli_d, true, 0) +static void trunc_i64_env_imm(TCGv_i64 d, TCGv_i64 s, int64_t i, + NeonGenTwoOpEnvFn *fn) +{ + TCGv_i32 t = tcg_temp_new_i32(); + tcg_gen_extrl_i64_i32(t, s); + fn(t, tcg_env, t, tcg_constant_i32(i)); + tcg_gen_extu_i32_i64(d, t); +} + +static void gen_sqshli_b(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + trunc_i64_env_imm(d, s, i, gen_helper_neon_qshl_s8); +} + +static void gen_sqshli_h(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + trunc_i64_env_imm(d, s, i, gen_helper_neon_qshl_s16); +} + +static void gen_sqshli_s(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + trunc_i64_env_imm(d, s, i, gen_helper_neon_qshl_s32); +} + +static void gen_sqshli_d(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_helper_neon_qshl_s64(d, tcg_env, s, tcg_constant_i64(i)); +} + +static void gen_uqshli_b(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + trunc_i64_env_imm(d, s, i, gen_helper_neon_qshl_u8); +} + +static void gen_uqshli_h(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + trunc_i64_env_imm(d, s, i, gen_helper_neon_qshl_u16); +} + +static void gen_uqshli_s(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + trunc_i64_env_imm(d, s, i, gen_helper_neon_qshl_u32); +} + +static void gen_uqshli_d(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_helper_neon_qshl_u64(d, tcg_env, s, tcg_constant_i64(i)); +} + +static void gen_sqshlui_b(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + trunc_i64_env_imm(d, s, i, gen_helper_neon_qshlu_s8); +} + +static void gen_sqshlui_h(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + trunc_i64_env_imm(d, s, i, gen_helper_neon_qshlu_s16); +} + +static void gen_sqshlui_s(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + trunc_i64_env_imm(d, s, i, gen_helper_neon_qshlu_s32); +} + +static void gen_sqshlui_d(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_helper_neon_qshlu_s64(d, tcg_env, s, tcg_constant_i64(i)); +} + +static WideShiftImmFn * const f_scalar_sqshli[] = { + gen_sqshli_b, gen_sqshli_h, gen_sqshli_s, gen_sqshli_d +}; + +static WideShiftImmFn * const f_scalar_uqshli[] = { + gen_uqshli_b, gen_uqshli_h, gen_uqshli_s, gen_uqshli_d +}; + +static WideShiftImmFn * const f_scalar_sqshlui[] = { + gen_sqshlui_b, gen_sqshlui_h, gen_sqshlui_s, gen_sqshlui_d +}; + +/* Note that the helpers sign-extend their inputs, so don't do it here. */ +TRANS(SQSHL_si, do_scalar_shift_imm, a, f_scalar_sqshli[a->esz], false, 0) +TRANS(UQSHL_si, do_scalar_shift_imm, a, f_scalar_uqshli[a->esz], false, 0) +TRANS(SQSHLU_si, do_scalar_shift_imm, a, f_scalar_sqshlui[a->esz], false, 0) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -9501,116 +9590,6 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, clear_vec_high(s, is_q, rd); } -/* SQSHLU, UQSHL, SQSHL: saturating left shifts */ -static void handle_simd_qshl(DisasContext *s, bool scalar, bool is_q, - bool src_unsigned, bool dst_unsigned, - int immh, int immb, int rn, int rd) -{ - int immhb = immh << 3 | immb; - int size = 32 - clz32(immh) - 1; - int shift = immhb - (8 << size); - int pass; - - assert(immh != 0); - assert(!(scalar && is_q)); - - if (!scalar) { - if (!is_q && extract32(immh, 3, 1)) { - unallocated_encoding(s); - return; - } - - /* Since we use the variable-shift helpers we must - * replicate the shift count into each element of - * the tcg_shift value. - */ - switch (size) { - case 0: - shift |= shift << 8; - /* fall through */ - case 1: - shift |= shift << 16; - break; - case 2: - case 3: - break; - default: - g_assert_not_reached(); - } - } - - if (!fp_access_check(s)) { - return; - } - - if (size == 3) { - TCGv_i64 tcg_shift = tcg_constant_i64(shift); - static NeonGenTwo64OpEnvFn * const fns[2][2] = { - { gen_helper_neon_qshl_s64, gen_helper_neon_qshlu_s64 }, - { NULL, gen_helper_neon_qshl_u64 }, - }; - NeonGenTwo64OpEnvFn *genfn = fns[src_unsigned][dst_unsigned]; - int maxpass = is_q ? 2 : 1; - - for (pass = 0; pass < maxpass; pass++) { - TCGv_i64 tcg_op = tcg_temp_new_i64(); - - read_vec_element(s, tcg_op, rn, pass, MO_64); - genfn(tcg_op, tcg_env, tcg_op, tcg_shift); - write_vec_element(s, tcg_op, rd, pass, MO_64); - } - clear_vec_high(s, is_q, rd); - } else { - TCGv_i32 tcg_shift = tcg_constant_i32(shift); - static NeonGenTwoOpEnvFn * const fns[2][2][3] = { - { - { gen_helper_neon_qshl_s8, - gen_helper_neon_qshl_s16, - gen_helper_neon_qshl_s32 }, - { gen_helper_neon_qshlu_s8, - gen_helper_neon_qshlu_s16, - gen_helper_neon_qshlu_s32 } - }, { - { NULL, NULL, NULL }, - { gen_helper_neon_qshl_u8, - gen_helper_neon_qshl_u16, - gen_helper_neon_qshl_u32 } - } - }; - NeonGenTwoOpEnvFn *genfn = fns[src_unsigned][dst_unsigned][size]; - MemOp memop = scalar ? size : MO_32; - int maxpass = scalar ? 1 : is_q ? 4 : 2; - - for (pass = 0; pass < maxpass; pass++) { - TCGv_i32 tcg_op = tcg_temp_new_i32(); - - read_vec_element_i32(s, tcg_op, rn, pass, memop); - genfn(tcg_op, tcg_env, tcg_op, tcg_shift); - if (scalar) { - switch (size) { - case 0: - tcg_gen_ext8u_i32(tcg_op, tcg_op); - break; - case 1: - tcg_gen_ext16u_i32(tcg_op, tcg_op); - break; - case 2: - break; - default: - g_assert_not_reached(); - } - write_fp_sreg(s, rd, tcg_op); - } else { - write_vec_element_i32(s, tcg_op, rd, pass, MO_32); - } - } - - if (!scalar) { - clear_vec_high(s, is_q, rd); - } - } -} - /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -9890,16 +9869,6 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) handle_vec_simd_sqshrn(s, true, false, is_u, is_u, immh, immb, opcode, rn, rd); break; - case 0xc: /* SQSHLU */ - if (!is_u) { - unallocated_encoding(s); - return; - } - handle_simd_qshl(s, true, false, false, true, immh, immb, rn, rd); - break; - case 0xe: /* SQSHL, UQSHL */ - handle_simd_qshl(s, true, false, is_u, is_u, immh, immb, rn, rd); - break; case 0x1f: /* FCVTZS, FCVTZU */ handle_simd_shift_fpint_conv(s, true, false, is_u, immh, immb, rn, rd); break; @@ -9910,6 +9879,8 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) case 0x06: /* SRSRA / URSRA */ case 0x08: /* SRI */ case 0x0a: /* SHL / SLI */ + case 0x0c: /* SQSHLU */ + case 0x0e: /* SQSHL, UQSHL */ unallocated_encoding(s); break; } @@ -10561,16 +10532,6 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) handle_simd_shift_intfp_conv(s, false, is_q, is_u, immh, immb, opcode, rn, rd); break; - case 0xc: /* SQSHLU */ - if (!is_u) { - unallocated_encoding(s); - return; - } - handle_simd_qshl(s, false, is_q, false, true, immh, immb, rn, rd); - break; - case 0xe: /* SQSHL, UQSHL */ - handle_simd_qshl(s, false, is_q, is_u, is_u, immh, immb, rn, rd); - break; case 0x1f: /* FCVTZS/ FCVTZU */ handle_simd_shift_fpint_conv(s, false, is_q, is_u, immh, immb, rn, rd); return; @@ -10581,6 +10542,8 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) case 0x06: /* SRSRA / URSRA (accum + rounding) */ case 0x08: /* SRI */ case 0x0a: /* SHL / SLI */ + case 0x0c: /* SQSHLU */ + case 0x0e: /* SQSHL, UQSHL */ case 0x14: /* SSHLL / USHLL */ unallocated_encoding(s); return; From patchwork Thu Sep 19 13:10:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829623 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319975wrn; Thu, 19 Sep 2024 06:18:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtTpa+GeW6lBZ0fg4/zYcUQh1a1R/ICAeQLSp2ZqLJKZfWe7wpfKYJ6EzldhFQNndVRgxpgg==@linaro.org X-Google-Smtp-Source: AGHT+IE12P2D0zWbqdG8vncsn8NuRup2reC/mEkINoS5d06AUOC7xy9OpiTOOaAHlglHgxG0xhov X-Received: by 2002:a05:6358:2484:b0:1b8:6942:541b with SMTP id e5c5f4694b2df-1bb14e3b25cmr979357955d.13.1726751935645; Thu, 19 Sep 2024 06:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751935; cv=none; d=google.com; s=arc-20240605; b=Ap8ywOo7CmHAbSKEG6enQHGCp1dm5z1TnMQZCColq4tULayo5+RviWgI/tub+q/A3N dUXibH6xSOMJa7NB8oTHQtO2ZDNqp135iBOgh0y9fN2pYFlvsZ4bfMMCj3RTPfEPF9R2 SAwUFcjKGd379jQ+Hjivk8l9nqT036WboPevjAvy30snx3J9H8Gs9ZPi/WiPlRpu0vEA GXhfZMCuEA4lbo40aXFhvgOfad7Z9Ymy5sP6M8ja9/hzh+MP3QY9KzkZDWDyFz7jlUDu GwL0wMRITC5S5yFmWvBtIDFscTlceCgQS+RTx++T3ZO6s2+PR4yyzYNAr2LhwhiAxo6Z 8uCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=peQpqNi3t2MuaFRTBupbSj9HxYEac+jZaNqEA3I02Xc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=QYR7KX39Ahxn/x09yHbv5c0JWpLFdf+wqhDBMUm2Xnx9qA9S4Lw2zM1Psg3bcDi8IO 8/pR/mW7Kl35cv6YhGLCEPh0p+geTHf8WjPZ+I18ODfoGrvi5TkR2F94Nx6sawutVoNZ yd2leTCjLgs9zUtHlKClji6mabABKQUy7yqbuTh2b15PO3LehSJ2CfGR52nTNUdYTEx9 AzklNqNB0WfvT/+ZdjXzyON6jPwJILIiyGHnqJHBhbolaw5ew2DIpx9RXP0LGQ5kceKI 54okCvu9ppEb3Jxd3QSXvcYNDYPjxGT/e6ZZbOjfx8iEUoHdBfoX1i9br0cS0PC1rmXU 8E2w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Z+Q0/L+U"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45b178ed4c3si18084141cf.389.2024.09.19.06.18.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Z+Q0/L+U"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGws-0006h5-0O; Thu, 19 Sep 2024 09:11:54 -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 1srGwV-0005N4-7O for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwR-000149-0H for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:30 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4280ca0791bso7743675e9.1 for ; Thu, 19 Sep 2024 06:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751484; x=1727356284; 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=peQpqNi3t2MuaFRTBupbSj9HxYEac+jZaNqEA3I02Xc=; b=Z+Q0/L+U9Wg8+n0vCztF9WPCGc/fPo2yjwRx5dIB0M4cAdX+VwmaVNRxJylWm8DTV7 DH6V0W4fAtjXiQVnyJ7B/tGB/OkeXeZTvngdyOP8OoaGLfo7lcFJpJAhptfx9aKgD6Vu rjPY5Ve/vGQ+UbBKBlRJXkc/fp0DXrFpfPiZB4MXlxK3u7gC/2ZheWqO2G0s/C9Tg76G G0R6GlceYvvSNB88qPSPn20Zh/5G5Gu//heJIBRgei6IbqT3cZn0H8SzEdnyeAeaEU6D b0EcN2xFfbc9cRjsk1dkWCJff9FCSQXFCxLV2mY359vZNDFotRxJDd/XA6hmoaAIbQhj qcNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751484; x=1727356284; 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=peQpqNi3t2MuaFRTBupbSj9HxYEac+jZaNqEA3I02Xc=; b=Bep33Go7qo3+I1mLf/+WLl3HVflUFPyiQr8q8SXiDOVnE6Z/FrBF7e3VhD9LkBngPu B0E5/zIJ105NlwLrkvh3t1bInCffqmgU8QszRRf19qrbjxqVhXBlM/AwBHtBjPzwWCGR jPN36Ih0/UD5lXUDQmCSFwvxJyouvAZlsRSgWF0U7o0jwzWaGQgoHtq9eRJEvuzxbjNJ esdc6F88eyXS4qN/KqZ4aOKKDVaoqO+73n9zXZInicI5SoX7dhB0kM6xIopQzLAR5OGv 6/MeERUP63RjgcT75raOOt0WixGavY0PfwRUqnKW+hoqtP/XZKYDAKNOacr9mepel40R vxSQ== X-Gm-Message-State: AOJu0YymcxWZt2EFflHNYHdwS5OtisxR2ZPopWIQ31GwkD+IJ/ESiMjm PNulpDOLO383pvO+7WojJT40TH6HcoyiJHRIQHe+Y8JzFdfHP23PC8GBUCU+kvPqiTAwhAUBHGu T X-Received: by 2002:a05:600c:45cf:b0:428:f0c2:ef4a with SMTP id 5b1f17b1804b1-42cdb531c3dmr237323735e9.13.1726751484330; Thu, 19 Sep 2024 06:11:24 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:24 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/38] target/arm: Convert vector [US]QSHRN, [US]QRSHRN, SQSHRUN to decodetree Date: Thu, 19 Sep 2024 14:10:56 +0100 Message-Id: <20240919131106.3362543-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-29-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 24 +++++ target/arm/tcg/translate-a64.c | 176 ++++++++++++++++++++++++++++++--- 2 files changed, 186 insertions(+), 14 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 63e04ddfcde..042dc79d88a 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1302,6 +1302,30 @@ SQSHLU_vi 0.10 11110 .... ... 01100 1 ..... ..... @q_shli_h SQSHLU_vi 0.10 11110 .... ... 01100 1 ..... ..... @q_shli_s SQSHLU_vi 0.10 11110 .... ... 01100 1 ..... ..... @q_shli_d +SQSHRN_v 0.00 11110 .... ... 10010 1 ..... ..... @q_shri_b +SQSHRN_v 0.00 11110 .... ... 10010 1 ..... ..... @q_shri_h +SQSHRN_v 0.00 11110 .... ... 10010 1 ..... ..... @q_shri_s + +UQSHRN_v 0.10 11110 .... ... 10010 1 ..... ..... @q_shri_b +UQSHRN_v 0.10 11110 .... ... 10010 1 ..... ..... @q_shri_h +UQSHRN_v 0.10 11110 .... ... 10010 1 ..... ..... @q_shri_s + +SQSHRUN_v 0.10 11110 .... ... 10000 1 ..... ..... @q_shri_b +SQSHRUN_v 0.10 11110 .... ... 10000 1 ..... ..... @q_shri_h +SQSHRUN_v 0.10 11110 .... ... 10000 1 ..... ..... @q_shri_s + +SQRSHRN_v 0.00 11110 .... ... 10011 1 ..... ..... @q_shri_b +SQRSHRN_v 0.00 11110 .... ... 10011 1 ..... ..... @q_shri_h +SQRSHRN_v 0.00 11110 .... ... 10011 1 ..... ..... @q_shri_s + +UQRSHRN_v 0.10 11110 .... ... 10011 1 ..... ..... @q_shri_b +UQRSHRN_v 0.10 11110 .... ... 10011 1 ..... ..... @q_shri_h +UQRSHRN_v 0.10 11110 .... ... 10011 1 ..... ..... @q_shri_s + +SQRSHRUN_v 0.10 11110 .... ... 10001 1 ..... ..... @q_shri_b +SQRSHRUN_v 0.10 11110 .... ... 10001 1 ..... ..... @q_shri_h +SQRSHRUN_v 0.10 11110 .... ... 10001 1 ..... ..... @q_shri_s + # Advanced SIMD scalar shift by immediate @shri_d .... ..... 1 ...... ..... . rn:5 rd:5 \ diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 77324e0145f..e6290e11453 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7163,6 +7163,122 @@ static bool do_vec_shift_imm_narrow(DisasContext *s, arg_qrri_e *a, return true; } +static void gen_sqshrn_b(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + tcg_gen_sari_i64(d, s, i); + tcg_gen_ext16u_i64(d, d); + gen_helper_neon_narrow_sat_s8(d, tcg_env, d); +} + +static void gen_sqshrn_h(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + tcg_gen_sari_i64(d, s, i); + tcg_gen_ext32u_i64(d, d); + gen_helper_neon_narrow_sat_s16(d, tcg_env, d); +} + +static void gen_sqshrn_s(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_sshr_d(d, s, i); + gen_helper_neon_narrow_sat_s32(d, tcg_env, d); +} + +static void gen_uqshrn_b(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + tcg_gen_shri_i64(d, s, i); + gen_helper_neon_narrow_sat_u8(d, tcg_env, d); +} + +static void gen_uqshrn_h(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + tcg_gen_shri_i64(d, s, i); + gen_helper_neon_narrow_sat_u16(d, tcg_env, d); +} + +static void gen_uqshrn_s(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_ushr_d(d, s, i); + gen_helper_neon_narrow_sat_u32(d, tcg_env, d); +} + +static void gen_sqshrun_b(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + tcg_gen_sari_i64(d, s, i); + tcg_gen_ext16u_i64(d, d); + gen_helper_neon_unarrow_sat8(d, tcg_env, d); +} + +static void gen_sqshrun_h(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + tcg_gen_sari_i64(d, s, i); + tcg_gen_ext32u_i64(d, d); + gen_helper_neon_unarrow_sat16(d, tcg_env, d); +} + +static void gen_sqshrun_s(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_sshr_d(d, s, i); + gen_helper_neon_unarrow_sat32(d, tcg_env, d); +} + +static void gen_sqrshrn_b(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_srshr_bhs(d, s, i); + tcg_gen_ext16u_i64(d, d); + gen_helper_neon_narrow_sat_s8(d, tcg_env, d); +} + +static void gen_sqrshrn_h(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_srshr_bhs(d, s, i); + tcg_gen_ext32u_i64(d, d); + gen_helper_neon_narrow_sat_s16(d, tcg_env, d); +} + +static void gen_sqrshrn_s(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_srshr_d(d, s, i); + gen_helper_neon_narrow_sat_s32(d, tcg_env, d); +} + +static void gen_uqrshrn_b(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_urshr_bhs(d, s, i); + gen_helper_neon_narrow_sat_u8(d, tcg_env, d); +} + +static void gen_uqrshrn_h(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_urshr_bhs(d, s, i); + gen_helper_neon_narrow_sat_u16(d, tcg_env, d); +} + +static void gen_uqrshrn_s(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_urshr_d(d, s, i); + gen_helper_neon_narrow_sat_u32(d, tcg_env, d); +} + +static void gen_sqrshrun_b(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_srshr_bhs(d, s, i); + tcg_gen_ext16u_i64(d, d); + gen_helper_neon_unarrow_sat8(d, tcg_env, d); +} + +static void gen_sqrshrun_h(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_srshr_bhs(d, s, i); + tcg_gen_ext32u_i64(d, d); + gen_helper_neon_unarrow_sat16(d, tcg_env, d); +} + +static void gen_sqrshrun_s(TCGv_i64 d, TCGv_i64 s, int64_t i) +{ + gen_srshr_d(d, s, i); + gen_helper_neon_unarrow_sat32(d, tcg_env, d); +} + static WideShiftImmFn * const shrn_fns[] = { tcg_gen_shri_i64, tcg_gen_shri_i64, @@ -7177,6 +7293,48 @@ static WideShiftImmFn * const rshrn_fns[] = { }; TRANS(RSHRN_v, do_vec_shift_imm_narrow, a, rshrn_fns, 0) +static WideShiftImmFn * const sqshrn_fns[] = { + gen_sqshrn_b, + gen_sqshrn_h, + gen_sqshrn_s, +}; +TRANS(SQSHRN_v, do_vec_shift_imm_narrow, a, sqshrn_fns, MO_SIGN) + +static WideShiftImmFn * const uqshrn_fns[] = { + gen_uqshrn_b, + gen_uqshrn_h, + gen_uqshrn_s, +}; +TRANS(UQSHRN_v, do_vec_shift_imm_narrow, a, uqshrn_fns, 0) + +static WideShiftImmFn * const sqshrun_fns[] = { + gen_sqshrun_b, + gen_sqshrun_h, + gen_sqshrun_s, +}; +TRANS(SQSHRUN_v, do_vec_shift_imm_narrow, a, sqshrun_fns, MO_SIGN) + +static WideShiftImmFn * const sqrshrn_fns[] = { + gen_sqrshrn_b, + gen_sqrshrn_h, + gen_sqrshrn_s, +}; +TRANS(SQRSHRN_v, do_vec_shift_imm_narrow, a, sqrshrn_fns, MO_SIGN) + +static WideShiftImmFn * const uqrshrn_fns[] = { + gen_uqrshrn_b, + gen_uqrshrn_h, + gen_uqrshrn_s, +}; +TRANS(UQRSHRN_v, do_vec_shift_imm_narrow, a, uqrshrn_fns, 0) + +static WideShiftImmFn * const sqrshrun_fns[] = { + gen_sqrshrun_b, + gen_sqrshrun_h, + gen_sqrshrun_s, +}; +TRANS(SQRSHRUN_v, do_vec_shift_imm_narrow, a, sqrshrun_fns, MO_SIGN) + /* * Advanced SIMD Scalar Shift by Immediate */ @@ -10514,20 +10672,6 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) } switch (opcode) { - case 0x10: /* SHRN / SQSHRUN */ - case 0x11: /* RSHRN / SQRSHRUN */ - if (is_u) { - handle_vec_simd_sqshrn(s, false, is_q, false, true, immh, immb, - opcode, rn, rd); - } else { - unallocated_encoding(s); - } - break; - case 0x12: /* SQSHRN / UQSHRN */ - case 0x13: /* SQRSHRN / UQRSHRN */ - handle_vec_simd_sqshrn(s, false, is_q, is_u, is_u, immh, immb, - opcode, rn, rd); - break; case 0x1c: /* SCVTF / UCVTF */ handle_simd_shift_intfp_conv(s, false, is_q, is_u, immh, immb, opcode, rn, rd); @@ -10544,6 +10688,10 @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) case 0x0a: /* SHL / SLI */ case 0x0c: /* SQSHLU */ case 0x0e: /* SQSHL, UQSHL */ + case 0x10: /* SHRN / SQSHRUN */ + case 0x11: /* RSHRN / SQRSHRUN */ + case 0x12: /* SQSHRN / UQSHRN */ + case 0x13: /* SQRSHRN / UQRSHRN */ case 0x14: /* SSHLL / USHLL */ unallocated_encoding(s); return; From patchwork Thu Sep 19 13:10:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829636 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320773wrn; Thu, 19 Sep 2024 06:20:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWi2dYLOORSYbtj9E2R4btTOFYPM/HGaf4Ghjol6FqyJ0mlo4Z1IfiDm053R8mgdfWkMCDG3w==@linaro.org X-Google-Smtp-Source: AGHT+IH1FR9iy4eL5vBsWBMgzV7mgao0dOSD8iwzIlktIhI8dztv7JSHL2iMAaRwLGh7VD6Oc5Cr X-Received: by 2002:a05:620a:24d3:b0:79d:569a:699f with SMTP id af79cd13be357-7a9e5f32a12mr3873112885a.39.1726752033337; Thu, 19 Sep 2024 06:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726752033; cv=none; d=google.com; s=arc-20240605; b=guNyTgScl6+L2iCctvqwQme9jYtvNvmrlAYw/PWe4s0MPEj63eSWpEeifBWk0G77+o Pl4Kh6pXHACSi2PM6yL3I/t/Ey6aDAKYl9eKvTU4YmgAJGLJZsvLDsTBCPaLimN+xAkB Q25ZQJqnF3ZmGzFlFjpN5IuvCtFuv5NkujzgXN774mo0A+D4nQB3838b5QPzRQMNQUPc HNJM5nNMdDpMy9lfAzsm54KygUot2A5OWpJmaX+wZ4LZNRCQTGy9SwSao/TkayLoeGCX pjmhbXPBDBnLTHytRHazGAU3/O0NIl09x0s+BlDqyrYPBzEOB4/afyNsR/oFL7LMAIv7 MDeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=YX3mccd/hP9orfB/TKgT2VwiqPk/5Rtp6hQ5FMQbk2g=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=L+U7B4CtedgN9pfoP26zaS18jglPg5QPZ6XbpOs5rfRBoqp5CRj1BoYrGRaNwc4dn+ wuIrmdRGO4kGSpyFMl5HuRUGJtsZr/+nfFKcdLND1ih8wiTjoJgju92NScGQw9t4W1JL ORE5WXRO9MDw0BdHP5VXmXavDzUT2wVlDCgtDeyLtgbilpe0jNa897R8YahSdsX2hxNl 2B63XgAvumdflYHBdJfVlKF7wb/RrecejMhrL/qqax3pZg1cCViwcqqHfSK1HJx6k2h3 MMuz4Iy0XvVCiLAJ5jSESTk6QdZNTJ4RuU7wKOs3dhdoeVr1UYb5ITOMJhAELfLp3Sf6 zAdA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i2OoEQv5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb08e3f16si184564285a.507.2024.09.19.06.20.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i2OoEQv5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwm-0006LT-Id; Thu, 19 Sep 2024 09:11:48 -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 1srGwX-0005Tx-0L for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:36 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwR-00014E-1b for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2f77fe7ccc4so8884391fa.2 for ; Thu, 19 Sep 2024 06:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751485; x=1727356285; 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=YX3mccd/hP9orfB/TKgT2VwiqPk/5Rtp6hQ5FMQbk2g=; b=i2OoEQv5NroWHArbn5+S4JXaZgyNsfTGLBiSTVC75nbVZYRCFsZO151OhbVC6Kral5 uWaHCTj2IePdKGg5L28QUm8y9FTp9T3LKZQaPb2OwDxbLN4na18G/TsXMwvvgaBM4PxL 0eUC4NG8lR3l4koQX0rtaVRikF4KCmNVs8rgO98BhBB1aRbkuqLqdZLFJhJ0ApgyqnT0 8+XXI7oF1RGzpNgabmuOWIvbFdmScFKA66P3V+kom7SvAUM874FnksHTj+C+zAgFb9PO kZN7uJdCCyobmH5q8bdk1GXVCT+2eyi70sAxToek9i2tK2/0JklZqAQW4z6MX5NdWCO1 QpdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751485; x=1727356285; 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=YX3mccd/hP9orfB/TKgT2VwiqPk/5Rtp6hQ5FMQbk2g=; b=LKTHCQzaHIR7+oAoH0XxpSJi2JV5qFBSFWWyXTlh/Q12x/Q4lQ/7l6/IQEpP49CcqV Mttd3Qoep7rUqxgMk2Dg8Yzq6ViQc8eHGFSfD4t9lgq/wW2WfzR8M0+iB3mWKYO/TBjc TqhtXsqmO6rS5k3GKufs5X4nKklnbaell9HaaOqYoHm3353kpbFWEGzZnzm89g3Z/frJ lk7DQEShYZ1jsu9vCf2aKJh1rmfW+tWSpF9H4wG7a0zhDGasxoZ8t3/pnflEQsoBg+yn chTJ6pY5wpxfsitMfhX4tadblGPzrdZGy1ErkfMs7q4Ru/5XNMb7KxX2vrIeCs/vj/Bq XfMg== X-Gm-Message-State: AOJu0YyHZvDkDdnVH7LDB1ZA0wejnUsCuICslwR6uE6B6wWiDDAfKm2Z Ja80IJSkdRmZM+SY7bvSTM2r1DJeHbCfhiBy7Qv1l1iW/S3buC3yzzFsfR/IG+xrnKCBwnt3541 d X-Received: by 2002:a2e:be1f:0:b0:2f7:64b9:ff90 with SMTP id 38308e7fff4ca-2f7918e9558mr116760121fa.9.1726751484816; Thu, 19 Sep 2024 06:11:24 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:24 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/38] target/arm: Convert scalar [US]QSHRN, [US]QRSHRN, SQSHRUN to decodetree Date: Thu, 19 Sep 2024 14:10:57 +0100 Message-Id: <20240919131106.3362543-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22e.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-30-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/a64.decode | 30 +++++++ target/arm/tcg/translate-a64.c | 160 +++++++-------------------------- 2 files changed, 63 insertions(+), 127 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 042dc79d88a..331a8e180c0 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1328,6 +1328,12 @@ SQRSHRUN_v 0.10 11110 .... ... 10001 1 ..... ..... @q_shri_s # Advanced SIMD scalar shift by immediate +@shri_b .... ..... 0001 ... ..... . rn:5 rd:5 \ + &rri_e esz=0 imm=%neon_rshift_i3 +@shri_h .... ..... 001 .... ..... . rn:5 rd:5 \ + &rri_e esz=1 imm=%neon_rshift_i4 +@shri_s .... ..... 01 ..... ..... . rn:5 rd:5 \ + &rri_e esz=2 imm=%neon_rshift_i5 @shri_d .... ..... 1 ...... ..... . rn:5 rd:5 \ &rri_e esz=3 imm=%neon_rshift_i6 @@ -1363,3 +1369,27 @@ SQSHLU_si 0111 11110 .... ... 01100 1 ..... ..... @shli_b SQSHLU_si 0111 11110 .... ... 01100 1 ..... ..... @shli_h SQSHLU_si 0111 11110 .... ... 01100 1 ..... ..... @shli_s SQSHLU_si 0111 11110 .... ... 01100 1 ..... ..... @shli_d + +SQSHRN_si 0101 11110 .... ... 10010 1 ..... ..... @shri_b +SQSHRN_si 0101 11110 .... ... 10010 1 ..... ..... @shri_h +SQSHRN_si 0101 11110 .... ... 10010 1 ..... ..... @shri_s + +UQSHRN_si 0111 11110 .... ... 10010 1 ..... ..... @shri_b +UQSHRN_si 0111 11110 .... ... 10010 1 ..... ..... @shri_h +UQSHRN_si 0111 11110 .... ... 10010 1 ..... ..... @shri_s + +SQSHRUN_si 0111 11110 .... ... 10000 1 ..... ..... @shri_b +SQSHRUN_si 0111 11110 .... ... 10000 1 ..... ..... @shri_h +SQSHRUN_si 0111 11110 .... ... 10000 1 ..... ..... @shri_s + +SQRSHRN_si 0101 11110 .... ... 10011 1 ..... ..... @shri_b +SQRSHRN_si 0101 11110 .... ... 10011 1 ..... ..... @shri_h +SQRSHRN_si 0101 11110 .... ... 10011 1 ..... ..... @shri_s + +UQRSHRN_si 0111 11110 .... ... 10011 1 ..... ..... @shri_b +UQRSHRN_si 0111 11110 .... ... 10011 1 ..... ..... @shri_h +UQRSHRN_si 0111 11110 .... ... 10011 1 ..... ..... @shri_s + +SQRSHRUN_si 0111 11110 .... ... 10001 1 ..... ..... @shri_b +SQRSHRUN_si 0111 11110 .... ... 10001 1 ..... ..... @shri_h +SQRSHRUN_si 0111 11110 .... ... 10001 1 ..... ..... @shri_s diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index e6290e11453..071b6349fc3 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7456,6 +7456,35 @@ TRANS(SQSHL_si, do_scalar_shift_imm, a, f_scalar_sqshli[a->esz], false, 0) TRANS(UQSHL_si, do_scalar_shift_imm, a, f_scalar_uqshli[a->esz], false, 0) TRANS(SQSHLU_si, do_scalar_shift_imm, a, f_scalar_sqshlui[a->esz], false, 0) +static bool do_scalar_shift_imm_narrow(DisasContext *s, arg_rri_e *a, + WideShiftImmFn * const fns[3], + MemOp sign, bool zext) +{ + MemOp esz = a->esz; + + tcg_debug_assert(esz >= MO_8 && esz <= MO_32); + + if (fp_access_check(s)) { + TCGv_i64 rd = tcg_temp_new_i64(); + TCGv_i64 rn = tcg_temp_new_i64(); + + read_vec_element(s, rn, a->rn, 0, (esz + 1) | sign); + fns[esz](rd, rn, a->imm); + if (zext) { + tcg_gen_ext_i64(rd, rd, esz); + } + write_fp_dreg(s, a->rd, rd); + } + return true; +} + +TRANS(SQSHRN_si, do_scalar_shift_imm_narrow, a, sqshrn_fns, MO_SIGN, true) +TRANS(SQRSHRN_si, do_scalar_shift_imm_narrow, a, sqrshrn_fns, MO_SIGN, true) +TRANS(UQSHRN_si, do_scalar_shift_imm_narrow, a, uqshrn_fns, 0, false) +TRANS(UQRSHRN_si, do_scalar_shift_imm_narrow, a, uqrshrn_fns, 0, false) +TRANS(SQSHRUN_si, do_scalar_shift_imm_narrow, a, sqshrun_fns, MO_SIGN, false) +TRANS(SQRSHRUN_si, do_scalar_shift_imm_narrow, a, sqrshrun_fns, MO_SIGN, false) + /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the * shift amount is in range (ie 0..31 or 0..63) and provide the ARM @@ -9635,119 +9664,6 @@ static void disas_data_proc_fp(DisasContext *s, uint32_t insn) } } -/* - * Common SSHR[RA]/USHR[RA] - Shift right (optional rounding/accumulate) - * - * This code is handles the common shifting code and is used by both - * the vector and scalar code. - */ -static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, - bool round, bool accumulate, - bool is_u, int size, int shift) -{ - if (!round) { - if (is_u) { - gen_ushr_d(tcg_src, tcg_src, shift); - } else { - gen_sshr_d(tcg_src, tcg_src, shift); - } - } else if (size == MO_64) { - if (is_u) { - gen_urshr_d(tcg_src, tcg_src, shift); - } else { - gen_srshr_d(tcg_src, tcg_src, shift); - } - } else { - if (is_u) { - gen_urshr_bhs(tcg_src, tcg_src, shift); - } else { - gen_srshr_bhs(tcg_src, tcg_src, shift); - } - } - - if (accumulate) { - tcg_gen_add_i64(tcg_res, tcg_res, tcg_src); - } else { - tcg_gen_mov_i64(tcg_res, tcg_src); - } -} - -/* SQSHRN/SQSHRUN - Saturating (signed/unsigned) shift right with - * (signed/unsigned) narrowing */ -static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, - bool is_u_shift, bool is_u_narrow, - int immh, int immb, int opcode, - int rn, int rd) -{ - int immhb = immh << 3 | immb; - int size = 32 - clz32(immh) - 1; - int esize = 8 << size; - int shift = (2 * esize) - immhb; - int elements = is_scalar ? 1 : (64 / esize); - bool round = extract32(opcode, 0, 1); - MemOp ldop = (size + 1) | (is_u_shift ? 0 : MO_SIGN); - TCGv_i64 tcg_rn, tcg_rd, tcg_final; - - static NeonGenOne64OpEnvFn * const signed_narrow_fns[4][2] = { - { gen_helper_neon_narrow_sat_s8, - gen_helper_neon_unarrow_sat8 }, - { gen_helper_neon_narrow_sat_s16, - gen_helper_neon_unarrow_sat16 }, - { gen_helper_neon_narrow_sat_s32, - gen_helper_neon_unarrow_sat32 }, - { NULL, NULL }, - }; - static NeonGenOne64OpEnvFn * const unsigned_narrow_fns[4] = { - gen_helper_neon_narrow_sat_u8, - gen_helper_neon_narrow_sat_u16, - gen_helper_neon_narrow_sat_u32, - NULL - }; - NeonGenOne64OpEnvFn *narrowfn; - - int i; - - assert(size < 4); - - if (extract32(immh, 3, 1)) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - if (is_u_shift) { - narrowfn = unsigned_narrow_fns[size]; - } else { - narrowfn = signed_narrow_fns[size][is_u_narrow ? 1 : 0]; - } - - tcg_rn = tcg_temp_new_i64(); - tcg_rd = tcg_temp_new_i64(); - tcg_final = tcg_temp_new_i64(); - - for (i = 0; i < elements; i++) { - read_vec_element(s, tcg_rn, rn, i, ldop); - handle_shri_with_rndacc(tcg_rd, tcg_rn, round, - false, is_u_shift, size+1, shift); - narrowfn(tcg_rd, tcg_env, tcg_rd); - if (i == 0) { - tcg_gen_extract_i64(tcg_final, tcg_rd, 0, esize); - } else { - tcg_gen_deposit_i64(tcg_final, tcg_final, tcg_rd, esize * i, esize); - } - } - - if (!is_q) { - write_vec_element(s, tcg_final, rd, 0, MO_64); - } else { - write_vec_element(s, tcg_final, rd, 1, MO_64); - } - clear_vec_high(s, is_q, rd); -} - /* Common vector code for handling integer to FP conversion */ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int elements, int is_signed, @@ -10013,20 +9929,6 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) handle_simd_shift_intfp_conv(s, true, false, is_u, immh, immb, opcode, rn, rd); break; - case 0x10: /* SQSHRUN, SQSHRUN2 */ - case 0x11: /* SQRSHRUN, SQRSHRUN2 */ - if (!is_u) { - unallocated_encoding(s); - return; - } - handle_vec_simd_sqshrn(s, true, false, false, true, - immh, immb, opcode, rn, rd); - break; - case 0x12: /* SQSHRN, SQSHRN2, UQSHRN */ - case 0x13: /* SQRSHRN, SQRSHRN2, UQRSHRN, UQRSHRN2 */ - handle_vec_simd_sqshrn(s, true, false, is_u, is_u, - immh, immb, opcode, rn, rd); - break; case 0x1f: /* FCVTZS, FCVTZU */ handle_simd_shift_fpint_conv(s, true, false, is_u, immh, immb, rn, rd); break; @@ -10039,6 +9941,10 @@ static void disas_simd_scalar_shift_imm(DisasContext *s, uint32_t insn) case 0x0a: /* SHL / SLI */ case 0x0c: /* SQSHLU */ case 0x0e: /* SQSHL, UQSHL */ + case 0x10: /* SQSHRUN */ + case 0x11: /* SQRSHRUN */ + case 0x12: /* SQSHRN, UQSHRN */ + case 0x13: /* SQRSHRN, UQRSHRN */ unallocated_encoding(s); break; } From patchwork Thu Sep 19 13:10:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829631 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320426wrn; Thu, 19 Sep 2024 06:19:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUA162I+bDH82ZK0Oyi2lJOBeIftJNQ4btCwgMUPljvt9jJE4st6yI4cLeiDoDb/6v7TjdpMQ==@linaro.org X-Google-Smtp-Source: AGHT+IGpyqvNx9+zLzhE6iFnJ/MRIEE/xp0ffGHkNzH0ApWl3oVg5F69Fwj/atXhGamsqp7LnRZj X-Received: by 2002:a05:690c:6612:b0:6b3:a6ff:768e with SMTP id 00721157ae682-6dbcc000989mr209814187b3.0.1726751988333; Thu, 19 Sep 2024 06:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751988; cv=none; d=google.com; s=arc-20240605; b=eeGVNftmxrh2g5/yEdueyKmvKO23AMw2zwPitE1ydV4CQyfiP8oY51egbM8TteKmLi fG+IqANKwMVTrZDgmBNnS2E4/Cq4BtvYuq9So3xVKPOrSDoVgWEg58wQ8DtneluOIHdg sPx8nsnBlR3L3i1osLJHCoVhj8/Th3rGBAgss3gHppWLY/gLJq0izYAvgZ747yarCQ8h xzkbSIhhpSYQZ7JFTES2AlVw5YOHNgyNnEYcpSxBujB98h3bhK2tiwyy7sEasrRpYea+ sgfOQN3xRmzouzyTyiMhYy+Ez/XDRTCuzDPBpnfuXICOw0zoQjLBoQWPg9vR/L+nCii0 bgmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VwKnY+1IgXpvlla7/Vsb9u5qFB4I2Y8EFn85fywIH7o=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=jVlLbG4vEtfWIxB6WyiLBqgUSw8XNsjT3h8bmcGGTRE6COB1/WNvs+wkZAW6okuYiS DwrsWJA8j9h8kc46Op1vLuUXSYhIWoOPM7Iv68VwXnpPXJZWL/kfxqSH+ratW35mkIgy QibukNOnHrx5II8NrORKS1xIRaJ0ntV0MzMfCe7wVuVKSzKNfcCk1I3Gjtk6RRjU2H2t 5NHgrh/fKGEP3qbMkAj/mZw6KcdJvJ6RV0iOzSj2mlM9qqftR2TgC++qnDEz1ad6XepG ZfBnez8d26v1+Aj4kqEX4kh5ddYeQcefndlfMBggyE0MYigA5QYNwn+1CHS8xf2pKMV0 hC6w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J6oG9BIN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb08c8e04si176568685a.275.2024.09.19.06.19.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J6oG9BIN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGws-0006kj-TO; Thu, 19 Sep 2024 09:11:54 -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 1srGwV-0005NH-8v for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwR-00014K-DT for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:30 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-374c180d123so519039f8f.3 for ; Thu, 19 Sep 2024 06:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751485; x=1727356285; 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=VwKnY+1IgXpvlla7/Vsb9u5qFB4I2Y8EFn85fywIH7o=; b=J6oG9BIN9S75Fvzra1bnZ7VORsjtVtVwNFnqG13oWDkuDjfhZGHS+d2bPF/ZQ+XnzA wm1vr2CmJk0uOiS3WmxqvCloA/gW3b/tFP1BeZ81rJH5paeoLVel7n4j37U9C2fejF9L 8uNuO+fKBbi9Cdnd+GuV43Fw2g027bAQInLM6yNLcnDwQjG4fVWGd4ynQmo9A/o9S2tn rcDb6jyvEru5nyXKU11m/qA9t4TaewjQGECpMplKQ5r4VPbwnpR5tHX/MC067dxTtEjg 6188uSlMj1JNJOf4lsEsCJUFNBBS7sOdTracXJTTS87Cs+uiWk/vFu3WdcxJejpG4t6s AcsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751485; x=1727356285; 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=VwKnY+1IgXpvlla7/Vsb9u5qFB4I2Y8EFn85fywIH7o=; b=in5Nchr7QXfwy+rZFvbGyg78HibiabQfevxpHYRCz3CUrTMiaaSMP5FBZkJG7a7mcW We43Ln3G5IdiR0GfzxL43IPsZFjcHG5GQwZQkl+ZYk6Gb+5l+jX/DY/og2Cdp9/6PZQG eVqLB4gRLRQVXyroHgnsVlD3Fzd8WRJB0LeA57pP10j2iyiOqSttVLN+TQERAiiUJcmL bLi/Sqt4xCzNK1fC1Q8ziQMlXKD3+Cs2w7YbQAxRgjVbsxy+LSa/IHR0TuorxGF0UmdQ N8bK8K1SM+TD8pnFNe4d5SxvMNpFeBJWvSJIWFLYKC3KqqFoLYJWsWuZzCkztEmaIphH k7yA== X-Gm-Message-State: AOJu0YyhklA3JceKYJK1VH6k3t+7YWm/0YC/pwK0qT5hosHWYMxNVjJX O3dNVtOYoAyAsj1lvrowteR9UqS8jNW3cgML2sZU4j22LPXyX6HaVD/W1ZB3wKsa6o2fZBVSHV9 + X-Received: by 2002:a05:6000:1bca:b0:374:c847:85c with SMTP id ffacd0b85a97d-378d61e2c1fmr10713956f8f.24.1726751485348; Thu, 19 Sep 2024 06:11:25 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:25 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/38] hw/char/stm32l4x5_usart.c: Enable USART ACK bit response Date: Thu, 19 Sep 2024 14:10:58 +0100 Message-Id: <20240919131106.3362543-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Jacob Abrams SW modifying USART_CR1 TE bit should cuase HW to respond by altering USART_ISR TEACK bit, and likewise for RE and REACK bit. This resolves some but not all issues necessary for the official STM USART HAL driver to function as is. Fixes: 87b77e6e01ca ("hw/char/stm32l4x5_usart: Enable serial read and write") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2540 Signed-off-by: Jacob Abrams Message-id: 20240911043255.51966-1-satur9nine@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/char/stm32l4x5_usart.c | 16 +++++++++++++ tests/qtest/stm32l4x5_usart-test.c | 36 +++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/hw/char/stm32l4x5_usart.c b/hw/char/stm32l4x5_usart.c index fc5dcac0c45..3cf200c080d 100644 --- a/hw/char/stm32l4x5_usart.c +++ b/hw/char/stm32l4x5_usart.c @@ -154,6 +154,21 @@ REG32(RDR, 0x24) REG32(TDR, 0x28) FIELD(TDR, TDR, 0, 9) +static void stm32l4x5_update_isr(Stm32l4x5UsartBaseState *s) +{ + if (s->cr1 & R_CR1_TE_MASK) { + s->isr |= R_ISR_TEACK_MASK; + } else { + s->isr &= ~R_ISR_TEACK_MASK; + } + + if (s->cr1 & R_CR1_RE_MASK) { + s->isr |= R_ISR_REACK_MASK; + } else { + s->isr &= ~R_ISR_REACK_MASK; + } +} + static void stm32l4x5_update_irq(Stm32l4x5UsartBaseState *s) { if (((s->isr & R_ISR_WUF_MASK) && (s->cr3 & R_CR3_WUFIE_MASK)) || @@ -456,6 +471,7 @@ static void stm32l4x5_usart_base_write(void *opaque, hwaddr addr, case A_CR1: s->cr1 = value; stm32l4x5_update_params(s); + stm32l4x5_update_isr(s); stm32l4x5_update_irq(s); return; case A_CR2: diff --git a/tests/qtest/stm32l4x5_usart-test.c b/tests/qtest/stm32l4x5_usart-test.c index c175ff3064f..64cebda60f0 100644 --- a/tests/qtest/stm32l4x5_usart-test.c +++ b/tests/qtest/stm32l4x5_usart-test.c @@ -36,6 +36,8 @@ REG32(GTPR, 0x10) REG32(RTOR, 0x14) REG32(RQR, 0x18) REG32(ISR, 0x1C) + FIELD(ISR, REACK, 22, 1) + FIELD(ISR, TEACK, 21, 1) FIELD(ISR, TXE, 7, 1) FIELD(ISR, RXNE, 5, 1) FIELD(ISR, ORE, 3, 1) @@ -191,7 +193,7 @@ static void init_uart(QTestState *qts) /* Enable the transmitter, the receiver and the USART. */ qtest_writel(qts, (USART1_BASE_ADDR + A_CR1), - R_CR1_UE_MASK | R_CR1_RE_MASK | R_CR1_TE_MASK); + cr1 | R_CR1_UE_MASK | R_CR1_RE_MASK | R_CR1_TE_MASK); } static void test_write_read(void) @@ -298,6 +300,37 @@ static void test_send_str(void) qtest_quit(qts); } +static void test_ack(void) +{ + uint32_t cr1; + uint32_t isr; + QTestState *qts = qtest_init("-M b-l475e-iot01a"); + + init_uart(qts); + + cr1 = qtest_readl(qts, (USART1_BASE_ADDR + A_CR1)); + + /* Disable the transmitter and receiver. */ + qtest_writel(qts, (USART1_BASE_ADDR + A_CR1), + cr1 & ~(R_CR1_RE_MASK | R_CR1_TE_MASK)); + + /* Test ISR ACK for transmitter and receiver disabled */ + isr = qtest_readl(qts, (USART1_BASE_ADDR + A_ISR)); + g_assert_false(isr & R_ISR_TEACK_MASK); + g_assert_false(isr & R_ISR_REACK_MASK); + + /* Enable the transmitter and receiver. */ + qtest_writel(qts, (USART1_BASE_ADDR + A_CR1), + cr1 | (R_CR1_RE_MASK | R_CR1_TE_MASK)); + + /* Test ISR ACK for transmitter and receiver disabled */ + isr = qtest_readl(qts, (USART1_BASE_ADDR + A_ISR)); + g_assert_true(isr & R_ISR_TEACK_MASK); + g_assert_true(isr & R_ISR_REACK_MASK); + + qtest_quit(qts); +} + int main(int argc, char **argv) { int ret; @@ -310,6 +343,7 @@ int main(int argc, char **argv) qtest_add_func("stm32l4x5/usart/send_char", test_send_char); qtest_add_func("stm32l4x5/usart/receive_str", test_receive_str); qtest_add_func("stm32l4x5/usart/send_str", test_send_str); + qtest_add_func("stm32l4x5/usart/ack", test_ack); ret = g_test_run(); return ret; From patchwork Thu Sep 19 13:10:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829600 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316328wrn; Thu, 19 Sep 2024 06:12:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVGZ41s2hoxnISBeo/dSvPFUNJq+RpmiEzyxiqUraQ3RI2lEA1QshVaSTk3ZiW3yZQ2rxj6Bw==@linaro.org X-Google-Smtp-Source: AGHT+IEPsC8ApRvddFXVJkvxcCoHtzy05mvJZo8AKRBCk8xWiEydFFTKZ1sfjQJQkwMIczWggiAS X-Received: by 2002:a05:6358:71c6:b0:1b8:34fb:9696 with SMTP id e5c5f4694b2df-1bb14e3ee1amr712937155d.14.1726751529348; Thu, 19 Sep 2024 06:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751529; cv=none; d=google.com; s=arc-20240605; b=fWRukJulsVFB7srkccNUi0Ul3SwhXqVkJe37hgZpVmcebo5urnK7wcMg5ovWYXWZIe OBDQI89q8ClbxgIiRMV7QixXZerQJHEoDPMJosNScGbXbljDrEfq8qlRG/++kE1Q1LB1 z6yQfe0GsFujlZ8G/qHIwKFYC4yPhVKMQxVjq6IDkHoQsaYnbPOaNzq4fyNkXhbf/Yaj aX6TB4I0vSQ8LfQwxzzpPezFP5iLokApJy/dZo+qXlQpkN1bCf6+NIrrRhkKKMfZHet1 M7osuEIhEvpTQeMlKz4664Lh5euD/pQY5X/4+9echhvCsl1ZE/p5ZDUulkEOXamr/mHg ne0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=3kQBlK5vS8qxp5uwCgrYf9PWvy5sZQf/8kseDk6bM60=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=YTR1N7SCkwPu85Gk/UPCvTDlzYnYoMjItSKO1FF34g3iBdmdWILky1ZzlFdVql1W6z qjuRq89I7E66+4k/5fdfX/uDUbMG2znYUuGAUKgGpsnL/+8aDz7gt1VkduUf20CpsXfI PxedfDF8e6CHzn/XossDuZUPcBZfaZWkr5U/DcVN0IFvaGCbmiOam/A5+3eCI12POkfT njRZXzrDFAf7sSteLcUQUnnCyoF4JvpqKzQNXe6y/RrOf0od+GcgiFpx0OCGgH4AX0eb JrDPATDYMgQhBvu4LEuZa81DiLT+A6C9AxhiPVwaTtacnhmNGNeDHHImNlJKvcdeJFXS CMdQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oRSwHkG3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5035b95ce19si2231617e0c.89.2024.09.19.06.12.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:12:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oRSwHkG3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwu-0006tW-Ub; Thu, 19 Sep 2024 09:11:56 -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 1srGwV-0005NJ-9R for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwR-00014R-DZ for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:30 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-42cba8340beso12227225e9.1 for ; Thu, 19 Sep 2024 06:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751486; x=1727356286; 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=3kQBlK5vS8qxp5uwCgrYf9PWvy5sZQf/8kseDk6bM60=; b=oRSwHkG385YBs8d6P5++mEnyXpnB3U8XXrRxlNnpauYGO45Ti5rr+CUhbzVgAYWWH6 5XYUXdwIhyltTJk5lXlqnYXSYkVr5ku5q6dDMUQZ+m3s1UjiA8jNA4KMYG271RE4ML/Z 9YSkeeHbu98U4f3eNBglxmP7C5GznVNLSXWfeLUQ+Vd6MlF/Lhfx5iRulkdfCulSl7HO V1B15hXlGwxXbYG4OZ1oRrWTQcPoZBpn0abHq4ymCwXVogorY0vyopHdkF0pr0kU/JTY bmaWqskdAfejLsF6PW6Q9OQBWUH4TMDTg8uS2k0a2A8eCKtHvrrsjzXOJhxmi1cKxPql wAtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751486; x=1727356286; 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=3kQBlK5vS8qxp5uwCgrYf9PWvy5sZQf/8kseDk6bM60=; b=f7PdBmv1lqgWhYQ0F7fFmq4r8osLJJfdqTQi/KX27x0KzHFsGFH5OdjagqBo5RZWnN QJ4cEI2Df8MhDaPK7CinFmbXrIW+pMJV8McV6BYGIVdZKYnuh9zCER7RVcEc5YolizaP uSFzu+9+3Hsflcd7Yef/kFpPmOuxOaZkHNyismxjiwRB8Q7DBbLJblHVo0jkzSRFbIyR tP4unL/W2R/DX4CMvpNUFOQdSkf2XZmnoc1IdASZsIssg8KpjwOhG6xIuzspnANbW17q sIu/1pejcU7rXK1xl0mr5Vy2kbxK5GrWuL2BZFWOZ7NEgoRT8hz+ZctNSitnDiS+++dP U/uw== X-Gm-Message-State: AOJu0YxOQwRXmMQo1yd/BF0uM8PJJUCLrxBQMZCDyG6mk1pIMgkJAVmq AvdiPpA2eq3Ado6IF+JKAFFD0XfMX35oNqNC0ZJupZMplRP/wKOR+Lb4U3oeWQIvYs1BqYmtYK2 H X-Received: by 2002:a05:600c:1c9d:b0:42c:b377:3f55 with SMTP id 5b1f17b1804b1-42e743f263bmr19515345e9.3.1726751485895; Thu, 19 Sep 2024 06:11:25 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:25 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/38] tests: use default cpu for aarch64/sbsa-ref Date: Thu, 19 Sep 2024 14:10:59 +0100 Message-Id: <20240919131106.3362543-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Marcin Juszkiewicz We want to run tests using default cpu without having to remember which Arm core is it. Change Neoverse-N1 (old default) test to use default cpu (Neoverse-N2 at the moment). Signed-off-by: Marcin Juszkiewicz Message-id: 20240910-b4-move-to-freebsd-v5-1-0fb66d803c93@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- tests/functional/test_aarch64_sbsaref.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/functional/test_aarch64_sbsaref.py b/tests/functional/test_aarch64_sbsaref.py index f31c2a60b61..528882f4fa9 100755 --- a/tests/functional/test_aarch64_sbsaref.py +++ b/tests/functional/test_aarch64_sbsaref.py @@ -110,16 +110,17 @@ def test_sbsaref_edk2_firmware(self): # This tests the whole boot chain from EFI to Userspace # We only boot a whole OS for the current top level CPU and GIC # Other test profiles should use more minimal boots - def boot_alpine_linux(self, cpu): + def boot_alpine_linux(self, cpu=None): self.fetch_firmware() iso_path = self.ASSET_ALPINE_ISO.fetch() self.vm.set_console() self.vm.add_args( - "-cpu", cpu, "-drive", f"file={iso_path},media=cdrom,format=raw", ) + if cpu: + self.vm.add_args("-cpu", cpu) self.vm.launch() wait_for_console_pattern(self, "Welcome to Alpine Linux 3.17") @@ -127,8 +128,8 @@ def boot_alpine_linux(self, cpu): def test_sbsaref_alpine_linux_cortex_a57(self): self.boot_alpine_linux("cortex-a57") - def test_sbsaref_alpine_linux_neoverse_n1(self): - self.boot_alpine_linux("neoverse-n1") + def test_sbsaref_alpine_linux_default_cpu(self): + self.boot_alpine_linux() def test_sbsaref_alpine_linux_max_pauth_off(self): self.boot_alpine_linux("max,pauth=off") @@ -148,16 +149,17 @@ def test_sbsaref_alpine_linux_max(self): # This tests the whole boot chain from EFI to Userspace # We only boot a whole OS for the current top level CPU and GIC # Other test profiles should use more minimal boots - def boot_openbsd73(self, cpu): + def boot_openbsd73(self, cpu=None): self.fetch_firmware() img_path = self.ASSET_OPENBSD_ISO.fetch() self.vm.set_console() self.vm.add_args( - "-cpu", cpu, "-drive", f"file={img_path},format=raw,snapshot=on", ) + if cpu: + self.vm.add_args("-cpu", cpu) self.vm.launch() wait_for_console_pattern(self, @@ -167,8 +169,8 @@ def boot_openbsd73(self, cpu): def test_sbsaref_openbsd73_cortex_a57(self): self.boot_openbsd73("cortex-a57") - def test_sbsaref_openbsd73_neoverse_n1(self): - self.boot_openbsd73("neoverse-n1") + def test_sbsaref_openbsd73_default_cpu(self): + self.boot_openbsd73() def test_sbsaref_openbsd73_max_pauth_off(self): self.boot_openbsd73("max,pauth=off") From patchwork Thu Sep 19 13:11:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829605 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316869wrn; Thu, 19 Sep 2024 06:13:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV6quUO8JMbHIZ04lU8MXNgWImoNVRUUfk/fmkfsHXBYTA02+/YF+gXGr4xxy/16Sgyn3byTw==@linaro.org X-Google-Smtp-Source: AGHT+IG9JkheKTKUauRBPZJ4fQOt3Q3w6fma1Xo4ginzkuP4z9u7vuKm9OfZnwmxbauc2Ue8bzE4 X-Received: by 2002:a05:6358:6392:b0:1b8:5e16:1a07 with SMTP id e5c5f4694b2df-1bc39494a50mr605072755d.12.1726751597682; Thu, 19 Sep 2024 06:13:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751597; cv=none; d=google.com; s=arc-20240605; b=SVhCDL5W5gd+KBL3v4R3Mvb1MSv+uUHOmVIaNRn2na3/eGS9aFNB7D360ZPLgBTm1V xkecXMnAZ0m+5ilw2MwRwpYik6hpSDawoFSyGvyrtTrloObBjrlIetEeGuHGuOnknzri QF0fsEOa+ONfDx+HGN8GJJvw4Ca8XR46kHpaEjD4rla6D9KgdY4URQWmByS2L4ub+Yd3 fvK7lqtMXv6N4CWNKkWlt4hHk5tkg6zofyY9Usr9wGuLAJttdlPNOe4cr8zRswOI2Hh+ R3i0xtsBPwwYuU80KxT978Z69QdrA4X0HCuUz9JSHJEB6aCIC1PqGf+xNzgyWCsedL7V BF3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=AphQX4ql+BAtHg5yWLKAQ+5iWJXZHPjOafSUz9y3vMM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=JoCzlmnFtW+G2Q8qcA54V/LlcbZHEytXoYKFKTDmky34A2wyu3Gve+xWawpF74BT8w I6oxQrbqQ6FlTIwhOw8Ov3JMbRZDmGlOJZkXPOowYV4akkcwBd+9iGwlPJQdcDT+y7GL 06/lWI0Xl3x8BYddGfkcZSbonWknSovJH+CEW+rI2XcZAvCScFxWAg5sh6PGTaVogv5O h8hLKRybBcv0cWDzo0HdfVqVCCV06yOxFGBu2Xje9GiECgqr3+ywFSdK44P66A9wtnJP VQe5aK9+an8CA8JkHt+1JO7Bvie5XH9GHmFLz6MmIh4XdyvMXQu6orggn2J8F6aJyNzz VH1w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z6ntYAfP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5035bc81633si2643869e0c.252.2024.09.19.06.13.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:13:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z6ntYAfP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwy-00078Q-Oz; Thu, 19 Sep 2024 09:12:00 -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 1srGwW-0005Sw-No for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:36 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwT-00015H-34 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42cae6bb895so7712975e9.1 for ; Thu, 19 Sep 2024 06:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751487; x=1727356287; 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=AphQX4ql+BAtHg5yWLKAQ+5iWJXZHPjOafSUz9y3vMM=; b=Z6ntYAfPdPWmiElpYnv7lXPib7zLSXRJ4rVf7pJrhz9EqqtruX7g1fkxpDq39G9BFv FRFI4J6Bc2fvziux7oTb5eYpIr6J3bRncLjJ6cRarPgVZKMLKKTezR+jR4a1YccvTrM2 cpZLBhiFnfVeE+LphRLkSYZBv6Omn0SbWbaePd82RUOAj9xQqI+SfZEZ+HsfynTlitYQ yVBY5gQW8jbUSV3Clg+/VHD7SkzyEyr0YuW3E88yKXFR7WIo1oOiEfKZYpfvGUbnwB7c YU8CbI49yGinE8QRtLZs3RD2emxBOwdsBKhw4Iw5y3QU3x2Mt9CbQ1vCedPpfslXJRI9 iT8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751487; x=1727356287; 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=AphQX4ql+BAtHg5yWLKAQ+5iWJXZHPjOafSUz9y3vMM=; b=lHRkE12hDO9M0aPkPr3ae91z8bsTlm4UWeLfv7ASpXN5Y8L+dJeykzPahfFMdZUNND 4IvsJu2G8iYfnr7I4w5BQHVZvkYnTvaZXI38ng5zlg9S64o67m3tBdlhTZPOci5Hh+lO 4IOO6bU26d/DdcSwckRwvIQCrPkUbJgM3117HYtaB32nbpduyoJUjjqkPV21RY+Z/x8Y rhU0c5g0ZW9mc45DwF9tBYzyZyVC+C7w+Tgv2Jw8tOG+DRz4pQmfLPuu7yD2y7zNWFI/ cpUmMM3Om0ECCyZN8+CT2aBfO6lqeQtMg1hyBF+Wsht3+VxT/M/av2lxR5fPKc6anO/b k/QQ== X-Gm-Message-State: AOJu0YzbUWqSaHvo80uK4ckZXpYppPJnve+SkMUTpS40qLRrRbixB+vN jKME39+yJHVDZ/qYZGGhAV5nrSJwuuiHoMhmc9oMyv7/Vmw9ZS4vQHmq+JlwkAS1enErU8x4Dn7 y X-Received: by 2002:a05:600c:19c6:b0:426:5fe1:ec7a with SMTP id 5b1f17b1804b1-42cdb5913f2mr173613295e9.31.1726751486623; Thu, 19 Sep 2024 06:11:26 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:26 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/38] tests: add FreeBSD tests for aarch64/sbsa-ref Date: Thu, 19 Sep 2024 14:11:00 +0100 Message-Id: <20240919131106.3362543-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Marcin Juszkiewicz FreeBSD has longer support cycle for stable release (14.x EoL in 2028) than OpenBSD (7.3 we use is already EoL). Also bugfixes are backported so we can stay on 14.x for longer. Signed-off-by: Marcin Juszkiewicz Message-id: 20240910-b4-move-to-freebsd-v5-2-0fb66d803c93@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- tests/functional/test_aarch64_sbsaref.py | 43 +++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_aarch64_sbsaref.py b/tests/functional/test_aarch64_sbsaref.py index 528882f4fa9..89d0b9587a8 100755 --- a/tests/functional/test_aarch64_sbsaref.py +++ b/tests/functional/test_aarch64_sbsaref.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Functional test that boots a Linux kernel and checks the console +# Functional test that boots a kernel and checks the console # # SPDX-FileCopyrightText: 2023-2024 Linaro Ltd. # SPDX-FileContributor: Philippe Mathieu-Daudé @@ -184,5 +184,46 @@ def test_sbsaref_openbsd73_max(self): self.boot_openbsd73("max") + ASSET_FREEBSD_ISO = Asset( + ('https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/' + '14.1/FreeBSD-14.1-RELEASE-arm64-aarch64-bootonly.iso'), + '44cdbae275ef1bb6dab1d5fbb59473d4f741e1c8ea8a80fd9e906b531d6ad461') + + # This tests the whole boot chain from EFI to Userspace + # We only boot a whole OS for the current top level CPU and GIC + # Other test profiles should use more minimal boots + def boot_freebsd14(self, cpu=None): + self.fetch_firmware() + + img_path = self.ASSET_FREEBSD_ISO.fetch() + + self.vm.set_console() + self.vm.add_args( + "-drive", f"file={img_path},format=raw,snapshot=on", + ) + if cpu: + self.vm.add_args("-cpu", cpu) + + self.vm.launch() + wait_for_console_pattern(self, 'Welcome to FreeBSD!') + + def test_sbsaref_freebsd14_cortex_a57(self): + self.boot_freebsd14("cortex-a57") + + def test_sbsaref_freebsd14_default_cpu(self): + self.boot_freebsd14() + + def test_sbsaref_freebsd14_max_pauth_off(self): + self.boot_freebsd14("max,pauth=off") + + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeout') + def test_sbsaref_freebsd14_max_pauth_impdef(self): + self.boot_freebsd14("max,pauth-impdef=on") + + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeout') + def test_sbsaref_freebsd14_max(self): + self.boot_freebsd14("max") + + if __name__ == '__main__': QemuSystemTest.main() From patchwork Thu Sep 19 13:11:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829626 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320001wrn; Thu, 19 Sep 2024 06:18:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXGOtZK4H+C8eKmUkdVxibl5TLjqDio73vgnbcUE0XSi0yI9UJbtNydt9+LdENfrpJMa8IG3g==@linaro.org X-Google-Smtp-Source: AGHT+IFzC7LvzI7TDRLux8FJazHFQXRP8XsoZbFwalutoIAEDrsjKeB9pFmarmM+rU2FZ4CQS26k X-Received: by 2002:a05:622a:449:b0:458:253b:4151 with SMTP id d75a77b69052e-458603ddec9mr362413811cf.42.1726751937852; Thu, 19 Sep 2024 06:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751937; cv=none; d=google.com; s=arc-20240605; b=JYrIW38hymXWELrvgwxIN0r1p8GMisLlm0ZSZXAcWkBIGEcTGL0x38LoFUNuCuma57 38/HhcgUUOgPEztm5+s1Q+v28uXn3xocMSxovhIiqMXDyU8vmoHJNbmmuiRZdKO8/Sav OVVlYwvD3GyiO4z85ZC8vmmN3z9gh6z46mNIIV6MMn4wiAUT1k1NWRlgwOI+Bbiz6V6A KATclrc2JK1AwvFcG50PHuP7a0jrelsj6GHnKRnrY85Ex/sU5fPjll0ed3/mxkF3Mp69 UDJB2krUeFh53iiVPS+la76D1MXNQVh2d4zunMhEz8SQ05BAt7e/UMqtyUv/lKfOfneM 7YKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZOm9heTao6Me2uwud46NTPkGjdLAm0XKsYYYwqd37y0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=fdxYp3kSQz61Qxlr6ejJUtYRYmiQvdhiEK0C+5MiCsNqrgQzTNsJsUx7m10uCV/r1Q q8+e+AGdy9RyX52i7KOFxS6DbJmPLdIt5wFiW5qjVDEQGege54A+EKqnhhlv8oiRbsh3 jfBhEd2/70ioK6X3GQ41r3uhpOv3eKrS58a1luwnBjeBecx6J5E9ORx31qQyFohe68bT sy8zDTPUe0t2bEfbmhR5UcnCqqt0IaJwJF9wcvOoNUF0zBg/TdBr8hg5Ym1IhhlJseTV Ty3qn4Vt5wYDePMR0W+xTu6CMxvI+AJ+DOnl8RTcje4YUClRcWSdpBj1LPyTY20tDyEr OyKA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x8X3cuY6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45b1790f8dfsi17956141cf.442.2024.09.19.06.18.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x8X3cuY6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwl-0006Ex-82; Thu, 19 Sep 2024 09:11:47 -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 1srGwW-0005TC-Py for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:36 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwU-00015Q-R0 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42cd74c0d16so7470275e9.1 for ; Thu, 19 Sep 2024 06:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751487; x=1727356287; 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=ZOm9heTao6Me2uwud46NTPkGjdLAm0XKsYYYwqd37y0=; b=x8X3cuY6T538MRUw64nfnCaDhOuBwgC9ZIvigsuP3Aey0lrtu7gwAwrZss/RAxhy1R cs5gxp2JD8opo3GriG1pIVNPlYZDJvSC/I3BbtKDT8S6IMP1i2RGkUtXaPMV1QbTJ7Hc 3CqA43JDgDN8H0i5FBR7U129+qrqdcZuG451VuKcje13FtQsRkHARdOtB1r966jfvuxy VZk6r0rJ/RiBoBAhpz04jkCE0Amch9ZLx7XDCiqu3Ot6pHgeWtrcjD+Y2eiwunPnUC6h l95odzW9jAQQIiYHsbK9MmnanGpo6PaYdMsR0DDNMY+irE5gHNnTo10n3yn9mdS1G2iz WMdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751487; x=1727356287; 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=ZOm9heTao6Me2uwud46NTPkGjdLAm0XKsYYYwqd37y0=; b=q9Re/Dd+OSSD54ebcS39svqSL4gJ0zBRV4bh+7g91+a8jxdDtUxQonLANoZHfm20El 9k56sRyJdDNW5PLG75yUnNuShGYVyv3Zd4yKJpmraHIgUhH9tnOD+taRkOp1yTNOipCT 5mtNl+LGoPzz8uNl9Wu38CvDGdiXjRZCg8OmKHDBzM+SrfehVdUd/BGsXZAdw3Pot1uv TnNLFFTzcEDC+WF5alZEPTiYu/s8VG4iDDjXkHrfaXdoyQXXLWlmu9pCjG09pzuMz36N M087PjAD+N0InEr95QJkPyj2RKueIfBPttLrlaG58lgQ525Kn4LvaTg0skf9qPbDvxQu orHA== X-Gm-Message-State: AOJu0YwDIMugo3CLLoh7OBvMoS6xzmexvJ+DyDY38A80qjHWQfo1pi+y qkb99XuBOEJUm1JkV7eUc7YUubCECUR9Yfz0m+HzzaDEyY0+RTftHNnmjekZYM1CRk0/0fswKlj x X-Received: by 2002:a05:600c:5248:b0:42c:de6e:7f4d with SMTP id 5b1f17b1804b1-42cde6e8056mr182252465e9.34.1726751487289; Thu, 19 Sep 2024 06:11:27 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:26 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/38] tests: expand timeout information for aarch64/sbsa-ref Date: Thu, 19 Sep 2024 14:11:01 +0100 Message-Id: <20240919131106.3362543-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Marcin Juszkiewicz 'Test might timeout' means nothing. Replace it with useful information that it is emulation of pointer authentication what makes this test run too long. Signed-off-by: Marcin Juszkiewicz Message-id: 20240910-b4-move-to-freebsd-v5-3-0fb66d803c93@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- tests/functional/test_aarch64_sbsaref.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/functional/test_aarch64_sbsaref.py b/tests/functional/test_aarch64_sbsaref.py index 89d0b9587a8..1648e8ceb68 100755 --- a/tests/functional/test_aarch64_sbsaref.py +++ b/tests/functional/test_aarch64_sbsaref.py @@ -137,7 +137,8 @@ def test_sbsaref_alpine_linux_max_pauth_off(self): def test_sbsaref_alpine_linux_max_pauth_impdef(self): self.boot_alpine_linux("max,pauth-impdef=on") - @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeout') + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), + 'Test might timeout due to PAuth emulation') def test_sbsaref_alpine_linux_max(self): self.boot_alpine_linux("max") @@ -175,11 +176,13 @@ def test_sbsaref_openbsd73_default_cpu(self): def test_sbsaref_openbsd73_max_pauth_off(self): self.boot_openbsd73("max,pauth=off") - @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeout') + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), + 'Test might timeout due to PAuth emulation') def test_sbsaref_openbsd73_max_pauth_impdef(self): self.boot_openbsd73("max,pauth-impdef=on") - @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeout') + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), + 'Test might timeout due to PAuth emulation') def test_sbsaref_openbsd73_max(self): self.boot_openbsd73("max") @@ -216,11 +219,13 @@ def test_sbsaref_freebsd14_default_cpu(self): def test_sbsaref_freebsd14_max_pauth_off(self): self.boot_freebsd14("max,pauth=off") - @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeout') + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), + 'Test might timeout due to PAuth emulation') def test_sbsaref_freebsd14_max_pauth_impdef(self): self.boot_freebsd14("max,pauth-impdef=on") - @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeout') + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), + 'Test might timeout due to PAuth emulation') def test_sbsaref_freebsd14_max(self): self.boot_freebsd14("max") From patchwork Thu Sep 19 13:11:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829601 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316471wrn; Thu, 19 Sep 2024 06:12:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWpEIcb0KRyei7grbkDEi4iVerySVYWpJC0ihmXOzorbJwJkR/vn2vIU00d7aJuNg5K0JOgqw==@linaro.org X-Google-Smtp-Source: AGHT+IFakT+IumVDMntD2W5Mw+ljM/nDNg08j8rzbpAsexZ+2uyTcg0NajVEmnKNtAiGDJVOfdpk X-Received: by 2002:a05:6808:1814:b0:3e0:4d7f:ef73 with SMTP id 5614622812f47-3e071ae361bmr17062178b6e.37.1726751545910; Thu, 19 Sep 2024 06:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751545; cv=none; d=google.com; s=arc-20240605; b=f3Z3JdA/fw38Gd+gTHJhmS4L7ICdZeYLb+PjW5g8XHb1tZy7nzAphDxI6YI+9RBaHd 9bVSHRFbY9ThbxpX8BoRfsTbyg4xDFBaSw/dT0nHs5jum9xF6qFojoPf9snIvyyY678S yuobw3elf088nw8oE5NnrEd9qRe3/N92ceSkBWK8C6UjotmRbglz9EFt5BEk3p7UbrSU JXh4LH6tnOLn4qpRJzxICGi74RT1shULYs477W2J6y0v3yPCqdRAsC3BNvZ7eQp+f+AJ /zAnFnjq4v5KKDsrqM9rXyn4H+++Hn+7OxJaJY4b3aw/mD59P4vc85rOloVBuJvaAczE Dh9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4mM7auy/FOUtYcyKkKCo8MHtp21fztts72NvbXMteRw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=JaSL/55mYM2k5DFAswWWLJ8svp/YSpA8+jYOaBO1QrzgvDSHGiLpSrw2yx0CPxPPLD VvHncsz/vepdMflAMtM3NQuJb3YEzdx2BLf/CKJQ2LwaHeUmPSnR0FvfjzfVIfZ5kNn4 TAu3udIBQJnWOo8ZJlM27eG98xlCP0Z0OPL/UVKBCXlB1vtOvKKFZ/CK39KYqBDYKMri 79CD56OHCvo43LaRWYCuj3KuGAv9uY+e5O8IUBTZf0D+68UXvR5a0r44xyVtiFk19Rxz M184HOxBqJ0e94J+EqxASW4R4J1M4IIiteaVBBs87aYEtTOGU8BLcQjfDYsn9A84dIHn g7eQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y0fB4jMY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-49e6b0fc903si2146708137.128.2024.09.19.06.12.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:12:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y0fB4jMY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwj-0006A8-Po; Thu, 19 Sep 2024 09:11:45 -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 1srGwX-0005XQ-Rv for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:36 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwU-00015h-Qt for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:33 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2f75e5f3debso7786381fa.1 for ; Thu, 19 Sep 2024 06:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751488; x=1727356288; 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=4mM7auy/FOUtYcyKkKCo8MHtp21fztts72NvbXMteRw=; b=y0fB4jMYwAblAIHercYElA6N8oChrUZiqVUbOi9bWEUcXiDieZhIwyMFEKqTt5VA89 r177cLE30PJxPJDHBeTQLyN/VWMLJa3nZUdTmjIW76lzAWnM3t9z6HAnCFj3MSeP8JQQ dLGyxX6V7umRTq70we6Vx/pFhNz+QsRIGPdVMGs1izTQnUhCXHVM96OPStpwkN/3ztAm bnJvUhy7yBpPzTdw92GZmDxM9eU9+qq0dLCppexhKEfpxRuK6R46iTqVUssaAn6s4LQD kbK8Jq24M0tSKkP0vmZC7k/R4jcXaUiTwCmMHqI2g04xRYgJSP6VxNgnsr32CYGh1MYx H/qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751488; x=1727356288; 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=4mM7auy/FOUtYcyKkKCo8MHtp21fztts72NvbXMteRw=; b=AxXycTyeVmk70XVhAiefnh/hZdkeV4cZI08ay0vy+vfkJ31GQ0YCuUDhaYAQKqt7kK eZW/mA4Wx0dh6TMoFuwMhCXUdl38Wp97MiCTYemX5958UxcSAf52ORhmVK4T5Suv7LK6 5WGCOhyvrTjjwYD8g2DFDunQ100K/tjRzv244aecNU7ZPFEjkEYxPpbQZ2V0NSbPA/2P kf+pXWiRJ31KiZosulDO+zCyybhF4VSZUKa2LIyYJXdIa+Zwtj6XLypHh9tPlPk5gkSW 0U4L5AvQMQslnr7BRaDy+Lx5bi79AQdSpErI9JSAz+fBXYMbDK+LcMT1IXqEChgfPZwT ETiQ== X-Gm-Message-State: AOJu0YyIRbuHtXAZ0kn9Ogc7ityRYZ1323C20k8CtdqdJ1lkPhAiSRdj Y3PETgCBLBxU6JNhyTYHRYKaTd7J9zLpzDUiOxTxlb1y47iz7fpmOmHvqmDLlhuwdQQf5RPiCaP W X-Received: by 2002:a05:651c:2118:b0:2f7:528f:421e with SMTP id 38308e7fff4ca-2f79183a94emr112200111fa.0.1726751487939; Thu, 19 Sep 2024 06:11:27 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:27 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 34/38] tests: drop OpenBSD tests for aarch64/sbsa-ref Date: Thu, 19 Sep 2024 14:11:02 +0100 Message-Id: <20240919131106.3362543-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22d.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Marcin Juszkiewicz OpenBSD 7.3 we use is EoL. Both 7.4 and 7.5 releases do not work on anything above Neoverse-N1 due to PAC emulation: https://marc.info/?l=openbsd-arm&m=171050428327850&w=2 OpenBSD 7.6 is not yet released. Signed-off-by: Marcin Juszkiewicz Message-id: 20240910-b4-move-to-freebsd-v5-4-0fb66d803c93@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- tests/functional/test_aarch64_sbsaref.py | 44 ------------------------ 1 file changed, 44 deletions(-) diff --git a/tests/functional/test_aarch64_sbsaref.py b/tests/functional/test_aarch64_sbsaref.py index 1648e8ceb68..b50e1a59657 100755 --- a/tests/functional/test_aarch64_sbsaref.py +++ b/tests/functional/test_aarch64_sbsaref.py @@ -143,50 +143,6 @@ def test_sbsaref_alpine_linux_max(self): self.boot_alpine_linux("max") - ASSET_OPENBSD_ISO = Asset( - ('https://cdn.openbsd.org/pub/OpenBSD/7.3/arm64/miniroot73.img'), - '7fc2c75401d6f01fbfa25f4953f72ad7d7c18650056d30755c44b9c129b707e5') - - # This tests the whole boot chain from EFI to Userspace - # We only boot a whole OS for the current top level CPU and GIC - # Other test profiles should use more minimal boots - def boot_openbsd73(self, cpu=None): - self.fetch_firmware() - - img_path = self.ASSET_OPENBSD_ISO.fetch() - - self.vm.set_console() - self.vm.add_args( - "-drive", f"file={img_path},format=raw,snapshot=on", - ) - if cpu: - self.vm.add_args("-cpu", cpu) - - self.vm.launch() - wait_for_console_pattern(self, - "Welcome to the OpenBSD/arm64" - " 7.3 installation program.") - - def test_sbsaref_openbsd73_cortex_a57(self): - self.boot_openbsd73("cortex-a57") - - def test_sbsaref_openbsd73_default_cpu(self): - self.boot_openbsd73() - - def test_sbsaref_openbsd73_max_pauth_off(self): - self.boot_openbsd73("max,pauth=off") - - @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), - 'Test might timeout due to PAuth emulation') - def test_sbsaref_openbsd73_max_pauth_impdef(self): - self.boot_openbsd73("max,pauth-impdef=on") - - @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), - 'Test might timeout due to PAuth emulation') - def test_sbsaref_openbsd73_max(self): - self.boot_openbsd73("max") - - ASSET_FREEBSD_ISO = Asset( ('https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/' '14.1/FreeBSD-14.1-RELEASE-arm64-aarch64-bootonly.iso'), From patchwork Thu Sep 19 13:11:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829619 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp319839wrn; Thu, 19 Sep 2024 06:18:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVF0whn9fOOE26Ur1g020elbklwsd6NeZrlAwD/KdrmiviVbw+dP8y8LicJHaaa/WdFZ3y/xA==@linaro.org X-Google-Smtp-Source: AGHT+IFiqNsGqBDv1A/tLtSGPWFoNKyBErNTlryS8yT5TYq+PAfMFPh0UP5SzQUsCSB+N2Mkyj2k X-Received: by 2002:a05:6214:451c:b0:6c5:5114:96e8 with SMTP id 6a1803df08f44-6c57353515fmr343887276d6.21.1726751918616; Thu, 19 Sep 2024 06:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751918; cv=none; d=google.com; s=arc-20240605; b=XL8qDBqqSNZoTjdtWm3bGUyoV9/z8454qKr7J9fR9AhlDqn9n3ygXKl62989hvwPag g56XXCgM0r8Ppz9TnW0ac+nrwAhss/4OHrzKJREPHUILOx1/icv1VYDzf2ZOy7PsOMZN lOTOA//urkKiHYLaXtzanOyG5y6C2/EpkSkeaw87A6BTqsZQ2ievm5Tffn+aN86MvHEa LbCJehJ47/kxyUE0fgQky1YNpBnY6WmN0VJnNroYCeljJbwW2aHCQ3xOSPfry66SVqui SzwAGu3pn9/RbpTjFOddvSYXki6IqKpkL4eIbPkDYrgnBVl8q/HccnpLHo+MEbOlfITQ knPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZCeS0QeY0z/qj60fli0tjdGpJJ8vGB++h8x42DCkDKw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=UAw79vTYhOhRUTBkZOr0srYoPn1lnS21NNZndyufPJJ3oQcPWnnNzDBQI2U28/IaF6 Ke+/ZTdgnE6Vv1gepSah6TFRrE6teZ7H3brh5em22rfuumLEgIdzc0ETSPRqqw7OS2p0 z75GLPhZzRB74IPhrwIas9Sefa8epDey9EAPcw16sm+rl1YO0SgxOc0TQjfVTAxWK7We vp/aDapCkQO++QHpiN/KsNto4iZH1UUEB+3S4T09TXtGOFKOIuPtBHHPqHBNr6W6aNZ+ NYHckd/DfVY7Yl34BX3CW2IN5xFZreWsNEQvezJEhg0q6sdoTF9npOLBdK9ovtUs8MM9 gLhg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RRrmAJ2h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c75e5a69e0si18243076d6.456.2024.09.19.06.18.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:18:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RRrmAJ2h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwq-0006Yw-7W; Thu, 19 Sep 2024 09:11:52 -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 1srGwW-0005SV-KX for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:36 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwU-00015l-R9 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:32 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42cde6b5094so6862945e9.3 for ; Thu, 19 Sep 2024 06:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751488; x=1727356288; 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=ZCeS0QeY0z/qj60fli0tjdGpJJ8vGB++h8x42DCkDKw=; b=RRrmAJ2hgoueDiAevHZyFMfdISEjO3HiCcgodakdtBQrsDVHipslRfJmf2lzTELByM Row2wxc1yE818Hw2lfCsB6nde08gwe4lZHxzBXqV52KQA+BvkEI0lswbnpGV+5LrBQZo dTzIysPq5XiKUVJ7kTshb3Tv6m90SbCRFjMJNNkr49fdHnDxbkfG/5rybVHXqXl7jDdv vFt3THjsu42PUCfwRFoqlzoUSpyhWHdUV1jL251zX5zQh4rgDbZI73xCQs1OGl6C3YnP RwXQoc9xyg7rnCOa0VHRNR3UYwcthnULIaQ/yc1uAQw+9kZ7hf8VUUBVFz/yuT4bJESS 8f9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751488; x=1727356288; 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=ZCeS0QeY0z/qj60fli0tjdGpJJ8vGB++h8x42DCkDKw=; b=ge6RcSTSu3yGTCCh7vl+7kRKjbq9evd4oQZrHqEbLB/CsRrsYIRmVuJvuaYCqoZJpe IstzS+cTxJtRPvKu8vVQPyXCjhg4cn8Uk/rKCbILlFSPrjoOhw23QVXvwDuykvFv4E0Q mAZbBMcY/EycjJ6FrqCncAq9ea6mlBpK+0d25Yf7nwEnTJZEPt7bvu88u9d0Put/w030 jjfvJjn6J6NBeiodY+2+NWVnmViDFAdHawY1Y/LoadFeUIYZn5X3FCtAX0HE5PZ0Ebfh cPN4CvSDQnONuIWbsIEhpXE6wMEv6hxF4veuhvrdtvUocjG2vC4aQu0KZeD3Swor2oyc Yk6Q== X-Gm-Message-State: AOJu0Yxd1hj6enBuHTlPBzNAWmSZTCMkvg9xSaopr7QTfQ5CECot6N3K LAL4CPVVZVg38WcrnSujQURM+yQccciP4NrGO+rPZWa+nNcOyIrFNYQOm+AbhuOfKtm+teJdPVk d X-Received: by 2002:a05:600c:4709:b0:42c:ac9f:b505 with SMTP id 5b1f17b1804b1-42cdb58e130mr171475045e9.31.1726751488540; Thu, 19 Sep 2024 06:11:28 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:28 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 35/38] kvm: Make 'mmap_size' be 'int' in kvm_init_vcpu(), do_kvm_destroy_vcpu() Date: Thu, 19 Sep 2024 14:11:03 +0100 Message-Id: <20240919131106.3362543-36-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In kvm_init_vcpu()and do_kvm_destroy_vcpu(), the return value from kvm_ioctl(..., KVM_GET_VCPU_MMAP_SIZE, ...) is an 'int', but we put it into a 'long' logal variable mmap_size. Coverity then complains that there might be a truncation when we copy that value into the 'int ret' which we use for returning a value in an error-exit codepath. This can't ever actually overflow because the value was in an 'int' to start with, but it makes more sense to use 'int' for mmap_size so we don't do the widen-then-narrow sequence in the first place. Resolves: Coverity CID 1547515 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240815131206.3231819-2-peter.maydell@linaro.org --- accel/kvm/kvm-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index beb1988d12c..6c4cb263ba3 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -414,7 +414,7 @@ int kvm_create_and_park_vcpu(CPUState *cpu) static int do_kvm_destroy_vcpu(CPUState *cpu) { KVMState *s = kvm_state; - long mmap_size; + int mmap_size; int ret = 0; trace_kvm_destroy_vcpu(cpu->cpu_index, kvm_arch_vcpu_id(cpu)); @@ -459,7 +459,7 @@ void kvm_destroy_vcpu(CPUState *cpu) int kvm_init_vcpu(CPUState *cpu, Error **errp) { KVMState *s = kvm_state; - long mmap_size; + int mmap_size; int ret; trace_kvm_init_vcpu(cpu->cpu_index, kvm_arch_vcpu_id(cpu)); From patchwork Thu Sep 19 13:11:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829630 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320285wrn; Thu, 19 Sep 2024 06:19:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWDakCyi5Nef2ssg0oKgfw8wEV7jjAgDxLFMMRNrrC8WEmEhhGykRU4MWyv/5NwMEwUXg4YRg==@linaro.org X-Google-Smtp-Source: AGHT+IHTdsEMCEK8yFHnLC8AT9zryIa7ves3DU+9BMgSJ+cLc+bC0M2pVFmM5O10s7rcPD7Y6sZN X-Received: by 2002:a05:690c:6611:b0:6de:b23:f2c3 with SMTP id 00721157ae682-6de0b23f71amr20473257b3.7.1726751972771; Thu, 19 Sep 2024 06:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751972; cv=none; d=google.com; s=arc-20240605; b=IFKntz4ms+aXgGmZvWUK2bL44Qz1JyPaZaIIy4aNpt9pxkbgHblFd4fcrD6uHhFfXb rcqMAro0MoC8y1yg74AMx9KFteM6dR40sRaP3rpSfPJst9Jo+JVJ1cAr4JZFgB62znVl f4vIyoeUWuQbNUeGFvcLL+R+LqMtCgxpn2owe1N30DOQx/Y+hQU/VbJrDVBWRxwuyBT4 ITaKoan8q59jZ8QH8eEX3iffVdsV3P9+zCAlj77nzIRMXDhh/uTwn30wJtVd1tBOQuws j4qEEmJABQ/ubvZZxWJFdJOewk8ZdEhg0ALrKQX2y00ug3z+TZvMSlTSGHhCdVprqqNC 1xRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2kJBVTVE3hu5xqrb4mWZcjRn/GfkKIqvu4GFHzWSmhk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=SZioQjNKjLsvrsPVUtqWbcxtX3t03ItDfTdjwCs0U/3cIENTR4zyVz2mTiohVk3LHX jYEJLZ8/pZrMIy7SId9W6DZMpbhYKyWhYqZfpAjbkxcazwrNr5+i/OJ3xcSlMMNErqrL opMKNEwWaOY2Vcv0u81P4S4e+55y2v+Au1YHyEqNEQ/n11R9VUTNbk8CjSt86Q4SkXuu LhpfO8OcAkgkHnRckGb/j3zJLatZ59v/61oSyl+ZdXHOeBG6eMeCrbTIFWFqg/DTzgDc kwQZ2thy/9grlR8uBhBHS2JgkYqbwsZGqccxqE+WQyxyATmK/oQPhI6FO36anjO5Ncaj zTeA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=etH4A9JU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb08f5d8bsi181151885a.580.2024.09.19.06.19.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:19:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=etH4A9JU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwn-0006NQ-01; Thu, 19 Sep 2024 09:11:49 -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 1srGwX-0005Wq-Mv for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:36 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwU-00015p-SS for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:33 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42cacabd2e0so6929605e9.3 for ; Thu, 19 Sep 2024 06:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751489; x=1727356289; 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=2kJBVTVE3hu5xqrb4mWZcjRn/GfkKIqvu4GFHzWSmhk=; b=etH4A9JUNJzVvD86qbiEcWGjCnQ4n5eGTaZuw29ctxWERJ0NNaM5JtFTic/y/MhFQj PD3WME6ZitxA/Ag+YIEVKwy/2nONoGiQnRHrgZ0U5POii1jlHpLBPH7cWibhXtsLItwW o0nt7dbhgVisFo8Xw83aBFp8g9UQ85dlmSi9UvNr/2jJAPqOuA2lP9f+SfWsuqiVU6cN dSflwu0T7AY+PtmnkwhrSyUkA7cGT7O/iZeBXPkwKA8EwCRBYMlsPpIiSsnMjVh2uXAR RtBkLk3kGMh8wirBg0bSYYVAMB1iObP1WbzGyNQ9V5Jkf4XhUj6OYzkGmgBdB9ZA0B4J ACnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751489; x=1727356289; 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=2kJBVTVE3hu5xqrb4mWZcjRn/GfkKIqvu4GFHzWSmhk=; b=AhU5NZaO2Ma/tQbPDfMSuwAJuqGa1ucfpSQiIB2LdZnppyYUkUKQDUSio/f5ibO6yw NvrGnQd9N2Qtio2IoZHBonVmDwGTCr+0EctsDJdrqjalX7kHdl6v7orc97hgY5csum5a 2rb0NaDe53zKazQmqoSwZjv5GBvGx9Mr/G9cK2+Tz6VZeWPTj+AKbiDubIpoxhf4H25/ HJZC6E01DiNfeZQxHHW4dAXn3+azPur+/3cNNej4mfHH3YT9q2tNAfp5Yo1sdrDLHujy 0Jo51q2+GIQ843w7ilkQ2sY7NiaVljURU2WKlXcEJ4cMwuOdwZxHXxdOVuJ45ZJkaqS/ J6Gg== X-Gm-Message-State: AOJu0Yw8BGgRrq+j/a69PjC0CmL+IJ+m3+8zDsUZC8eojklVYYYmxNP9 9SZTFpa8WH5tjswT7bkOUXDKEX87po5vGzTqHA7rMPIEvo5pJQyesl3mZhoAt07kUBR1/qiTHfJ n X-Received: by 2002:a05:600c:4e94:b0:42c:a574:6362 with SMTP id 5b1f17b1804b1-42cdb522c74mr170364475e9.11.1726751489023; Thu, 19 Sep 2024 06:11:29 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:28 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 36/38] kvm: Remove unreachable code in kvm_dirty_ring_reaper_thread() Date: Thu, 19 Sep 2024 14:11:04 +0100 Message-Id: <20240919131106.3362543-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The code at the tail end of the loop in kvm_dirty_ring_reaper_thread() is unreachable, because there is no way for execution to leave the loop. Replace it with a g_assert_not_reached(). (The code has always been unreachable, right from the start when the function was added in commit b4420f198dd8.) Resolves: Coverity CID 1547687 Signed-off-by: Peter Maydell Message-id: 20240815131206.3231819-3-peter.maydell@linaro.org --- accel/kvm/kvm-all.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 6c4cb263ba3..fe4cd721d9b 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1525,11 +1525,7 @@ static void *kvm_dirty_ring_reaper_thread(void *data) r->reaper_iteration++; } - trace_kvm_dirty_ring_reaper("exit"); - - rcu_unregister_thread(); - - return NULL; + g_assert_not_reached(); } static void kvm_dirty_ring_reaper_init(KVMState *s) From patchwork Thu Sep 19 13:11:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829613 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp318286wrn; Thu, 19 Sep 2024 06:15:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXO0Q0YYwe5+QzUEojNdsPPFmerFzKyTMf9v/czyW2WztTnH1prCDP14qxE0Xxi0WuhKAvF1A==@linaro.org X-Google-Smtp-Source: AGHT+IHwre+GCRVTyTtAWf6kn9+aaDOK+RUU+hh7ppSwddT8moy+Fx+kMGYdsiGL/ISLBXcXg4u1 X-Received: by 2002:a05:6122:468c:b0:4fd:116e:6f4f with SMTP id 71dfb90a1353d-5032d50abdemr24419638e0c.12.1726751750487; Thu, 19 Sep 2024 06:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751750; cv=none; d=google.com; s=arc-20240605; b=hGhbdh5T4XJiCU+5UmVRwPPTq8SsYZ6SjwZR6G8aJjgKp2bIHM+JnSt4R+vBSr603X NfBEBQy8MDGaHTjifYn5bM1uKsmRWDkzh3T8jno9FG9api8dzYpuMX6x3VgGWP8cBUtc Bu+7odNQq0avxdAWiTa2IqL0xZU66BJT8fA+PYOyQe5rIJwwLRBBr4aW3klgFIA4uQYK EQ+F2MVncaLTdBfHN6db00EG/XLJJ5NiKHZpqWtvf19Phl2mB9Z+Issm8X9g5/gHXYEW aqQI4wigbkNUBQhz0kEzxcuPGFuFxO6NIzbZnpRY1WWpPMePflc8C0OicF8JwpOoby7d N1rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HkJpTrMUcMhqOQXaVK9JEJmDtKhFoBos/v7rYBsEpnY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Ea1qyHJ0pDmzIMU6S6UCKUG6DnxacZh+uBtoDcSFkzPclK7LFqChLCju5uWT0iyUdy YzD46Re94sVNSjK7f1epI7TNuimRk9KoWKdZzMX0iZ2KBJZvKCKyxO3H6eLNaclKxCnl dW4nJOXX++FL8i8eZJV3/DWCqoBcu9sy4AiiS5rk0F8BUsXC0od9XGzfLhbxs3uxHdYB lEt7A23KDoHW5uDHcdCgfJNFEwAotD9GXjQpx+ufEk4oZVkEG2jmoS9vLc6l/ux5u5DD zMqiBx5Tv8FBJgayBEDcOOqhLOHwAvSaTUd7rvHGL/LDZhOGEjJ403z0TVFc0+H59YJZ XBIQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kPSLVKSB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5035bc7d953si1529603e0c.228.2024.09.19.06.15.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:15:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kPSLVKSB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwx-00077T-U9; Thu, 19 Sep 2024 09:12:00 -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 1srGwY-0005Ya-3u for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:36 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwV-00015x-4l for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:33 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42e5e758093so7261885e9.1 for ; Thu, 19 Sep 2024 06:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751489; x=1727356289; 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=HkJpTrMUcMhqOQXaVK9JEJmDtKhFoBos/v7rYBsEpnY=; b=kPSLVKSB2kNTDxUXtG2qIolkNmP1wQ16+NYzdGNg1TWD34LTKn6M8QmeIBYaGzqZOR 9fQi4FRBAlq/l0G25HBkP4Vagij5MTGBrgW+cp3fFgOT5Zy6dADzB3rT2QfzoMPTXSpd iEGva8KrNHYS/Vi9Z7zXFU2kzv0EEjNZCiW7VQRdFKK6+zPocTFzTplW7nyEOyaA8nxP uxe6SjinF8TeglWuqq+JDmXFxHWx9cjR1VLH9plC/QEPtjKyqsV1HlbGPrMXIOQEw7ua 19uiptsL8H+fL+KoBZ9kWbWd8EC15asapfCNVfyBxCTovKfPkV97rqpiIT+YbqP1x9x/ BCVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751489; x=1727356289; 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=HkJpTrMUcMhqOQXaVK9JEJmDtKhFoBos/v7rYBsEpnY=; b=wrjl9CFC76RxvUBTmtoRVbu8reQYR7tVwKZ1xUEFvN3TVAOCJ8X6wreHqF9zggbll8 7FN8L00vnVHhX8NjTNFcDu6TkDE8WuAjoA0pkRhXXqanxWZLGl4l22rsQdZeRz0lRkFf 8VfFdpGetEs05moz0Io37JtKo/MngyY8yWs+ilkdVoG6mGoELpI7iNKPYw2PhtCRU4Yr N9LF/DOe1i+lz5GV7oBIv1YMRHtKyy8pqL2ta76snuOFajqEJ+D/M02sDBflZ4TbwLJT wTblfF7Wovm2HNf7QZ+LqpXCjxhHZ8kHRKNhmwQFaDIYttlrfu8/+beAciMm+By/ncPf vDdw== X-Gm-Message-State: AOJu0Yxxj/fRxh4xnBXgKATnT08SLKFzFkBy54eYOnUHG5+DLaB/xW3l udEHAJUaS5f11KRNdsapnInryihWsPSiFsgP4f16MZzJibU1Q9d/NDZDcaC00zOHecaYx7HV6aD v X-Received: by 2002:a05:600c:34c2:b0:42c:bad0:6c16 with SMTP id 5b1f17b1804b1-42d9070baa1mr145801465e9.2.1726751489462; Thu, 19 Sep 2024 06:11:29 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:29 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 37/38] target/arm: Correct ID_AA64ISAR1_EL1 value for neoverse-v1 Date: Thu, 19 Sep 2024 14:11:05 +0100 Message-Id: <20240919131106.3362543-38-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The Neoverse-V1 TRM is a bit confused about the layout of the ID_AA64ISAR1_EL1 register, and so its table 3-6 has the wrong value for this ID register. Trust instead section 3.2.74's list of which fields are set. This means that we stop incorrectly reporting FEAT_XS as present, and now report the presence of FEAT_BF16. Cc: qemu-stable@nongnu.org Reported-by: Marcin Juszkiewicz Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20240917161337.3012188-1-peter.maydell@linaro.org --- target/arm/tcg/cpu64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c index b9f34f044d0..01689208286 100644 --- a/target/arm/tcg/cpu64.c +++ b/target/arm/tcg/cpu64.c @@ -677,7 +677,7 @@ static void aarch64_neoverse_v1_initfn(Object *obj) cpu->isar.id_aa64dfr0 = 0x000001f210305519ull; cpu->isar.id_aa64dfr1 = 0x00000000; cpu->isar.id_aa64isar0 = 0x1011111110212120ull; /* with FEAT_RNG */ - cpu->isar.id_aa64isar1 = 0x0111000001211032ull; + cpu->isar.id_aa64isar1 = 0x0011100001211032ull; cpu->isar.id_aa64mmfr0 = 0x0000000000101125ull; cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; cpu->isar.id_aa64mmfr2 = 0x0220011102101011ull; From patchwork Thu Sep 19 13:11:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829632 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp320542wrn; Thu, 19 Sep 2024 06:20:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDUOVJZ0iAM3+ye+EYIFjEx+lsSI51b7OhBisxeO+tEJrElT39W2LcnTw3nGOLF0mwSdpxjw==@linaro.org X-Google-Smtp-Source: AGHT+IE182LtNRREP/ldlUo1rIDCJiYDNdncII10kToZS2BGEu8kHTupBDyseKAS9hpoW4hEV9uR X-Received: by 2002:a05:620a:1723:b0:7a9:ad47:edb1 with SMTP id af79cd13be357-7a9e5f78d21mr4603241285a.53.1726752006298; Thu, 19 Sep 2024 06:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726752006; cv=none; d=google.com; s=arc-20240605; b=IAnM9rH0OAZL3EQJVA84PJvpjYPswwcdpY+oUl8rpmj5TUZhjacpLieQxLfSUE5+43 FhTlx1z4pkr/Mbs/Leylchp1OpKGXVNO092QlGUzn+20o3kwyrxbMd9cfWpZSM2f3UE3 WfE9zaFRXy9ZUk1ynePm6jwC71ZfWmJtJdlC1qYTgoF6OGoKjmPeF9hrs6+TiYVG37G0 182zrbQwJIgAN368E80df4luenKMrx7Umrtd1rdfxTju9ZhdHAWJn+nW0VQ6Rbh91Kjs S4bva3DUeoMx9u1hsiheKw2Sv4cmNDCDb91wRagDHPO01/q6KHO6LkBxtFrT776qnLiE 2lMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=GJ3T7V06j5SeC8WLjBRAZGv39MO7ps0i73GVtRbGI+U=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=lggYYE+BVHxpnIK+5ydTSNpVS//PuicS10I1EGrPW3WpI1XK6NvuoTHRPnrUZIeQZo NhYQotV5Abs4r+dGWkEyt5GX+0TNzcAsdpXGxoSWRszvA7MDLRGVoeBGCeTAW/xkuqOn 0OwkNrLUOH4TOVO8E/97HpJub/c86q6trT616cQv59ElfH3JEGemu4Rp/D/Oi2Dxw7oV 7baCEvizsrmxdc7dR3vffMa/Eb5Jb8eUbBZdGhl/N5vvBYEClj0zEN3lkZJ2sIWFIzk8 AJMJ8zoxLW9nCxCuU2gzsR2Wm0iBecTbm65JZ/mpgq6DFOVjEKeo2ge6/lEEG44d4R/2 KWEQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h2R7AAGt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7acb08c5205si182666985a.355.2024.09.19.06.20.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:20:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h2R7AAGt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwo-0006TR-J0; Thu, 19 Sep 2024 09:11:50 -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 1srGwY-0005bm-UJ for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:37 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwW-000169-BB for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:34 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-42cae4eb026so7860475e9.0 for ; Thu, 19 Sep 2024 06:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751490; x=1727356290; 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=GJ3T7V06j5SeC8WLjBRAZGv39MO7ps0i73GVtRbGI+U=; b=h2R7AAGt42/tO3Vq7oQnLZ5umhwO5nIbrVm7PYQAUYPNJIfnwhGZJcxFY32xq7UfSA xIFnAgaB86fbQgBcv7p9omdnx3KLn/v4DfyQf2tr++8166fYGkWrJ+DoZnBITJpvfkTu bEALHBaWOiPRhS2wjIHGjOz7P8LLW7DImrIde/lW3aS9AukSXlkmQow7nl3bdvZCbqzb rpYs2fAz/1jKFO3MnF8OlvFhnOfcgN67dgidYBu3TH0yEd5C4ytfzQxL/MO+ptAYY3Am O2uNA8oi+2OUTOEtyx+CmrRmH+9nSqbjAcrz3xuJ2r4uI8/gHFhsvbTX+oRtJEtoWtZ2 ZE5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751490; x=1727356290; 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=GJ3T7V06j5SeC8WLjBRAZGv39MO7ps0i73GVtRbGI+U=; b=f2ycUfYo0nBJhBcLqKqk0yTcFvymXDFYvpZxdPaWlUFiIzHT55u66NJwhAwvvWw8iq fPO1Rv1e4gdRe400DqmJpkVmfmVexpuLkZimH2c5WqYetddRRavZHNjWkXhyh2kijdSP +DNY56uuWqAmu/kJJ3zisIjI1anDuCo1r99gooIJnZL59BznGufNRg57T02bUdgtDGWG 1wj4a4Q+HEoNFzntJf7dq0b7AjFhdmvirYztmqpFcTCh+jVGkkPpb4163l6gv8ohzcsN oae3fsA3Ftr3vk939hAvZ5oNFiPyihFbiGtaDBgak1IzW8bNvoT8qM5IEZ3GZMnlYaTn k5LA== X-Gm-Message-State: AOJu0Yx2n4QrDpSjTDitxdIlJfhee942ryM70/3Pz0Otsd7qh53eUHsn sjDl30Dcsu6NBe/dZl1Ouu/rH/bS4fufIuVdv9ZOyrEHcNzCMxepy5yZFGhQC/yICkgB/9hBtcc 4 X-Received: by 2002:a05:600c:4fc2:b0:42c:af2a:dcf4 with SMTP id 5b1f17b1804b1-42cdb56ae3dmr160130205e9.27.1726751490007; Thu, 19 Sep 2024 06:11:30 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:29 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 38/38] docs/devel: Remove nested-papr.txt Date: Thu, 19 Sep 2024 14:11:06 +0100 Message-Id: <20240919131106.3362543-39-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org docs/devel/nested-papr.txt is entirely (apart from the initial paragraph) a partial copy of the kernel documentation https://docs.kernel.org/arch/powerpc/kvm-nested.html There's no benefit to the QEMU docs to converting this to rST, so instead delete it. Anybody needing to know the API and protocol for the guest to communicate with the hypervisor to created nested VMs should refer to the authoratitative documentation in the kernel docs. Signed-off-by: Peter Maydell Reviewed-by: Daniel Henrique Barboza Message-id: 20240816133318.3603114-1-peter.maydell@linaro.org --- docs/devel/nested-papr.txt | 119 ------------------------------------- 1 file changed, 119 deletions(-) delete mode 100644 docs/devel/nested-papr.txt diff --git a/docs/devel/nested-papr.txt b/docs/devel/nested-papr.txt deleted file mode 100644 index 90943650db9..00000000000 --- a/docs/devel/nested-papr.txt +++ /dev/null @@ -1,119 +0,0 @@ -Nested PAPR API (aka KVM on PowerVM) -==================================== - -This API aims at providing support to enable nested virtualization with -KVM on PowerVM. While the existing support for nested KVM on PowerNV was -introduced with cap-nested-hv option, however, with a slight design change, -to enable this on papr/pseries, a new cap-nested-papr option is added. eg: - - qemu-system-ppc64 -cpu POWER10 -machine pseries,cap-nested-papr=true ... - -Work by: - Michael Neuling - Vaibhav Jain - Jordan Niethe - Harsh Prateek Bora - Shivaprasad G Bhat - Kautuk Consul - -Below taken from the kernel documentation: - -Introduction -============ - -This document explains how a guest operating system can act as a -hypervisor and run nested guests through the use of hypercalls, if the -hypervisor has implemented them. The terms L0, L1, and L2 are used to -refer to different software entities. L0 is the hypervisor mode entity -that would normally be called the "host" or "hypervisor". L1 is a -guest virtual machine that is directly run under L0 and is initiated -and controlled by L0. L2 is a guest virtual machine that is initiated -and controlled by L1 acting as a hypervisor. A significant design change -wrt existing API is that now the entire L2 state is maintained within L0. - -Existing Nested-HV API -====================== - -Linux/KVM has had support for Nesting as an L0 or L1 since 2018 - -The L0 code was added:: - - commit 8e3f5fc1045dc49fd175b978c5457f5f51e7a2ce - Author: Paul Mackerras - Date: Mon Oct 8 16:31:03 2018 +1100 - KVM: PPC: Book3S HV: Framework and hcall stubs for nested virtualization - -The L1 code was added:: - - commit 360cae313702cdd0b90f82c261a8302fecef030a - Author: Paul Mackerras - Date: Mon Oct 8 16:31:04 2018 +1100 - KVM: PPC: Book3S HV: Nested guest entry via hypercall - -This API works primarily using a signal hcall h_enter_nested(). This -call made by the L1 to tell the L0 to start an L2 vCPU with the given -state. The L0 then starts this L2 and runs until an L2 exit condition -is reached. Once the L2 exits, the state of the L2 is given back to -the L1 by the L0. The full L2 vCPU state is always transferred from -and to L1 when the L2 is run. The L0 doesn't keep any state on the L2 -vCPU (except in the short sequence in the L0 on L1 -> L2 entry and L2 --> L1 exit). - -The only state kept by the L0 is the partition table. The L1 registers -it's partition table using the h_set_partition_table() hcall. All -other state held by the L0 about the L2s is cached state (such as -shadow page tables). - -The L1 may run any L2 or vCPU without first informing the L0. It -simply starts the vCPU using h_enter_nested(). The creation of L2s and -vCPUs is done implicitly whenever h_enter_nested() is called. - -In this document, we call this existing API the v1 API. - -New PAPR API -=============== - -The new PAPR API changes from the v1 API such that the creating L2 and -associated vCPUs is explicit. In this document, we call this the v2 -API. - -h_enter_nested() is replaced with H_GUEST_VCPU_RUN(). Before this can -be called the L1 must explicitly create the L2 using h_guest_create() -and any associated vCPUs() created with h_guest_create_vCPU(). Getting -and setting vCPU state can also be performed using h_guest_{g|s}et -hcall. - -The basic execution flow is for an L1 to create an L2, run it, and -delete it is: - -- L1 and L0 negotiate capabilities with H_GUEST_{G,S}ET_CAPABILITIES() - (normally at L1 boot time). - -- L1 requests the L0 to create an L2 with H_GUEST_CREATE() and receives a token - -- L1 requests the L0 to create an L2 vCPU with H_GUEST_CREATE_VCPU() - -- L1 and L0 communicate the vCPU state using the H_GUEST_{G,S}ET() hcall - -- L1 requests the L0 to run the vCPU using H_GUEST_RUN_VCPU() hcall - -- L1 deletes L2 with H_GUEST_DELETE() - -For more details, please refer: - -[1] Linux Kernel documentation (upstream documentation commit): - -commit 476652297f94a2e5e5ef29e734b0da37ade94110 -Author: Michael Neuling -Date: Thu Sep 14 13:06:00 2023 +1000 - - docs: powerpc: Document nested KVM on POWER - - Document support for nested KVM on POWER using the existing API as well - as the new PAPR API. This includes the new HCALL interface and how it - used by KVM. - - Signed-off-by: Michael Neuling - Signed-off-by: Jordan Niethe - Signed-off-by: Michael Ellerman - Link: https://msgid.link/20230914030600.16993-12-jniethe5@gmail.com