From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196598; cv=none; d=zohomail.com; s=zohoarc; b=Kwgg5FusIVAll6IQlb08KINZX6U+CkKvsQpkVp0BAlihht7yhAvzoPArccjYf944QT///eJNPNuTqd92Yw3LjVS5RbZzujS30XeJuAwDAoYvAmlIiAkTi3xdIjz1/JExVoH/p68ZLkDKtxmBtGxVzxn4vxZybIw4ccbal8tQvn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196598; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KWgoYLfzMnfDNpgTk3QgWKgKCgGOVK31L1W5B2Ww47g=; b=HvKseFWQV1fW4qNYzrFnd8a1CsEbgi36lQzV8qeUfCob5hl+1czxAP8KK3oXgq4QlU+AUN8+X4AwJZI6VpPo/aeHk3jDGxiFEOsX/xCPUbv3KMc8p/L9njpOJaDXWWrEL1WwJQoImrgHE4YmtC04Zn7ujEQyKuFjY9j+wVtEOAo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196598874221.354037619859; Tue, 16 Jul 2024 23:09:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxqs-0003h6-M5; Wed, 17 Jul 2024 02:09:23 -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 1sTxqn-0003b0-SF for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:17 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxqm-0002zv-7b for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:17 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-70af4868d3dso4867572b3a.3 for ; Tue, 16 Jul 2024 23:09:15 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196553; x=1721801353; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KWgoYLfzMnfDNpgTk3QgWKgKCgGOVK31L1W5B2Ww47g=; b=veWzBQxD0YVDv6FJjCz+6Ju1yJ99iN2ZlHVsffzKZNgi33aRdisbUzD7Lo6uWWlxO5 mDycysinnE9PAjS5PMVmAs4vS2OLQL9A/wxxQ/ncduje1RMxZEqejurQ7qXAyBCRbk9z ME5apeYRetdh/PxJkBO44BrGMfnTbS+23HoUV9OTAAmLl1oJOBxRIX27byoWEe3gQpm1 AoJB+WkTVfrIWsA+nNEEzGb5kMzlGUnx0TowSOI47XYcZkyIWTgzbcpuG81j0906WRK2 OIGMvSCBTTOgBvwPrBgD8yPffkA8M4QB+Xmoka8GTLVitgPUnB9v8qvGxfgqgb5qb33K kijQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196553; x=1721801353; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KWgoYLfzMnfDNpgTk3QgWKgKCgGOVK31L1W5B2Ww47g=; b=dNxrX/4lDRnEnEAnCh50rugnocmdU5V2PTiuEUxMbEC+LYGMwPelkhkp/G+I2r95+G 6G2H4ryASx4O9MqBVc/U3Go38GcUW8fx8FT3ZVLtgYOknaD2E20WrMmGb4/woQ2L6Dqg Gb9xVG9tNtHHSwgv849f0Za1fELyqnlVT7+2LfKu/nCi+QNNXZ6Pi6eKA2AfL3L7lQY0 UzjGNZ6V4bkvhZrlotnebdLlcAC/EILoWwN+3ZgryCot42N3JXGT64hFd6oqryoRVKcl ADohph6Fcwk00imkl1o+YWMjuekmZqXdiFTn29E4kdYEHVf+KgIAWwxjhZyLx2tJd784 ywmw== X-Gm-Message-State: AOJu0YwFphwd0GMf4j9cSFZTGjyBBlxHZSU0L01N06R8KDvSgYq1GqRx d0FJBk/XsZDgqWmYhHRDB842yXAp2MvGpNrGSrak1Xv1rMHzXmk7SF6Ss90m0cbHGxkZCAU28QR w3HM= X-Google-Smtp-Source: AGHT+IENJdX+sd2EvgsVhhsmOOBx+QxXg372T2mXj71VnuhB1YP3b5epQuoEYW2wyfr1bbUsEBv83A== X-Received: by 2002:a05:6a00:2d28:b0:704:209a:c59e with SMTP id d2e1a72fcca58-70ce4fb5cfdmr788811b3a.9.1721196553444; Tue, 16 Jul 2024 23:09:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 01/17] target/arm: Use tcg_gen_extract2_i64 for EXT Date: Wed, 17 Jul 2024 16:08:47 +1000 Message-ID: <20240717060903.205098-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196600807116600 Content-Type: text/plain; charset="utf-8" The extract2 tcg op performs the same operation as the do_ext64 function. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 559a6cd799..e4c8a20f39 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8849,23 +8849,6 @@ static void disas_data_proc_fp(DisasContext *s, uint= 32_t insn) } } =20 -static void do_ext64(DisasContext *s, TCGv_i64 tcg_left, TCGv_i64 tcg_righ= t, - 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 =3D 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 * +---+---+-------------+-----+---+------+---+------+---+------+------+ @@ -8903,7 +8886,7 @@ static void disas_simd_ext(DisasContext *s, uint32_t = insn) read_vec_element(s, tcg_resl, rn, 0, MO_64); if (pos !=3D 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; @@ -8924,10 +8907,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 !=3D 0) { - do_ext64(s, tcg_resh, tcg_resl, pos); + tcg_gen_extract2_i64(tcg_resl, tcg_resl, tcg_resh, pos); tcg_hh =3D 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); } } =20 --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196642; cv=none; d=zohomail.com; s=zohoarc; b=gQGL74cI9g8qnmIh/yXu3gEkmlpsotwpYZanm6yZ/DUUGR0YQKBjskt8rDkrOcoJVtVvt5wybDNmceV47Ym73si87Ehda9hV1aixC1YkTaSuOcsHt+lo3LftQJph7cJabhQqTR/+FMfzNREvyhJglVbJ3fyM7Zc5Pzd4+slsouc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196642; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=f2RBO2LUzalMayDyUmUonTOmlQcuZjzRHo/lvECYNRo=; b=A8c7L6T+8NWsP8KOXeEUruOhbKI43OYBexO9BSkd20wIeNzpfyyUVbtjTSCcY0fWgpNlVDjzQxys1ALJYz1izaYbthofNjRDMCPdzbC4+s8gYmh13pY1UuroYPi+HxZCtSNOkGtzDpxpXfgCMDNu1EwhBOwnu4pTSXzwkxh4inY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196642668206.7699536435964; Tue, 16 Jul 2024 23:10:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxr4-0004AY-0c; Wed, 17 Jul 2024 02:09:34 -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 1sTxqp-0003ec-DN for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:20 -0400 Received: from mail-oi1-x231.google.com ([2607:f8b0: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 1sTxqn-00030J-GM for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:19 -0400 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3d92d1a5222so3818868b6e.1 for ; Tue, 16 Jul 2024 23:09:16 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196556; x=1721801356; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f2RBO2LUzalMayDyUmUonTOmlQcuZjzRHo/lvECYNRo=; b=vWtC2H25NXyYECW+9mQtMomdlMIfNIsnNRxSNn3UNFrb8CQ+bWy0H7DqRNJBLbrW3I GQFPzFN3P2Nc+a7r/tbHJWVWhdW7sj2dNKGdo7qyg+nLd96jNYKN+UT2vGBnbMuKnMkU vPf8s/cTZhHploHIvm3OAr8wkOhyhm8oD19pxS/mCAFgKPJa21oo9dzCAAOQnAF5L5wm Ksw3/uGNcuQHto8GUW5Rxme04GwPMS3ESTmZXJjnzZi+gqRUDT9mLX9lsfmU+po5wUso uF4edj7BQSokc06jl9/OfeYB/Pcc84CI/+upTG2zyPaOtk/IPi7smB1z6adAgOQ1ebgW 8gew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196556; x=1721801356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f2RBO2LUzalMayDyUmUonTOmlQcuZjzRHo/lvECYNRo=; b=D6MLVqWXEz9lusKhW4LSD+OM9/bK8eEvG2n7borPzekXEhdUzskGoZeT9tsZTqhJDa jr634xf4Imp4hA79YoQd9az1eSxlRwv3lzfwlLq+MzkfRwrZ6Ot8xTVjT6tOBMzEx3ZE KO8PCsLm5Rdf94bDReZ6Cha0WkZuqwHvhSgDvJms3v8frqmlayURFoq6hjC8TrCtPZVk DF76Yj6Aa490BPGPQ+MuDRCot+Zr46nRihaAUZ6ove9AFM/yZbmwgQMC5bUYjOEI7/8h 0/K8A4A9nb3/0OM9xqI2Nr3gV1Vdln2t3WQ8arFO4dSfVjsMZTdhllqQSlLLeYhYMEEy ARGw== X-Gm-Message-State: AOJu0Yz34lTN73GXki94U3lmg0aW92ay+Vuk9gC8hZbFfHH4wSeXQHBZ DFExJdj8Gl9Br8tpSuXDEgjIZQf9juLFXWwF1TS7BZoQCZYG8ATFTDgQI/5FYAhtqYNKnUSKDTD If8k= X-Google-Smtp-Source: AGHT+IErn86g8LvF0rU3MJBgaqD9phV1VMJgjdNToPQyboie7pkup7VciXN52y7llZs7uJDO5rqhCA== X-Received: by 2002:a05:6808:1509:b0:3d9:e1d1:1580 with SMTP id 5614622812f47-3dad1f494a2mr825077b6e.21.1721196556031; Tue, 16 Jul 2024 23:09:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 02/17] target/arm: Convert EXT to decodetree Date: Wed, 17 Jul 2024 16:08:48 +1000 Message-ID: <20240717060903.205098-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196642934116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/tcg/translate-a64.c | 121 +++++++++++++-------------------- target/arm/tcg/a64.decode | 5 ++ 2 files changed, 53 insertions(+), 73 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index e4c8a20f39..6ca24d9842 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6541,6 +6541,54 @@ static bool trans_FCSEL(DisasContext *s, arg_FCSEL *= a) return true; } =20 +/* + * Advanced SIMD Extract + */ + +static bool trans_EXT_d(DisasContext *s, arg_EXT_d *a) +{ + if (fp_access_check(s)) { + TCGv_i64 lo =3D read_fp_dreg(s, a->rn); + if (a->imm !=3D 0) { + TCGv_i64 hi =3D 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 =3D (a->imm & 7) * 8; + int elt =3D a->imm >> 3; + + if (!fp_access_check(s)) { + return true; + } + + lo =3D tcg_temp_new_i64(); + hi =3D 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 !=3D 0) { + TCGv_i64 hh =3D 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) */ @@ -8849,78 +8897,6 @@ static void disas_data_proc_fp(DisasContext *s, uint= 32_t insn) } } =20 -/* 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 =3D extract32(insn, 30, 1); - int op2 =3D extract32(insn, 22, 2); - int imm4 =3D extract32(insn, 11, 4); - int rm =3D extract32(insn, 16, 5); - int rn =3D extract32(insn, 5, 5); - int rd =3D extract32(insn, 0, 5); - int pos =3D imm4 << 3; - TCGv_i64 tcg_resl, tcg_resh; - - if (op2 !=3D 0 || (!is_q && extract32(imm4, 3, 1))) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - tcg_resh =3D tcg_temp_new_i64(); - tcg_resl =3D 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 !=3D 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[] =3D { {rn, 0}, {rn, 1}, {rm, 0}, {rm, 1} }; - EltPosns *elt =3D eltposns; - - if (pos >=3D 64) { - elt++; - pos -=3D 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 !=3D 0) { - tcg_gen_extract2_i64(tcg_resl, tcg_resl, tcg_resh, pos); - tcg_hh =3D 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 * +---+---+-------------+-----+---+------+---+-----+----+-----+------+---= ---+ @@ -11818,7 +11794,6 @@ static const AArch64DecodeTable data_proc_simd[] = =3D { { 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 }, diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 2922de700c..05927fade6 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 --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196715; cv=none; d=zohomail.com; s=zohoarc; b=VknVAyF2lGaVgkyXzCG9gjVos7YkI2PMwcO2V7RVgGznDXzUNBvz4v9zJixWPxBCVqyGpAe6mzY21VKq9S2O6KHWFt2P3h2piwS4cV5eHaJXMDvnCQgiqODqtFoEWGNIqVcXH1SipV5iDoKmPdH9SPJQa6+fNvCTLRDZhoKTcws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196715; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L50cMFgY8xp9UNkN7NVIRy+rY10HarTYUNyP2m/NWeU=; b=KA6ZNf7h4zs3TG/HreT8yF5WpSsbBWtI9Mt2LhnsqErTx/jiJYlL2gGlxceV/eoGTElKoAgPWXdWYo4vXfDR+6P7H1IeLxXVtSC1709EDChkXYT4hAOL8wniXFBHStiAwH9uFhoK/w6AwdZEp82YEUG3UKCElDQEU0CG8MA2WNc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196715351992.3385463368538; Tue, 16 Jul 2024 23:11:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxqx-0003xQ-Kr; Wed, 17 Jul 2024 02:09:27 -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 1sTxqs-0003gb-1I for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:22 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxqq-00030z-B5 for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:21 -0400 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-7039e4a4a03so3787649a34.3 for ; Tue, 16 Jul 2024 23:09:19 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196559; x=1721801359; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=L50cMFgY8xp9UNkN7NVIRy+rY10HarTYUNyP2m/NWeU=; b=IsQp/wZDpu8zLgwZAb0SbFhmaMOsmMnQ4UKFX3/VppMXOjkux3SW+KDFI2N/Bp6+8F ASz2BDceSrwj4mD3ucP4rL9+nLKJTkVDj8Q9zRFwMI+EJ8/CbzG6FD+kXjggrbZVabzo fo322R/pORCFszttDv/1jBG8CO7ckXGFJKxOFdPTEy7rd4siYhCrm7kvnVUqvbC277PI N4sB5dJRhAMfP9/QkAaflm3J8pketNVs7IIPQIG7Q3G9WAknPlSKpf+49sqjvcQaY2bj DTmm3UYmjvDWlADzKiNNtBYuLHGoCDwkKf6MbHlQzEhf1TnPvc5DQuOBXQtKG3QdFxgn 0nXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196559; x=1721801359; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L50cMFgY8xp9UNkN7NVIRy+rY10HarTYUNyP2m/NWeU=; b=Y0IUojmIO8tPJpKgTtSWCnQdv7PaoXVL0YfdjmdxBCkLUYlbrAMOWrPPYfHt8LSwuR EfCbUqc/qSiLnpSR18aSSFJxljV6QMjBaIgvRKRx0IInKPiyPPScNceviqacAikrx4Ii JxcZ4Z1H+XmPCXLkunPgMFU812a2YW23OEj2+Ez/L3uASteh06Nq7NBK9F5WCcuCk/fI oJsI2u8Tw74gFuBnNPqkwVV8cQtyjWSX71z2GT3yF0SaWT+A3Y4RHW+pRfy7o8f8Yqtc K/XU6DfqQ9DOD/y6PXtN/IWGnm0FuMfG1aOAoFHVymJylOw0GR9chM3Gf4KFTPlUMqwF clMQ== X-Gm-Message-State: AOJu0Yz3b98uWiL6MpOHBQAZTT93qF4F5mleAalCBdycihH7DmGUphTf ux0NI6Rg0q6e3uuhvuUjkuTpusK5R2ab9ULJyidVK8RVWHSSFScgjUiQ3Q2THvulKBvc6Um7vj4 CzDQ= X-Google-Smtp-Source: AGHT+IG7+VplK6yo0DmCdIg8IbahZjpS0D/QCL0K1cA3rpOPTn8ABDO8yWL2iFwj4GkDkpiXKru5aQ== X-Received: by 2002:a05:6830:4181:b0:703:ba24:7320 with SMTP id 46e09a7af769-708e378942fmr913594a34.10.1721196558470; Tue, 16 Jul 2024 23:09:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 03/17] target/arm: Convert TBL, TBX to decodetree Date: Wed, 17 Jul 2024 16:08:49 +1000 Message-ID: <20240717060903.205098-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196717248116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/tcg/translate-a64.c | 47 ++++++++++------------------------ target/arm/tcg/a64.decode | 4 +++ 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 6ca24d9842..7e3bde93fe 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -4657,6 +4657,20 @@ static bool trans_EXTR(DisasContext *s, arg_extract = *a) return true; } =20 +static bool trans_TBL_TBX(DisasContext *s, arg_TBL_TBX *a) +{ + if (fp_access_check(s)) { + int len =3D (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 */ @@ -8897,38 +8911,6 @@ static void disas_data_proc_fp(DisasContext *s, uint= 32_t insn) } } =20 -/* 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 | R= d | - * +---+---+-------------+-----+---+------+---+-----+----+-----+------+---= ---+ - */ -static void disas_simd_tb(DisasContext *s, uint32_t insn) -{ - int op2 =3D extract32(insn, 22, 2); - int is_q =3D extract32(insn, 30, 1); - int rm =3D extract32(insn, 16, 5); - int rn =3D extract32(insn, 5, 5); - int rd =3D extract32(insn, 0, 5); - int is_tbx =3D extract32(insn, 12, 1); - int len =3D (extract32(insn, 13, 2) + 1) * 16; - - if (op2 !=3D 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 * +---+---+-------------+------+---+------+---+------------------+------+ @@ -11792,7 +11774,6 @@ static const AArch64DecodeTable data_proc_simd[] = =3D { /* 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 }, diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 05927fade6..45896902d5 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1141,3 +1141,7 @@ FNMSUB 0001 1111 .. 1 ..... 1 ..... ..... ..= ... @rrrr_hsd =20 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 --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196626; cv=none; d=zohomail.com; s=zohoarc; b=Sx2MDU8WypuIkl314p8qH6fS99NLdn1qkQHNp3QrGVn9LZ8WOPS7ihkgN8ozzf1jmbUiJkoNW1HalqKWUN1soJ38qXO5qXa1midqoGCFggjmKdYLs96B/6wPVM47IEew0b1oU2cFlzSN7Fau/LcMmP5reebQ/3/hPzvOSaTzPuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196626; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=x2uOrGaVn9GiD8dOMFplEIoJVLJP1krEvohvtVj4ays=; b=gpF6U4zdFhU8dbIOgL0JEoI5YfbaVK5HiFoLgt+NnBPJR9ZjJWLJR4O6gc93doeXSntYBKS1QlC83z6KtiCQ1m9ARgCHJnjptOKJL+yeVYNcF5jRd93u5EkZorm3uwIQcPAlPkFaGqPf5YCbKus6F+v2RewHo0SpjbIZ43Sb5v8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196626297879.8708296643867; Tue, 16 Jul 2024 23:10:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxr9-0004XG-Mg; Wed, 17 Jul 2024 02:09:39 -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 1sTxqu-0003nh-Hw for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:25 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxqs-00031V-It for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:24 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-70b0d0a7a56so4836768b3a.0 for ; Tue, 16 Jul 2024 23:09:22 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196561; x=1721801361; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x2uOrGaVn9GiD8dOMFplEIoJVLJP1krEvohvtVj4ays=; b=ll3pN3EAcUZVZhm3XlvWQo7o6RCT/WOoEbNmdkIOfsVkhd+R8stQXjoZ85QnYs8uj/ CGe2m15VmdRCfr01c59hZX68+5cMo+9xcmzwJGjUs3JkCbXIylxf9zNV0fY/1O7LXmxS cWRBPUxw9GwOCvMkz7LNZyLubH1izZ6tSdTqFMptDPGPBmKCgz/Ou2ABxphbOFARgR72 YL1WAB1BeDqFqN5ce7PFiwoplGMT5DkYxkMjB9zugNACB32Z23aWKFihvu0dyNk8/Cd1 OnFzJJuL3C/NSvEyK12ldaDz6mHf4Hvg/nHxmiEzqWeNTeLEvOABeW0W6c5GcufJjRgz 0evg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196561; x=1721801361; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x2uOrGaVn9GiD8dOMFplEIoJVLJP1krEvohvtVj4ays=; b=KNLYbaAWLI1/0vRre3q6HOE7BI2C1nq6ae2dskhJFJRxVUl2AFh9oHD4+aIWOdAKgX ZikAkeAvldceeG7OxKYO6Synj4kBsfaUN5ToKqnRArQkOCI//lDWbKTv7EQoAsJW+umD CZWAzqeMwh6DZCQDr7nbBekcnLtmqjeNsv8JgiU29txPb/wxsCoLLwFXGWG4aDKYyV3+ Bglr3K3kTIf/RpAzus7ekt+9IwS6cjdJCawOsAnQ90hXwmo4RRXUXy06rbdGuSa4/Gne aq2HQV8GVGeMirmoQvjZUXIWIpD8rReymHSfmi9qQkkjKPeRrMO+Ey/3bIqlOEjHDLcJ 43pw== X-Gm-Message-State: AOJu0YxbCNFvNrzJ+OcJ5rfk1dc5ElGzSHx2OdYIGbqPW9uVaBLJz8N3 Nj1TfLP4ZPR3VEmlWTu7iwZ3iqlyiMx+Tssr9FxTrxPW7hkHGZgWN2IonAF07L7v92P6WN6+/h5 rCCo= X-Google-Smtp-Source: AGHT+IE+4Ne+0TGibxZXpuEd8tSrbloHlOSBZ0bv+QYXG11LxF20foz2V+NGh4L5c6VlhFYnGKT5WA== X-Received: by 2002:a05:6a00:3d0a:b0:706:6bdc:4de5 with SMTP id d2e1a72fcca58-70ce4f74756mr748481b3a.7.1721196561051; Tue, 16 Jul 2024 23:09:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 04/17] target/arm: Convert UZP, TRN, ZIP to decodetree Date: Wed, 17 Jul 2024 16:08:50 +1000 Message-ID: <20240717060903.205098-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196626873116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 158 ++++++++++++++------------------- target/arm/tcg/a64.decode | 9 ++ 2 files changed, 77 insertions(+), 90 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 7e3bde93fe..e0314a1253 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -4671,6 +4671,74 @@ static bool trans_TBL_TBX(DisasContext *s, arg_TBL_T= BX *a) return true; } =20 +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 =3D a->esz; + int datasize =3D a->q ? 16 : 8; + int elements =3D datasize >> esz; + TCGv_i64 tcg_res[2], tcg_ele; + + if (esz =3D=3D MO_64 && !a->q) { + return false; + } + if (!fp_access_check(s)) { + return true; + } + + tcg_res[0] =3D tcg_temp_new_i64(); + tcg_res[1] =3D a->q ? tcg_temp_new_i64() : NULL; + tcg_ele =3D tcg_temp_new_i64(); + + for (int i =3D 0; i < elements; i++) { + int o, w, idx; + + idx =3D fn(i, part, elements); + read_vec_element(s, tcg_ele, (idx & elements ? a->rm : a->rn), + idx & (elements - 1), esz); + + w =3D (i << (esz + 3)) / 64; + o =3D (i << (esz + 3)) % 64; + if (o =3D=3D 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 << e= sz); + } + } + + for (int i =3D a->q; i >=3D 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 */ @@ -8911,95 +8979,6 @@ static void disas_data_proc_fp(DisasContext *s, uint= 32_t insn) } } =20 -/* 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 =3D extract32(insn, 0, 5); - int rn =3D extract32(insn, 5, 5); - int rm =3D extract32(insn, 16, 5); - int size =3D 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 =3D extract32(insn, 12, 2); - bool part =3D extract32(insn, 14, 1); - bool is_q =3D extract32(insn, 30, 1); - int esize =3D 8 << size; - int i; - int datasize =3D is_q ? 128 : 64; - int elements =3D datasize / esize; - TCGv_i64 tcg_res[2], tcg_ele; - - if (opcode =3D=3D 0 || (size =3D=3D 3 && !is_q)) { - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - tcg_res[0] =3D tcg_temp_new_i64(); - tcg_res[1] =3D is_q ? tcg_temp_new_i64() : NULL; - tcg_ele =3D tcg_temp_new_i64(); - - for (i =3D 0; i < elements; i++) { - int o, w; - - switch (opcode) { - case 1: /* UZP1/2 */ - { - int midpoint =3D 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 =3D 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 =3D (i * esize) / 64; - o =3D (i * esize) % 64; - if (o =3D=3D 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 =3D 0; i <=3D 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 * @@ -11774,7 +11753,6 @@ static const AArch64DecodeTable data_proc_simd[] = =3D { /* 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 }, diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 45896902d5..5bd5603cd0 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 =20 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 --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196612; cv=none; d=zohomail.com; s=zohoarc; b=MjYFbPdJNuciKy/lFOoahYJ01gXEo+2VOWFXreWUUiaWkDXP/N0xmhQarCpYOinfFbZyvJKPBPbWlQmtCvijXN5ftgV6YSRuwR0P/053k/MDaZa1qgYsR2o9/uAae0khHfiOK5+hQNwiLu7t0EoLOhGbMDaOgsX4QwhY5qdBnks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196612; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AQvo1o7d9A2n1k+IrItgyP1l57+YBBMV11r5JjrVtfk=; b=Q0B07HmmkGOGxQnKYyTm/4kngpxCQvcq2+8mVnodHL5KYdvycYRhWQme3FvHwxriIK3O12NMPZWav0X542bKYwTTgesAfQn7tqhmiEk0+o4S31+PVIb1sQMio1EVFlaF/FqF3XWNjg5F1l2Cl8ZZeLZgTe2FaUXXh0Vw1NkYPI0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196612448326.06140151398597; Tue, 16 Jul 2024 23:10:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxr9-0004XC-4L; Wed, 17 Jul 2024 02:09:39 -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 1sTxqx-0003xd-9g for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:27 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxqv-000323-GP for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:26 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-70af22a9c19so4713060b3a.2 for ; Tue, 16 Jul 2024 23:09:24 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196564; x=1721801364; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AQvo1o7d9A2n1k+IrItgyP1l57+YBBMV11r5JjrVtfk=; b=bTHSlWY972Yo8enAQG7koeGtzCj302e3F8lh8IUwI8UWWgShhZ1NXd8vIYdUcQqUi9 VNBkIHxNPpFKbqpd4zfbsYBGulqB89NH7miKTIiJ5Y0hQ7dMta7d4I3OjBYFf5K0crVz rMWAl35BYxlEUDYx3DoY9qtg7hvZUYrKn1lymNHap0uUM3j4dR2vUlH6x+JBikzSt17S EjKWZjo8vXwhlxrs20PWVpe96QWM7Z2YYTtUZrpkDQWBo33MG3kNNDcU5kmHMzfY9CNq /y8xUZkNGEtxux3GoRga5lUtaiU+Ig28Lza54bsF8fO/ofBNHP8lso0codgYpTNLUOuF 9goA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196564; x=1721801364; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AQvo1o7d9A2n1k+IrItgyP1l57+YBBMV11r5JjrVtfk=; b=MFqgbrfjSA+XOsR/LjtLozXGTbzeKXFE8jA23CIqk5Hh16nMybLeXdRUPYEO8ucjzb nkGmz9L9DShFuXB+HZzFY0N0sgQK0gdetwagpV+xeWiVwg165UmQqZ9dbsICTLKZ7F7m hkUOe4pXJ06JgvtSRaawLbrKhEeP6yVHTH2gXiAif4BnWp2yHjpyvNghqm/4+92Ehp8s x6MIM7h5rsGVyvZanp0X+yDfTobkiADsVbaWWPIiVKVi7KK2NftpsraE21kXAe1pQt2k CBSUoow0ur23fr4FToyiWrYwC37CcjZ304jkMnLrIakYlq0TLFEP992GbibwA9NkJjjp nUdA== X-Gm-Message-State: AOJu0YyvwOO4V1ZtrE00peq1Z1w6j1jVOHq6bZW6KHytX2hKPrdTwp9M vkKM9gWgkg5UJPVTz6GN09gKO9wSCD3Q3wky5k8Kr77uozB7qHMGB1ttf2cZ4b5vHGoi2JOksK7 dDMQ= X-Google-Smtp-Source: AGHT+IGb3Rnx42S+/sO9/ARKf7gixTw8CzedX53jyJfd3dHGMfn+qZPumtj9FekQbZ8uyreH7OYGQA== X-Received: by 2002:a05:6a00:1250:b0:704:2696:d08e with SMTP id d2e1a72fcca58-70ce4f8e96bmr752191b3a.13.1721196563795; Tue, 16 Jul 2024 23:09:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 05/17] target/arm: Simplify do_reduction_op Date: Wed, 17 Jul 2024 16:08:51 +1000 Message-ID: <20240717060903.205098-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196612845116600 Content-Type: text/plain; charset="utf-8" Use simple shift and add instead of ctpop, ctz, shift and mask. Unlike SVE, there is no predicate to disable elements. Signed-off-by: Richard Henderson Reviewed-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 e0314a1253..6d2e1a2d80 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8986,34 +8986,23 @@ static void disas_data_proc_fp(DisasContext *s, uin= t32_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 fp= st) + MemOp esz, int ebase, int ecount, TCGv_ptr= fpst) { - if (esize =3D=3D size) { - int element; - MemOp msize =3D esize =3D=3D 16 ? MO_16 : MO_32; - TCGv_i32 tcg_elem; - - /* We should have one register left here */ - assert(ctpop8(vmap) =3D=3D 1); - element =3D ctz32(vmap); - assert(element < 8); - - tcg_elem =3D tcg_temp_new_i32(); - read_vec_element_i32(s, tcg_elem, rn, element, msize); + if (ecount =3D=3D 1) { + TCGv_i32 tcg_elem =3D tcg_temp_new_i32(); + read_vec_element_i32(s, tcg_elem, rn, ebase, esz); return tcg_elem; } else { - int bits =3D size / 2; - int shift =3D ctpop8(vmap) / 2; - int vmap_lo =3D (vmap >> shift) & vmap; - int vmap_hi =3D (vmap & ~vmap_lo); + int half =3D ecount >> 1; TCGv_i32 tcg_hi, tcg_lo, tcg_res; =20 - tcg_hi =3D do_reduction_op(s, fpopcode, rn, esize, bits, vmap_hi, = fpst); - tcg_lo =3D do_reduction_op(s, fpopcode, rn, esize, bits, vmap_lo, = fpst); + tcg_hi =3D do_reduction_op(s, fpopcode, rn, esz, + ebase + half, half, fpst); + tcg_lo =3D do_reduction_op(s, fpopcode, rn, esz, + ebase, half, fpst); tcg_res =3D tcg_temp_new_i32(); =20 switch (fpopcode) { @@ -9064,7 +9053,6 @@ static void disas_simd_across_lanes(DisasContext *s, = uint32_t insn) bool is_u =3D extract32(insn, 29, 1); bool is_fp =3D false; bool is_min =3D false; - int esize; int elements; int i; TCGv_i64 tcg_res, tcg_elt; @@ -9111,8 +9099,7 @@ static void disas_simd_across_lanes(DisasContext *s, = uint32_t insn) return; } =20 - esize =3D 8 << size; - elements =3D (is_q ? 128 : 64) / esize; + elements =3D (is_q ? 16 : 8) >> size; =20 tcg_res =3D tcg_temp_new_i64(); tcg_elt =3D tcg_temp_new_i64(); @@ -9167,9 +9154,8 @@ static void disas_simd_across_lanes(DisasContext *s, = uint32_t insn) */ TCGv_ptr fpst =3D fpstatus_ptr(size =3D=3D MO_16 ? FPST_FPCR_F16 := FPST_FPCR); int fpopcode =3D opcode | is_min << 4 | is_u << 5; - int vmap =3D (1 << elements) - 1; - TCGv_i32 tcg_res32 =3D do_reduction_op(s, fpopcode, rn, esize, - (is_q ? 128 : 64), vmap, fpst= ); + TCGv_i32 tcg_res32 =3D do_reduction_op(s, fpopcode, rn, size, + 0, elements, fpst); tcg_gen_extu_i32_i64(tcg_res, tcg_res32); } =20 --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196778; cv=none; d=zohomail.com; s=zohoarc; b=WS8Ic9mL4G34sINAdwPTd+i2Icw0+oqriJUcs2tPpSJTpD2S1HF8k0Mpp81LS1I5WgeHORr/yfi1j1S1KtdBW2jmsH9s8e4ITq6oXQ3puN+THIQmK30u0dNWthgAybiDck76CP5SQAwE6PVBzD4ce90UH5NIaZ88id8sxD7SVfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196778; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Af9EvMec0yXAPpsbHCZmkPQl7q0cMsBtM3ruuFa4lb4=; b=l79Drx00oix/r991r9lcVKmmTn8mvbyXP/T+sPx5xzHcywv2hcTGkCpLj+38SM9JM5ejYiFPPJHQ3u8Bl25rSSY/QEjYlaFDdJeJRGL/sdEH0e9Qyri0q+fH6mJT2xuYXqukZD3V0giROR1bvsSeUzHmqEklK7jS7F636QZGQ7o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196778792535.956715725458; Tue, 16 Jul 2024 23:12:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrA-0004hc-4A; Wed, 17 Jul 2024 02:09:40 -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 1sTxr0-00048a-8Q for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:33 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxqy-00032O-0G for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:29 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-70b31272a04so309550b3a.1 for ; Tue, 16 Jul 2024 23:09:27 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196566; x=1721801366; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Af9EvMec0yXAPpsbHCZmkPQl7q0cMsBtM3ruuFa4lb4=; b=md0LgX2nrX68QI6ulVxnASx1Xv62Ng9jE/S0ntcbp8NcWBhFKTVzYR/FWepzGeVN8Z oM6H5anRowS8RYclK/0M8JtMzUIGEtfKPz1LWAkjgQrACzfL0ychzJgFU1LVHCGAmeFJ Owc2z5j//Dh/C5yKN95iiuARVqmMgmLNVxEySQvPuoFt4tSwTEIKiKEc/GC+WWIb7nSj 5LtvS27WC2TYcV6264kg03iepTrbntIKHuA+lB81aOPQ1gdw2xuhLmNbjXlBHfiVkL7S FkJJYRvZpomvX0QNeNgoxafD2NJF1t+tRpJ8+zuHK7UwOAja3cA4C9rED0N8fj6G2TY8 V8xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196566; x=1721801366; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Af9EvMec0yXAPpsbHCZmkPQl7q0cMsBtM3ruuFa4lb4=; b=cKJqkRTHDTul/vj3gXnwXwzWm2E9vH0My7GXsoY+jtWtYBZ2DBiP5zap13DTlUpJUq CpOUJ4YLCdPzO5LfRHpP5Fe09IctC2P2dVNjcA6HeXu6k8YPTmhsOW51ZhycuumUJPbj e+P3SPVS4I+I17BbmznsBFtWH3q4DnkZbmu13YV4hrPxurPlaRN2hdCVrAlfIDtwiW0O nwvIoGYEVRqW9F9tCIn0XJosAHix6ATTxVTsrPKcGApNLr7fZ8z44pF5HDA2bFW9xcCX h2r43vYHwtHJttKlu+wpnQheGuafGluKtztjXHRFVIB2epj/OMFjEEQF0lMCQnw+copo bYNA== X-Gm-Message-State: AOJu0YxSn7sk/G0cQ/OpvCp8QjWRwkyUoUP6YCXWT4dQqLVrRR/us9Ew k3U3qvBxb0xGDFFDb4NewyeHHAGzwbFM2o5QvN0Gc/szv1kJDthHChOPdLebNMBvK7OIl8zu4BK 9CuA= X-Google-Smtp-Source: AGHT+IF/m+VFeuxtCXxBmq2RZEuBbPEM8AdzFMfXiFSrDBM4P/2AC4PTbEVomH29vhvxLDW1G3cqiA== X-Received: by 2002:a05:6a00:81c6:b0:705:d6ad:2495 with SMTP id d2e1a72fcca58-70cd8402fbamr5505586b3a.12.1721196566222; Tue, 16 Jul 2024 23:09:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 06/17] target/arm: Convert ADDV, *ADDLV, *MAXV, *MINV to decodetree Date: Wed, 17 Jul 2024 16:08:52 +1000 Message-ID: <20240717060903.205098-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196779680116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 140 ++++++++++++--------------------- target/arm/tcg/a64.decode | 12 +++ 2 files changed, 61 insertions(+), 91 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 6d2e1a2d80..055ba4695e 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6753,6 +6753,47 @@ TRANS(FNMADD, do_fmadd, a, true, true) TRANS(FMSUB, do_fmadd, a, false, true) TRANS(FNMSUB, do_fmadd, a, true, false) =20 +/* + * 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 =3D a->esz | src_sign; + int elements =3D (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 =3D tcg_temp_new_i64(); + tcg_elt =3D tcg_temp_new_i64(); + + read_vec_element(s, tcg_res, a->rn, 0, src_mop); + for (int i =3D 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 @@ -9051,27 +9092,10 @@ static void disas_simd_across_lanes(DisasContext *s= , uint32_t insn) int opcode =3D extract32(insn, 12, 5); bool is_q =3D extract32(insn, 30, 1); bool is_u =3D extract32(insn, 29, 1); - bool is_fp =3D false; bool is_min =3D false; int elements; - int i; - TCGv_i64 tcg_res, tcg_elt; =20 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 =3D=3D 3 || (size =3D=3D 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 @@ -9080,7 +9104,6 @@ static void disas_simd_across_lanes(DisasContext *s, = uint32_t insn) * precision. */ is_min =3D extract32(size, 1, 1); - is_fp =3D true; if (!is_u && dc_isar_feature(aa64_fp16, s)) { size =3D 1; } else if (!is_u || !is_q || extract32(size, 0, 1)) { @@ -9091,6 +9114,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; } @@ -9101,52 +9128,7 @@ static void disas_simd_across_lanes(DisasContext *s,= uint32_t insn) =20 elements =3D (is_q ? 16 : 8) >> size; =20 - tcg_res =3D tcg_temp_new_i64(); - tcg_elt =3D 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 =3D 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 @@ -9154,34 +9136,10 @@ static void disas_simd_across_lanes(DisasContext *s= , uint32_t insn) */ TCGv_ptr fpst =3D fpstatus_ptr(size =3D=3D MO_16 ? FPST_FPCR_F16 := FPST_FPCR); int fpopcode =3D opcode | is_min << 4 | is_u << 5; - TCGv_i32 tcg_res32 =3D do_reduction_op(s, fpopcode, rn, size, - 0, elements, fpst); - tcg_gen_extu_i32_i64(tcg_res, tcg_res32); + TCGv_i32 tcg_res =3D 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 =3D=3D 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); } =20 /* AdvSIMD modified immediate diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 5bd5603cd0..9c182eaff1 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=3D1 esz= =3D3 @rrrr_q1e3 ........ ... rm:5 . ra:5 rn:5 rd:5 &qrrrr_e q=3D1 esz= =3D3 =20 +@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=3D0 @qrrr_h . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=3D1 @qrrr_s . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=3D2 @@ -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 --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196633; cv=none; d=zohomail.com; s=zohoarc; b=g+tXprZxjGokpgvr6IIG3wuTLMKjypfMLwoIWw3Lg8/umgufd9Sx8/VQk0GTARo7Eft82x+6uX65Iw+dJWlTFYWd+5KVPhvkNK9LaknzXvxOovpRIwqeTSk4rfsB0IcED6QfbNY0QMSDmC+MRGYbsMB8qVYctWsmZJnjiliyYMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196633; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VMmfAIVMPodUs5D65nnxks3cMuZhz3ljHY/85T32Jwg=; b=KB7OJG+/Bccmroa4gT8ZOG/hXGscH9m+MJR869kCS7D/+RnOqOcCJIy/BLqm43AvAsThp7D+bbzwiDZnks2LpFIu8bDhitjjA9BiljEW7EB6s4nCJbObJxhKJ6zBr8cxfWe9H+aEnA6acXOeC0ldAz2VJf7H3iE2xuPAG8BUDzQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196633222910.2345914028783; Tue, 16 Jul 2024 23:10:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrF-0004yS-UO; Wed, 17 Jul 2024 02:09: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 1sTxr2-0004Fo-EY for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:33 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0: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 1sTxr0-00032o-1b for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:32 -0400 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-7037a208ff5so3790109a34.0 for ; Tue, 16 Jul 2024 23:09:29 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196569; x=1721801369; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VMmfAIVMPodUs5D65nnxks3cMuZhz3ljHY/85T32Jwg=; b=AW7WcsDgYlp4d0qkqhJORQ1ynR2aMfjEgQBqWJ1vY7fbwRE2rBs8ReJcj26xaiwXRB ssqoTbIcazsb9fGLmKbOknGq4j1L9a6MnjGzvNq9TyfqHpcc4Q8BtGJ5ZntX6FvNwfey ISq/i7b1Il9B5j7lRp2hOAZKSr3zxjtvFmUQ+LhuiUiH0kqmDOJjI8xEa2fL44UCEJZq lboOiodXYTs1sJfVD4KTvouYKUEnbQ5gIKsylGGC5lEmxrzhXI7t4806Ds2OArAUknGE aPRJkEquidxD9fbQqg6OTjTGNGj5GQf9wUlKDQ+fdHU9jrPKnlYFhGzVn+Hw+WonJcy8 sxZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196569; x=1721801369; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VMmfAIVMPodUs5D65nnxks3cMuZhz3ljHY/85T32Jwg=; b=Fhu7aMNxvCUyAfuQdJ2KUXzIGtmCMuqz3zcfiQ8X4gWNmpiylo3AxKPRY2eqXX4PjC SX8UlyXxmvJyCsk3Edzi0O5fH9sbEHLqWgPM2XlVyMuyHDGptRutXjcwtfs0f90G8POR JYsc6JxB0Lh3IuyDPW3NNNVOWD9EsMA8w1AG+wxKpMJBe+SQjeZ5QHpvAhzHeBqSXrNU IV41hJ42pzP68YVp7aVMhmnJD/IrGuabF8v4bxjjORTh+cL8E3aSiaCCT2pGoUTvVYQq pZoGMThW23i/iwIrthMo5vOfvlQSfFVI9ZPYnjCYOpc+NXmqkj5X9274w9Yq/TNbtZch dLjg== X-Gm-Message-State: AOJu0YxdUoSTC4MahDjoXXnHa21IlFAKOmofxQjKFBYaxzj8neigNKbV rv+9IJ3oKsOIwI1lFMwlSSwgefS08ZWdMe1TUn9/T9XZxsX6BJomoWHe9FUXPpXe3NwD5AgZTmN UbTY= X-Google-Smtp-Source: AGHT+IFU3igapHTE79hz8RT92R7o1JIUCv3ZExMyM81gXrzsVzHK8eb/bQ8FqYIrYIDLiZUrTA+Law== X-Received: by 2002:a05:6830:25c3:b0:705:9615:3c3e with SMTP id 46e09a7af769-708e37894d8mr629602a34.12.1721196568674; Tue, 16 Jul 2024 23:09:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 07/17] target/arm: Convert FMAXNMV, FMINNMV, FMAXV, FMINV to decodetree Date: Wed, 17 Jul 2024 16:08:53 +1000 Message-ID: <20240717060903.205098-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196634952116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 176 ++++++++++----------------------- target/arm/tcg/a64.decode | 14 +++ 2 files changed, 67 insertions(+), 123 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 055ba4695e..2964279c00 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6794,6 +6794,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) =20 +/* + * 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 =3D=3D 1) { + TCGv_i32 tcg_elem =3D tcg_temp_new_i32(); + read_vec_element_i32(s, tcg_elem, rn, ebase, esz); + return tcg_elem; + } else { + int half =3D ecount >> 1; + TCGv_i32 tcg_hi, tcg_lo, tcg_res; + + tcg_hi =3D do_reduction_op(s, rn, esz, ebase + half, half, fpst, f= n); + tcg_lo =3D do_reduction_op(s, rn, esz, ebase, half, fpst, fn); + tcg_res =3D 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 =3D a->esz; + int elts =3D (a->q ? 16 : 8) >> esz; + TCGv_ptr fpst =3D fpstatus_ptr(esz =3D=3D MO_16 ? FPST_FPCR_F16 : = FPST_FPCR); + TCGv_i32 res =3D 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_ma= xnumh) +TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_mi= nnumh) +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 @@ -9020,128 +9073,6 @@ static void disas_data_proc_fp(DisasContext *s, uin= t32_t insn) } } =20 -/* - * 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 =3D=3D 1) { - TCGv_i32 tcg_elem =3D tcg_temp_new_i32(); - read_vec_element_i32(s, tcg_elem, rn, ebase, esz); - return tcg_elem; - } else { - int half =3D ecount >> 1; - TCGv_i32 tcg_hi, tcg_lo, tcg_res; - - tcg_hi =3D do_reduction_op(s, fpopcode, rn, esz, - ebase + half, half, fpst); - tcg_lo =3D do_reduction_op(s, fpopcode, rn, esz, - ebase, half, fpst); - tcg_res =3D 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 =3D extract32(insn, 0, 5); - int rn =3D extract32(insn, 5, 5); - int size =3D extract32(insn, 22, 2); - int opcode =3D extract32(insn, 12, 5); - bool is_q =3D extract32(insn, 30, 1); - bool is_u =3D extract32(insn, 29, 1); - bool is_min =3D 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 =3D extract32(size, 1, 1); - if (!is_u && dc_isar_feature(aa64_fp16, s)) { - size =3D 1; - } else if (!is_u || !is_q || extract32(size, 0, 1)) { - unallocated_encoding(s); - return; - } else { - size =3D 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 =3D (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 =3D fpstatus_ptr(size =3D=3D MO_16 ? FPST_FPCR_F16 := FPST_FPCR); - int fpopcode =3D opcode | is_min << 4 | is_u << 5; - TCGv_i32 tcg_res =3D 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 * +---+---+----+---------------------+-----+-------+----+---+-------+----= --+ @@ -11693,7 +11624,6 @@ static void disas_simd_two_reg_misc_fp16(DisasConte= xt *s, uint32_t insn) static const AArch64DecodeTable data_proc_simd[] =3D { /* 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 }, diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 9c182eaff1..117269803d 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=3D3 =20 @rr_q1e0 ........ ........ ...... rn:5 rd:5 &qrr_e q=3D1 esz= =3D0 +@rr_q1e2 ........ ........ ...... rn:5 rd:5 &qrr_e q=3D1 esz= =3D2 @r2r_q1e0 ........ ........ ...... rm:5 rd:5 &qrrr_e rn=3D%rd q= =3D1 esz=3D0 @rrr_q1e0 ........ ... rm:5 ...... rn:5 rd:5 &qrrr_e q=3D1 esz= =3D0 @rrr_q1e3 ........ ... rm:5 ...... rn:5 rd:5 &qrrr_e q=3D1 esz= =3D3 @rrrr_q1e3 ........ ... rm:5 . ra:5 rn:5 rd:5 &qrrrr_e q=3D1 esz= =3D3 =20 +@qrr_h . q:1 ...... .. ...... ...... rn:5 rd:5 &qrr_e esz=3D1 @qrr_e . q:1 ...... esz:2 ...... ...... rn:5 rd:5 &qrr_e =20 @qrrr_b . q:1 ...... ... rm:5 ...... rn:5 rd:5 &qrrr_e esz=3D0 @@ -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 --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196721; cv=none; d=zohomail.com; s=zohoarc; b=J1/Q0AAyqGzUiDfJmxnKiuERCt1rnOV2SWiqkapDzAklJyIBaMkX4fJRgBmUmxdp2T8YZfe5UxoUOmEC1i1AyZ781uifs1PntpZKzJlpBFA8LfqLFpTJigcXXk6+8VAadaeD17UP7KSB5/vYKH6ys28YgygMoNbpTm82TLnq/qI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196721; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=puWWSP6upP4R/fjMKe0cqFEKfKot06skzqXFozehvXc=; b=H8aZMejxzk5u5ZkLFp7Fk1uuhiBPCduRvK4V5FR7e2iOMbQ2YZDvELqNGNFCVcS2LwVl/5j2EprlXrrmHdx1mi4JCx7L6Eqe0c7cv/BLVyC1Uo6EDcN4y6dTorRb40PX1n/CGkcxjr3QHRMXz9hHoBEpa42zNvR4RMW296nIIkI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196721634789.1492036651999; Tue, 16 Jul 2024 23:12:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrP-0005b1-CN; Wed, 17 Jul 2024 02:09:58 -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 1sTxr5-0004NG-Kk for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:35 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxr3-00033M-SM for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:35 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-70af4868d3dso4867690b3a.3 for ; Tue, 16 Jul 2024 23:09:32 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196571; x=1721801371; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=puWWSP6upP4R/fjMKe0cqFEKfKot06skzqXFozehvXc=; b=dJZH363KBT+F8cjqaHSSt+joanD0gt44JhNVrC8kS2oEkXqYShtRYpAWOZAoSq9ouO V90/7mSlypR8Cy5qI/uKawsPGWd5aO0GivYOJjEVK9ocLpxuQ+rGTthnpuAt7z5OFn+5 WS+jd7haB8Fa8u3TxSFjdVe35E5sVcvG/XLcAllanGKGilgkTDrZpdQu1Ltn1Yet4kUJ gys6bv5nkwWnXHqKhyXwt4nhDPErQY35dUWsaLtmF0jW9Di12ndkVYkIOwNZwh4K+TTg fzTDgatOxsKUtXLfzOPclEXG+gWnMzKm2XDMnO6m5TRTOGuB0Ozb2+8MCm1/+0a+2q7Z IJkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196571; x=1721801371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=puWWSP6upP4R/fjMKe0cqFEKfKot06skzqXFozehvXc=; b=cz5J0AKM8J+I3TnXIDVPy5xiUifCZe+YDtckTtV7zIBZPZJW284VCeu4FpDSJ+ZKGJ p4knm7zXfVdwLnvAGTtUoiWdgtXCxjDuHHtT4D5lgyetqcXarAfIj0AjWrF1fY3jsH3a a5is62zvm0AD8kf96c/7XZ/rZou69PI1uJ+buOtJVZWdtDqhIT8VHkReJEo+b1yqE+1o ItSgPuZdjj5TS64P1urR8MMbmcdKciD8o/t25L9w9Id1RS0dVQU5i7ymVlnYZfF3P0kH JIetyoNAfEsgqj0Pm9+EtwmpUqwLMJp/lIsCW1YXxoglTehjrc/POVLpkS2JvCuT2Mpi g1bQ== X-Gm-Message-State: AOJu0Yxd1gkgUaDeZhDgL6N6xGuK78OP/Q5NrsdJx5IOQwPrV6TarFGp vdQwyP0ybNnutIHqe2uj73dIxrg/mEWJkPBBsZXNizFUKXfHBY51L25aowwg5nNXQXp1PpSxkmi cgoo= X-Google-Smtp-Source: AGHT+IEYuNseG6riZO5WEmp4ZA5C2gDLXBmgCLJZO8MxqmQnWWUDbooRO/SkGpcobllKa4s9LnTUTw== X-Received: by 2002:a05:6a00:1402:b0:706:6af8:e088 with SMTP id d2e1a72fcca58-70ce4f936a8mr783739b3a.3.1721196570998; Tue, 16 Jul 2024 23:09:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 08/17] target/arm: Convert FMOVI (scalar, immediate) to decodetree Date: Wed, 17 Jul 2024 16:08:54 +1000 Message-ID: <20240717060903.205098-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196723295116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/tcg/translate-a64.c | 74 ++++++++++++---------------------- target/arm/tcg/a64.decode | 4 ++ 2 files changed, 30 insertions(+), 48 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 2964279c00..6582816e4e 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6847,6 +6847,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) =20 +/* + * 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 =3D 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 @@ -8584,53 +8609,6 @@ static void disas_fp_1src(DisasContext *s, uint32_t = insn) } } =20 -/* 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 =3D extract32(insn, 0, 5); - int imm5 =3D extract32(insn, 5, 5); - int imm8 =3D extract32(insn, 13, 8); - int type =3D extract32(insn, 22, 2); - int mos =3D extract32(insn, 29, 3); - uint64_t imm; - MemOp sz; - - if (mos || imm5) { - unallocated_encoding(s); - return; - } - - switch (type) { - case 0: - sz =3D MO_32; - break; - case 1: - sz =3D MO_64; - break; - case 3: - sz =3D MO_16; - if (dc_isar_feature(aa64_fp16, s)) { - break; - } - /* fallthru */ - default: - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - - imm =3D vfp_expand_imm(sz, imm8); - write_fp_dreg(s, rd, tcg_constant_i64(imm)); -} - /* Handle floating point <=3D> fixed point conversions. Note that we can * also deal with fp <=3D> integer conversions as a special case (scale = =3D=3D 64) * OPTME: consider handling that special case specially or at least skippi= ng @@ -9050,7 +9028,7 @@ static void disas_data_proc_fp(DisasContext *s, uint3= 2_t insn) switch (ctz32(extract32(insn, 12, 4))) { case 0: /* [15:12] =3D=3D xxx1 */ /* Floating point immediate */ - disas_fp_imm(s, insn); + unallocated_encoding(s); /* in decodetree */ break; case 1: /* [15:12] =3D=3D xx10 */ /* Floating point compare */ diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 117269803d..de763d3f12 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 =20 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=3D%esz_hsd --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196710; cv=none; d=zohomail.com; s=zohoarc; b=IYSwARqADhzOBWGopkLaP8JvLYZD4PhbYh/cmmWEF/3LDv36X/MNqXvcN4C7zyp1+KUZ6P+od5rEWOLdgDNj8cGYuazmCEoV4smSNg3j2E9Qu8PDraHanScKDWxdSlSM/M2sr/v34LXlGg7OUOIkFwAfHdjCvXrsEdEqXXuJKLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196710; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=91Gzd3eqh7/yDhre1ZyA2JmYLoJ2jcB1JHF4mrb/Guk=; b=IVFXrV18aRFqJj4vLA3Y2M7pVd1wwcmT+9GJZyytpYe0X2BPekZPUh5epUCseiKDPSmf4CKwXIUa0TQMQwEw/UGV0AjsnlmM5iWSlNvhDrlSx8l/qY2Zhib/HoINsL+smr1As3gClyZ6be5HQxXafYwiPFQP3C706ThH5DfZUJc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196710080442.8502815345993; Tue, 16 Jul 2024 23:11:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrI-0005D7-25; Wed, 17 Jul 2024 02:09: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 1sTxr6-0004Pp-92 for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:37 -0400 Received: from mail-oi1-x231.google.com ([2607:f8b0: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 1sTxr4-00033o-Im for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:36 -0400 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3dab2bb288aso2341416b6e.3 for ; Tue, 16 Jul 2024 23:09:34 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196573; x=1721801373; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=91Gzd3eqh7/yDhre1ZyA2JmYLoJ2jcB1JHF4mrb/Guk=; b=tzAuwcLt6Td+L1vHIaSXXpnetGsVjz/VarJSLaD4CXAwedCER9ZfogpVG8gK4WMurm p0r1s1Bywsab3wE27QpFsH2VwMt78yl0QToTtuhfeJS7VWLrJlSnP1H7iIO5Uoh6cerN TqBFC0A+82XRQRa3ynr1futaDK7fmmCbYQ84qgLL72J84snMCxWtYv89q5Qqxs1TeZ8+ GAAaxTYSv3qN2EiJh6MBzEiIjKqo22bIPEiiiiAqXfBVFvrIrDuXtwAAqpw0jXoOsVP5 8xlBOCJSnYBon3L0Y0Hc58AktctixKEnYjpiXwU7rdems2WsPE9ExkZVhhF1aDW1YbvS EWeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196573; x=1721801373; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=91Gzd3eqh7/yDhre1ZyA2JmYLoJ2jcB1JHF4mrb/Guk=; b=a87mQG7n86e4AyQyZvwfWg6EE/O9xhHJ+MEcU3VLutyciOum8quXx4fSUS+VxPlRKH bZ/8X21SnA+mAWnEW58MtDkWYryPqz/RtycsqwuffJAdSy+lYZy3u/FJPEThcXRTJ54X nKoywjMzccr4pR1bzT1p/DtwGbZq2WekgB6vUFDbkLjCo/ns/s/4aNldjU4IM7SLlxhN o+zuzHEPl26cbanLvqg6xvI6fhx2RCBvsCeXRZEBOOBsyplRdFGngQbOu3Y2VR3L2jeE l5w+tgzb0Hh0YPBVVhIfUBjtNW3Lbk0YFsKILiDXK6ROTzcPCazbLklj/s0hMXioypae ADPw== X-Gm-Message-State: AOJu0YyOf03SvBKlpuvB/y51dMEGH5zbHKV4Rj7lPycnkrj6MuRXdACp nZcLwscDmEzutAqaKjfTiGVuyE+AUey41anh7WoK/wi7tGAJhPWOZ6iHFJfFd26K4P5tKX8hzAR trv8= X-Google-Smtp-Source: AGHT+IH+cvFzsi8Omt3NcRgHbw+viGu5xFU4Eyc17//k7my4yITdy1B3rTnN0Zy3ycU2bHzadMNzlA== X-Received: by 2002:a05:6808:2227:b0:3d2:2aa8:3b2c with SMTP id 5614622812f47-3dad1f52425mr1097701b6e.33.1721196573391; Tue, 16 Jul 2024 23:09:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 09/17] target/arm: Convert MOVI, FMOV, ORR, BIC (vector immediate) to decodetree Date: Wed, 17 Jul 2024 16:08:55 +1000 Message-ID: <20240717060903.205098-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196711216116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 117 ++++++++++++++------------------- target/arm/tcg/a64.decode | 9 +++ 2 files changed, 59 insertions(+), 67 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 6582816e4e..1fa9dc3172 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6872,6 +6872,52 @@ static bool trans_FMOVI_s(DisasContext *s, arg_FMOVI= _s *a) return true; } =20 +/* + * 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=3D1, the imm will be inverted, so BIC becomes AND. */ + fn =3D a->op ? tcg_gen_gvec_andi : tcg_gen_gvec_ori; + } else { + /* There is one unallocated cmode/op combination in this space */ + if (a->cmode =3D=3D 15 && a->op =3D=3D 1 && a->q =3D=3D 0) { + return false; + } + fn =3D gen_movi; + } + + if (fp_access_check(s)) { + uint64_t imm =3D 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 @@ -9051,69 +9097,6 @@ static void disas_data_proc_fp(DisasContext *s, uint= 32_t insn) } } =20 -/* 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 =3D extract32(insn, 0, 5); - int cmode =3D extract32(insn, 12, 4); - int o2 =3D extract32(insn, 11, 1); - uint64_t abcdefgh =3D extract32(insn, 5, 5) | (extract32(insn, 16, 3) = << 5); - bool is_neg =3D extract32(insn, 29, 1); - bool is_q =3D extract32(insn, 30, 1); - uint64_t imm =3D 0; - - if (o2) { - if (cmode !=3D 0xf || is_neg) { - unallocated_encoding(s); - return; - } - /* FMOV (vector, immediate) - half-precision */ - if (!dc_isar_feature(aa64_fp16, s)) { - unallocated_encoding(s); - return; - } - imm =3D vfp_expand_imm(MO_16, abcdefgh); - /* now duplicate across the lanes */ - imm =3D dup_const(MO_16, imm); - } else { - if (cmode =3D=3D 0xf && is_neg && !is_q) { - unallocated_encoding(s); - return; - } - imm =3D asimd_imm_const(abcdefgh, cmode, is_neg); - } - - if (!fp_access_check(s)) { - return; - } - - if (!((cmode & 0x9) =3D=3D 0x1 || (cmode & 0xd) =3D=3D 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) * @@ -10593,8 +10576,10 @@ static void disas_simd_shift_imm(DisasContext *s, = uint32_t insn) bool is_u =3D extract32(insn, 29, 1); bool is_q =3D extract32(insn, 30, 1); =20 - /* data_proc_simd[] has sent immh =3D=3D 0 to disas_simd_mod_imm. */ - assert(immh !=3D 0); + if (immh =3D=3D 0) { + unallocated_encoding(s); + return; + } =20 switch (opcode) { case 0x08: /* SRI */ @@ -11602,8 +11587,6 @@ static void disas_simd_two_reg_misc_fp16(DisasConte= xt *s, uint32_t insn) static const AArch64DecodeTable data_proc_simd[] =3D { /* 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 }, diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index de763d3f12..d4dfc5f772 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 =20 FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=3D%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 --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196611; cv=none; d=zohomail.com; s=zohoarc; b=EzwgmA5Ts7/7wpEuFK51T7hgxf6SeUrzBksEqm0BcOmrepMeSjfPdqIV3fvReaQ5iWoOJEDjmldfmpxzPTDhIZGyemetrZU5MwtAjwdEdZ8LzDNqWmNQLkAvsp80wR0sJJPPz+gxFP8rzUHEkgIMCsygJIljnw58dHm8p7A3SOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196611; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6VF3yXySyHxycuIv5IJw23OAgkwvwvSkw9Ee2WxvfpM=; b=ITH2sdjSJIhdq1/tei20mpH4iQ+EkvAfi0lkNxDyIkIaVJXfzw0TYBo2fLdvLOsKx9vF7wnUoq39+GHT3AIp/QTHLFsPUTH4H2eQo5W1a8GEO+ZBr/BbhLbJaa5lxJ13bBzRERfQPxm0XcEmCrJaY+UvCZWlfvJWMYn7ayLgvag= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196611189549.3177652428963; Tue, 16 Jul 2024 23:10:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrL-0005Th-Lt; Wed, 17 Jul 2024 02:09: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 1sTxr8-0004aF-So for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:39 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0: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 1sTxr7-00034J-5O for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:38 -0400 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6f8d0a1e500so5553333a34.3 for ; Tue, 16 Jul 2024 23:09:36 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196576; x=1721801376; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6VF3yXySyHxycuIv5IJw23OAgkwvwvSkw9Ee2WxvfpM=; b=gGnuIa3S02V+7ghedOjD9wvtC0qtX6EPaYpSUS5EfgLPeg51YT5Wi8VjtUiEHH6Aud QERWdBUadYu+oCrtNDvSmMNC0ag4IlwafZAwkK+Cl0qoE8rBgvtb5MAKcEbfPIYMkrmK DjVBWwkjAG3FhgMv1BSd1y8Dt629KMEOjXSeWQSzSqGVJchrUBheI/JTyGBWWpOaNlm8 QBcdqXhmLdmsBSFNKTQQ8qkWz6Li1GnlP+nmRubh6sB5BtQyyO9BgDoRcBaISRc4r/Xc 0ZtVxfypuO8nirGOjoMUPDI5/qqQB9qXGS+V17l9WS+fstQ7rMkzcH9+5Vh5ag0CFD73 lg5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196576; x=1721801376; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6VF3yXySyHxycuIv5IJw23OAgkwvwvSkw9Ee2WxvfpM=; b=SNydR1STJupxdqlZsB4Vg1t63UkMOh1UicrNoxRScfJAO6GkEsikZ+v7Qkomqw6wds WOAOgnnrRgcDPlwGr8RXDYduLWlkDSQnDTfzoxuCVd7MPeNIf71n8SLrGj3YB9L8Xeb+ wpeOECanK0n6S8dkx9Jg6NciYDDR+U/8ZkckhvXRhvZqBpEJZvO16s/C48MOEYuqBBbE +bOcEN2JOcJlz/jIxZzYhVCpiQx7gblgN7jG/F9PCFkpJvQj8vVFT8v/QLPOb1lG1gHS 0T+hFWGlnLKDBfS6IiX2GuCCIvuZC1Wy8rY8qp55/RWJOQ7Ey+XLeI2zTAFkxL0RTnuj FVuA== X-Gm-Message-State: AOJu0YxuGtwr+H16KoiQj0fYb0me4cSHHWbLxwHiOgvsK3GH22/z+a23 D7j+G9NEoP6eBzsFP9ZxSrT+/lgOfEqHHUEJGqr2chlP055ut/poZod+uLgzMi2CXpCWMX7SpuA Nnzs= X-Google-Smtp-Source: AGHT+IH+joJez/Cll9cbsqGQ1OZ8jO9lDdad5pTHCwnqvHoHu7nnH8z54Z6zRZW4TeJOQhilWY/A4g== X-Received: by 2002:a05:6830:3909:b0:6f9:8000:53e5 with SMTP id 46e09a7af769-708e37f0bbcmr847583a34.23.1721196575929; Tue, 16 Jul 2024 23:09:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 10/17] target/arm: Introduce gen_gvec_sshr, gen_gvec_ushr Date: Wed, 17 Jul 2024 16:08:56 +1000 Message-ID: <20240717060903.205098-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32e.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196612836116600 Content-Type: text/plain; charset="utf-8" Handle the two special cases within these new functions instead of higher in the call stack. Signed-off-by: Richard Henderson Reviewed-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 a8672c857c..d1a836ca6f 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, T= CGv_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); =20 +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 56a1dc1f75..47ac2634ce 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) =20 #undef GEN_CMP0 =20 +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 =3D 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 >=3D (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 1fa9dc3172..d0a3450d75 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -10411,21 +10411,7 @@ static void handle_vec_simd_shri(DisasContext *s, = bool is_q, bool is_u, break; =20 case 0x00: /* SSHR / USHR */ - if (is_u) { - if (shift =3D=3D 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 =3D tcg_gen_gvec_shri; - } else { - /* Shift count the same size as element size produces all sign= . */ - if (shift =3D=3D 8 << size) { - shift -=3D 1; - } - gvec_fn =3D tcg_gen_gvec_sari; - } + gvec_fn =3D is_u ? gen_gvec_ushr : gen_gvec_sshr; break; =20 case 0x04: /* SRSHR / URSHR (rounding) */ diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neo= n.c index 915c9e56db..05d4016633 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -1068,29 +1068,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 =3D 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_of= s, - 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 >=3D (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) =20 static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a, NeonGenTwo64OpEnvFn *fn) --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196697; cv=none; d=zohomail.com; s=zohoarc; b=AHc9lHi4gZ+CHnX6jvUX8WNppjZ8U7WwhUlUHtBcNNDUTNyqOvFQ763fOy+jCP5b6JcaTorGUGCP2s7RpGi0AwDAaoXJrB7BAMYqfAD+QQNdZGul9LgeYbkERrZ9LnVKcOPCa3UWJPg5P+DpRRVAhrBzHaENnNz6o4ET1XMCs9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196697; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=R2XV0a88eGLbu1U/vWq9ttzcAxIlbjkNY5QMrMqYulc=; b=dSs6QAB0K06HtjJXK8+PBzXSLG1uCL+kJ7OQIsc1VChA9HHDrM01y9XYeHgiqQxpawrrRyv6fzB8gD57VxPT/4g0m8nq+twmhA0CEiBAFMHku/i5QNovvt2TkSR8O6hai+WI1FfWqPGbYarQAky7Y3OLEtj/zy57+KN8mWar1Lg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196697717320.31552592964715; Tue, 16 Jul 2024 23:11:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrj-00079w-Vn; Wed, 17 Jul 2024 02:10: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 1sTxrJ-0005M0-TI for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:49 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxrD-00034t-PW for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:46 -0400 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3d96365dc34so4851417b6e.2 for ; Tue, 16 Jul 2024 23:09:40 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196578; x=1721801378; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R2XV0a88eGLbu1U/vWq9ttzcAxIlbjkNY5QMrMqYulc=; b=i3yKvF8A5GRiSialPOKJEdvsbkG8FxW8uPQrzhQA5eFVX6+L8V8lpNwSEfWImBUcWF nOT6koPsSTZfyEPu+R/2R3quDI5OK3+cUdLEK32i5WrYD4Og2jK/4isNjrXZbbgQBtOq JoTiJ3dGOeoxl/Tt1HEUPsF4pSLiXqQRWf2F99plhqLMIMbmnHDbC+Y34S4jZh46YPH3 pK4VbFsYvMJZrWCTjbzJ63dtWRYQPZiUQ/vYYexswyIONv7gakvi0+1bdbiXrBMONA18 SRUoS2fylTHKFD/jTZh7hQVB+oUk6N0XCxHDMk1KJaV1JP1AWrKJeWUt0hDJd48XfRub qxPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196578; x=1721801378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R2XV0a88eGLbu1U/vWq9ttzcAxIlbjkNY5QMrMqYulc=; b=qChNBMmYfEd6pTn3SaUbEE3paQejZVLK9XPmOIf38g/mA3sk3jBDsthG69oKn9gcYt plEcVlkVCtSlGpRdhoPDe/G3h8KMBFVenCvSKy0o3zKjSF58MERIRvdTjW/jlTBOFJpg yzxrzvOhh9t2dQeeRP9gRyx/OBmM33beh/Nu58vlvj8kxsABIstPgVbESK2uNQzoTc1Z AA6OpUPnOIeM/cuage985BGtPpJBAMq6ZK/r4f4qAWHmxym2j9IWkm6sarP5PcWc0seM kwTxqlOok3mVpxnFp3oECxdJo2vbUewILcL6A+C02hFXmZLFzqvekxrVRGrVxikCB6AL DF+w== X-Gm-Message-State: AOJu0YyH7KBbkPaFfRMbjH6FPjU44+YP2JPKyclSS7zpf8DigcKP2uTk PtOk5elhUKgxDborQNpeJ7x9eiXbZYs1UlixbK8muu7fbiaRDTH6VAyxm4Lru/Z7eVlP74Va/DS ucdY= X-Google-Smtp-Source: AGHT+IE/1+DMmI7kX5lfczf/8DxkkTZR0ZID09vzhY7UEkXGWXpvKLjjP4UGovF6H0SBpgRuC2tifw== X-Received: by 2002:a05:6808:1483:b0:3da:b3b3:191 with SMTP id 5614622812f47-3dad1f7c512mr988315b6e.48.1721196578203; Tue, 16 Jul 2024 23:09:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 11/17] target/arm: Fix whitespace near gen_srshr64_i64 Date: Wed, 17 Jul 2024 16:08:57 +1000 Message-ID: <20240717060903.205098-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x233.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196699229116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 47ac2634ce..b6c0d86bad 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); } =20 - 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 =3D tcg_temp_new_i64(); =20 --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196697; cv=none; d=zohomail.com; s=zohoarc; b=YIPerv8xkiYXK20ekbES/PYg9pMYr2gysRZC9mby3G8esDTDMq09yo2CJ1/y0oAGFiILmeO4oGjW3d1pQ9ldECGpaXI9fUzDjNwtJPc8UGFFuUKIoVx+SbR1hk2UZnEoibBEqWC2uydTuldFm/Ak2V2lGZPvRD7uS2vVufNkUn4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196697; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=no6iOx3AILSOna1VQODcYvySktfS4g+9G5yzEozZ57o=; b=PeE7VmBqPHR/lOFNPIdA+0Y8omtqDA4nTUatnlrHchGUWIuW5bc4yIlcLISWHl27fNYBq9dWt+QVR5T2MZd+HrtUPNU7bqqo4aQp8N7Wugiy/uGsg6Zff5A1FqixxeuTDiCb2u4m7Xk/yxDRj+4yMM3g6w7dVW4OL4d7SQXsiag= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196697525587.7307583488893; Tue, 16 Jul 2024 23:11:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrT-0005zC-3P; Wed, 17 Jul 2024 02:09:59 -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 1sTxrJ-0005MB-U3 for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:49 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxrF-00035C-Dy for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:48 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-70af22a9c19so4713206b3a.2 for ; Tue, 16 Jul 2024 23:09:41 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196581; x=1721801381; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=no6iOx3AILSOna1VQODcYvySktfS4g+9G5yzEozZ57o=; b=XRumrbug3lWATGWCu8ZDqk6qbZA1tKV4gjV71mHJFcB5AjKUBeQcCg29SW+4sB6HUV nKdZ2Wf7uv9yrtguSUT3NEHNd6j+CFXIBHCXV2H4WqBvXzE/U17zik+jPzPQDfFu5dY+ g6ToqMJ5nGRr4UQGEPoZwbO6S0hlLcvwXbxLd5q4llQ9lRcOUVr9/UU6FQPAc1Sgefk8 JoyVdP1o5/ZwyXwihGZxKhYBKGMGS4aBmtLslIlImHRuUXxoNIxRqJ6+ZqD/nUaDB7jA M5qh6wlmJ48fE0IeN4qyh1WYyXpjngUMOd0t3aBboHB9xLo+hI/e4TCjMpBqkIu7S3M6 WpbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196581; x=1721801381; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=no6iOx3AILSOna1VQODcYvySktfS4g+9G5yzEozZ57o=; b=dVMFnuomnR9o8vZRjct8snoaLfXi0Xc/DGtHCtpqpImBxvOI2M2t7VhJTQ/ri1/f6G y9OnmpO0Zb+rSoe/ppRdjyGJKlC0RZeoCOAOhTatSpwVSv4PS1xZVRXohg+Wc7e0UezH 97CHuaDNCB2G/P2iW6qq+3BxfMtbLIR4lDJrRBVblKXtorYENJoIRWSpzyA1ElEdXUIq 8lASb2FgHDdZHrukW9KKRDVwHhRyZGyI6KWZFamkJBqPUpSXHIkSMz+XUeiArL4Mc9+g AATZY9h71C3FLIBAZr20g6jVEVWjJwM2qA45a8wpj9q6IUA9mYJgZhIq6pd7L65LUCjm Jo0g== X-Gm-Message-State: AOJu0YzAxu6R+rCT1kq5KKqoinJ6Xfl8KBI9ySWUXuOg+ig2AVhFIBfp h8+DZ51ReMNBhPBXlUm7ihn0oPx9tXNDV4/tvDgW1yP96bLrcrziTpQKi3LWaMug3R1BDWwCOW0 dnFo= X-Google-Smtp-Source: AGHT+IFWciE/FOxJGYMfSXhtLlJlsD/t2FSKilPLSqBf+lUJ9fu7vZEcFNY3A/KCi0tckemF/YaHyQ== X-Received: by 2002:a05:6a00:2e97:b0:70a:ffbf:b27d with SMTP id d2e1a72fcca58-70ce505e403mr748701b3a.20.1721196580751; Tue, 16 Jul 2024 23:09:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 12/17] target/arm: Convert handle_vec_simd_shri to decodetree Date: Wed, 17 Jul 2024 16:08:58 +1000 Message-ID: <20240717060903.205098-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196699266116600 Content-Type: text/plain; charset="utf-8" This includes SSHR, USHR, SSRA, USRA, SRSHR, URSHR, SRSRA, URSRA, SRI. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 109 +++++++++++++++------------------ target/arm/tcg/a64.decode | 27 +++++++- 2 files changed, 74 insertions(+), 62 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index d0a3450d75..1e482477c5 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -68,6 +68,22 @@ static int scale_by_log2_tag_granule(DisasContext *s, in= t x) return x << LOG2_TAG_GRANULE; } =20 +/* + * For Advanced SIMD shift by immediate, extract esz from immh. + * The result must be validated by the translator: MO_8 <=3D x <=3D MO_64. + */ +static int esz_immh(DisasContext *s, int x) +{ + return 32 - clz32(x) - 1; +} + +/* For Advanced SIMD shift by immediate, right shift count. */ +static int rcount_immhb(DisasContext *s, int x) +{ + int size =3D esz_immh(s, x >> 3); + return (16 << size) - x; +} + /* * Include the generated decoders. */ @@ -6918,6 +6934,35 @@ static bool trans_Vimm(DisasContext *s, arg_Vimm *a) return true; } =20 +/* + * Advanced SIMD Shift by Immediate + */ + +static bool do_vec_shift_imm(DisasContext *s, arg_qrri_e *a, GVecGen2iFn *= fn) +{ + /* Validate result of esz_immh, for invalid immh =3D=3D 0. */ + if (a->esz < 0) { + return false; + } + if (a->esz =3D=3D MO_64 && !a->q) { + return false; + } + 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 @@ -10382,53 +10427,6 @@ static void disas_simd_scalar_two_reg_misc(DisasCo= ntext *s, uint32_t insn) } } =20 -/* 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, i= nt rd) -{ - int size =3D 32 - clz32(immh) - 1; - int immhb =3D immh << 3 | immb; - int shift =3D 2 * (8 << size) - immhb; - GVecGen2iFn *gvec_fn; - - if (extract32(immh, 3, 1) && !is_q) { - unallocated_encoding(s); - return; - } - tcg_debug_assert(size <=3D 3); - - if (!fp_access_check(s)) { - return; - } - - switch (opcode) { - case 0x02: /* SSRA / USRA (accumulate) */ - gvec_fn =3D is_u ? gen_gvec_usra : gen_gvec_ssra; - break; - - case 0x08: /* SRI */ - gvec_fn =3D gen_gvec_sri; - break; - - case 0x00: /* SSHR / USHR */ - gvec_fn =3D is_u ? gen_gvec_ushr : gen_gvec_sshr; - break; - - case 0x04: /* SRSHR / URSHR (rounding) */ - gvec_fn =3D is_u ? gen_gvec_urshr : gen_gvec_srshr; - break; - - case 0x06: /* SRSRA / URSRA (accum + rounding) */ - gvec_fn =3D 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, i= nt rd) @@ -10568,18 +10566,6 @@ static void disas_simd_shift_imm(DisasContext *s, = uint32_t insn) } =20 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; @@ -10618,6 +10604,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; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index d4dfc5f772..c525f5fc35 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,31 @@ FMINV_s 0110 1110 10 11000 01111 10 ..... .= .... @rr_q1e2 =20 FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 esz=3D%esz_hsd =20 -# Advanced SIMD Modified Immediate +# Advanced SIMD Modified Immediate / Shift by Immediate =20 %abcdefgh 16:3 5:5 +%esz_immh 19:4 !function=3Desz_immh +%rcount_immhb 16:7 !function=3Drcount_immhb + +@qrshifti . q:1 .. ..... .... ... ..... . rn:5 rd:5 \ + &qrri_e esz=3D%esz_immh imm=3D%rcount_immhb =20 FMOVI_v_h 0 q:1 00 1111 00000 ... 1111 11 ..... rd:5 %abcdefgh =20 -# 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 +{ + # 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 + + # Shift by immediate requires immh=3D=3D0, consumed by Vimm above. + [ + SSHR_v 0.00 11110 .... ... 00000 1 ..... ..... @qrshifti + USHR_v 0.10 11110 .... ... 00000 1 ..... ..... @qrshifti + SSRA_v 0.00 11110 .... ... 00010 1 ..... ..... @qrshifti + USRA_v 0.10 11110 .... ... 00010 1 ..... ..... @qrshifti + SRSHR_v 0.00 11110 .... ... 00100 1 ..... ..... @qrshifti + URSHR_v 0.10 11110 .... ... 00100 1 ..... ..... @qrshifti + SRSRA_v 0.00 11110 .... ... 00110 1 ..... ..... @qrshifti + URSRA_v 0.10 11110 .... ... 00110 1 ..... ..... @qrshifti + SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @qrshifti + ] +} --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196708; cv=none; d=zohomail.com; s=zohoarc; b=ffpakLjHr1XvkkF3m0RhBY5E1AhD/dZZm7SBUu6gmdWQaAuKVP2lWSRa6//4fCgvdC8VrHvyBdw556BbHn4zz3ffVkUwZj8AF/oZlamXELjZIxTo9PClF+OT67lZIpkcGqYluqvJIxqY4DmdhblW1jcN9gRBbuSbiXTHPj8isqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196708; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6XuY01gcGNghIOOf5X8qApquvihmysZWPJ2xnop5Jqo=; b=lijght9GvBJjLhr/IAChMKROLxcAZaUA89Z/+6OfUuj2aeyLdZo5CMSdK3oU+imMMdzIaMtcifVKX5uEvvSWVZ9IZ6mFr7OGa/o/mMjPGY5LcGPAUaYrYsSooCUW58LPDQcRJAAATCY1WWNB9NLx18xNLhrO2jXMfWMyXQGanP4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196708589249.91058846691158; Tue, 16 Jul 2024 23:11:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrj-0006cx-OB; Wed, 17 Jul 2024 02:10:15 -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 1sTxrJ-0005Lt-SV for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:49 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxrF-00035O-Q2 for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:49 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-78964fd9f2dso4003451a12.3 for ; Tue, 16 Jul 2024 23:09:44 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196583; x=1721801383; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6XuY01gcGNghIOOf5X8qApquvihmysZWPJ2xnop5Jqo=; b=R9KKfeNECve2q7WUzksTcnEHUiEzWuiBg8H4HMIaKQ5PXjdXOfMI9h1zUAXV5LHXQN CYZpD5zP/aHy5X7XtlVKCFrirPoV843adgSs4DcaVnoK230czhsfQtAG+btebkUyEOvH ymDjg74r93BA2U385wbDFz4h29bj0lYNozZhtOmyHHhTudqiJfYAFu20HUapPiRThPlA TVw+ZdgbLtbjnqAD23QfLEz/O7cGp6p2V+FZ8zTsNEyfW7CMx7j7RpoaCdlxyRrSszC8 KrGHLtBvDJg0eez9HubO1MlJmKs3mes0bq4kuIePHYfF4A0N4lC8QfNnhsNTGBdTjyqH PkOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196583; x=1721801383; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6XuY01gcGNghIOOf5X8qApquvihmysZWPJ2xnop5Jqo=; b=o6/grKUOZcLA8BAM8leaDJj1mJZsXV5ovHzVpItmA5pFY94+od4N0fA3cODZMZ+bmD cTYjoK/JUOJy8aRXMlnDxf6n9euGQmGKgpb4MMNvXW+28gQ7gxAKXiL6bue05y+fKzHH WO3uUvE07CPOToYg4N4L7Hqn5ETpMMFwSmfW9SzN/0vNnj1UwBk8HWfqWIZ4TLZ4cFjw guImXE6D15DFoXpGS0EIejsPrvjaSg4quj68ZROmvnuMrsD0Cc1CuH9lp4fYCh5FB/XV KbWRnkB3xm2UbkzhZNBx1GnT/OiJIih0dkIUUFVFi/eONbmrfSgkUzbkdhsWpjGzKc2X 2yZA== X-Gm-Message-State: AOJu0YyLNsMJwQMS35Rz/hQGCdCv7jIfgTjgSRG5HxZ8DiKLw1kV2fWd /7IP2U28Hn3vd0eam2JRRQS+pgOeVK9HwEtzh/rQzJqdQBEoTlHR36GC28pVE9u/vYXXr8HAtde NLlY= X-Google-Smtp-Source: AGHT+IE70b6i36S3WST98ZZdog9bLcXMAOV3X+X632dUm4VQkKZOi1/iqr1cKU1v0DxyfKY/tx/cAw== X-Received: by 2002:a05:6a21:458a:b0:1c2:8b78:880 with SMTP id adf61e73a8af0-1c3fddc9683mr856533637.41.1721196583135; Tue, 16 Jul 2024 23:09:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 13/17] target/arm: Convet handle_vec_simd_shli to decodetree Date: Wed, 17 Jul 2024 16:08:59 +1000 Message-ID: <20240717060903.205098-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196709309116600 Content-Type: text/plain; charset="utf-8" This includes SHL and SLI. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 40 +++++++++------------------------- target/arm/tcg/a64.decode | 6 +++++ 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 1e482477c5..fd90752dee 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -84,6 +84,13 @@ static int rcount_immhb(DisasContext *s, int x) return (16 << size) - x; } =20 +/* For Advanced SIMD shift by immediate, left shift count. */ +static int lcount_immhb(DisasContext *s, int x) +{ + int size =3D esz_immh(s, x >> 3); + return x - (8 << size); +} + /* * Include the generated decoders. */ @@ -6962,6 +6969,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); =20 /* Shift a TCGv src by TCGv shift_amount, put result in dst. * Note that it is the caller's responsibility to ensure that the @@ -10427,33 +10436,6 @@ static void disas_simd_scalar_two_reg_misc(DisasCo= ntext *s, uint32_t insn) } } =20 -/* 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, i= nt rd) -{ - int size =3D 32 - clz32(immh) - 1; - int immhb =3D immh << 3 | immb; - int shift =3D immhb - (8 << size); - - /* Range of size is limited by decode: immh is a non-zero 4 bit field = */ - assert(size >=3D 0 && size <=3D 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, i= nt rd) @@ -10566,9 +10548,6 @@ static void disas_simd_shift_imm(DisasContext *s, u= int32_t insn) } =20 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) { @@ -10609,6 +10588,7 @@ static void disas_simd_shift_imm(DisasContext *s, u= int32_t insn) case 0x04: /* SRSHR / URSHR (rounding) */ case 0x06: /* SRSRA / URSRA (accum + rounding) */ case 0x08: /* SRI */ + case 0x0a: /* SHL / SLI */ unallocated_encoding(s); return; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index c525f5fc35..6aa8a18240 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1191,9 +1191,12 @@ FMOVI_s 0001 1110 .. 1 imm:8 100 00000 rd:5 = esz=3D%esz_hsd %abcdefgh 16:3 5:5 %esz_immh 19:4 !function=3Desz_immh %rcount_immhb 16:7 !function=3Drcount_immhb +%lcount_immhb 16:7 !function=3Dlcount_immhb =20 @qrshifti . q:1 .. ..... .... ... ..... . rn:5 rd:5 \ &qrri_e esz=3D%esz_immh imm=3D%rcount_immhb +@qlshifti . q:1 .. ..... .... ... ..... . rn:5 rd:5 \ + &qrri_e esz=3D%esz_immh imm=3D%lcount_immhb =20 FMOVI_v_h 0 q:1 00 1111 00000 ... 1111 11 ..... rd:5 %abcdefgh =20 @@ -1212,5 +1215,8 @@ FMOVI_v_h 0 q:1 00 1111 00000 ... 1111 11 .....= rd:5 %abcdefgh SRSRA_v 0.00 11110 .... ... 00110 1 ..... ..... @qrshifti URSRA_v 0.10 11110 .... ... 00110 1 ..... ..... @qrshifti SRI_v 0.10 11110 .... ... 01000 1 ..... ..... @qrshifti + + SHL_v 0.00 11110 .... ... 01010 1 ..... ..... @qlshifti + SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @qlshifti ] } --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196698; cv=none; d=zohomail.com; s=zohoarc; b=C759rmATgmETOGyyJ0I3u3GxLE5T/3D0Cp7+WpidPm9NwiWQstDpEoDrMQ16tk+upN2gVo8rWlwU3gYs20Qwtf3zmCsconhRvlbeOglEXD4HAoVIERI7k4siYlIBXNX41BBKt8Mf82GUyvumR2/Vb9mAZsHfvxHcixrvqwpTyp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196698; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=57DdanWVRLYnAUN5YF1Z/JUbHmS65EczfEpSlC06YmA=; b=E2wrUkG/QqZNAW04KpXLdhZf6H4mB+GDUmpaAADuNs4bJ8YLVio+0Mp5EAX2urlrc+8bn/ahTxKuyQbGVJH53RxODVxdpRf9hgptDtXSTIMsRU5T0BkWzd2mmvf07MDIZr3jVd4JbwNcNgsCcblSeM6EzwJ/GIy3SlZY1yLlE3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196698044365.0969093715331; Tue, 16 Jul 2024 23:11:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxru-0008L5-Q7; Wed, 17 Jul 2024 02:10:27 -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 1sTxrN-0005bu-Jr for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:53 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxrJ-00035z-J2 for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:52 -0400 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-5ce74defe42so352255eaf.0 for ; Tue, 16 Jul 2024 23:09:46 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196586; x=1721801386; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=57DdanWVRLYnAUN5YF1Z/JUbHmS65EczfEpSlC06YmA=; b=wePVVf0ygEbl+zb75+wpb/7Mu5abD1ywmETe5t9ODIr4VkOu6FTDHluTQyE1bFDhqa cbPPrG8iGTGPEv1qP/q/eqOjrlktHsCAQIgH+WQfB4lzLEIrNrbHmBZfjpru1Anq3tVl llN4ccI9Ei5hJyTWU5On6W/LA4nFgYwRbDp/iX4ts5L0jDMnsxACiMTRIq7uV+aMoSuR UbsTufu56BO6/S6eNIrAUZc0LQE11EYfa1BiUTA32hEaHKPTSBUIa0ZTh4/sPl2sEHrq MRAmYOlME1izLMANpAYBDzOh5BSdDK2MdI+6NWGvA0RuvhknXXk4viNcZP0mlryA0xLw FMNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196586; x=1721801386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=57DdanWVRLYnAUN5YF1Z/JUbHmS65EczfEpSlC06YmA=; b=ZRYGfXk4raiIr+FDnE2bJ8JhaPipD6iUVdESBgnKffEZUqJtoQJd6j94DIyh2WpHyA G+ZbmMLkWxMwL4jbopt9PT9s0EWr9UMJz+lAT3rjPwln6tKabyYq4TpyHsQ9z3yb6jr/ 9pMr7ICuaMF5CG1cxbxEDSAMtuJHcbcIRQGN/iPJiIW4+H8fXNaJKM3cdNr3ZpR52Csa ZZGNaZjEqoncSewTBarTbKYsRWGxrcNVEaVOXycuj9VydGZQEMQZIBXCaLhYDP97pXgP 9/cwJXcLbvtkOJBGneWyok6kFHidgmEXPF7gtjTkEmL3ChrW6D/ifQiidODRpK+eSh6V AQkQ== X-Gm-Message-State: AOJu0Yx7A4oqYQGeOHUqVte/gEgYcUxR6A0BPEkEzvoLGQBc5InbHA49 31499Ppfi/ovZcTU4Nci67ocBpZUbrQsq6ucKRleNfOE1eD/YbvuMyMcQP4IPemkw2lBFbK8d3n VtiE= X-Google-Smtp-Source: AGHT+IHGO1Pf2nQiQ2rZdrnL2yJ5uvyVx/nwpxmtfjRkvheiJea/oI8PrztwSpvhg6JrF1aYstaucQ== X-Received: by 2002:a05:6871:79a:b0:24f:d873:9f32 with SMTP id 586e51a60fabf-260d9222ad5mr578504fac.26.1721196585830; Tue, 16 Jul 2024 23:09:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-stable@nongnu.org Subject: [PATCH 14/17] target/arm: Clear high SVE elements in handle_vec_simd_wshli Date: Wed, 17 Jul 2024 16:09:00 +1000 Message-ID: <20240717060903.205098-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c34; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc34.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196699214116600 Content-Type: text/plain; charset="utf-8" AdvSIMD instructions are supposed to zero bits beyond 128. Affects SSHLL, USHLL, SSHLL2, USHLL2. Cc: qemu-stable@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index fd90752dee..d0ad6c90bc 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -10471,6 +10471,7 @@ static void handle_vec_simd_wshli(DisasContext *s, = bool is_q, bool is_u, 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); } =20 /* SHRN/RSHRN - Shift right with narrowing (and potential rounding) */ --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196779; cv=none; d=zohomail.com; s=zohoarc; b=iNNl7Zg0GfpIhrCqsbA6CllJKTAiNgA11z3cKOXVHRvmKlBCh9JcTiWxOcv1kHZOTPHskOp1w/vEVyYVaqUsGWvxO2hZ56NV5lYEM2NxtBHUJVOZioB1NlbxLhhg8IgkQs1QbVpsvmX5XgH7cWOeMtNb5L93K7OSvT963GodLxo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196779; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=shR5dO6yp58OnhkL2VwnGKfoxEn8l1B1D1MBIepMKeA=; b=ZAUwLNH4r7WUIo1/cMpuYH7wsIXH4H/PbRrdHkfELSUHp3UV1rnTopFPsTlwOwEUbARO/QL7MOblhWuKXRipLn+6nv1zs2ljyKkNbMKoYYhXmi/TFbqNvAWbjbFmSzvOt5KsfRK6b6g4xAWEUFw6bAoP6BW5UsFyLBnnJFqQ294= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196779875629.5979262368128; Tue, 16 Jul 2024 23:12:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrr-0008AS-S2; Wed, 17 Jul 2024 02:10:23 -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 1sTxrN-0005bp-JJ for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:53 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0: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 1sTxrJ-00036I-I7 for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:52 -0400 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-70448cae1e0so3545276a34.3 for ; Tue, 16 Jul 2024 23:09:48 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196588; x=1721801388; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=shR5dO6yp58OnhkL2VwnGKfoxEn8l1B1D1MBIepMKeA=; b=Ki0ZGPmz8Nnnf8hYtB/KLkYOVtPTLOZAetHgXzbaMpXVTm/4VGk25+twsch7hpFrmE uCcFE3K1f3Poj58qQawlwBkwIfx5jm8rcDJhw7uO1qRUySx9FLOUyV4uKI1lCbzZp1Qg gRBLv5RcLrCB00HiEellPMd056Zz0NWebOVvw69luvyoeRY4TURMoE1I1lCJp6nw6nxf VZMUCaTqKMlpdsy0dpB3/VnRLjRgYI6lXb4bk2PN/OvCj38wPf7MmOF0BlGx6Pc1dVzb A4eXUMsc/xIPjS14VtU0WeziEiOQ5xiSQON0PIHLokcUM76o8wnJpkFyxPoOxftRYok9 p1jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196588; x=1721801388; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=shR5dO6yp58OnhkL2VwnGKfoxEn8l1B1D1MBIepMKeA=; b=a2SLBVWZ/FtaTgTTQ4eZtLd7KU4mneVicT+ipeCriT0Ng5fBqL6QuEPCksa0SzQQoo U8rBZPhl4USNEHdSBkiZdT1mNiu2Biyfk35e0FjyF0Kpxm+pjujw+yTaEGx8LjiOh9hF lOUQSIc/GP+uWOxZoJ0FTKzWcQGrdDTfN6Onw1rP3R79iDH/DtpwYHBzNCkDfzM4I5kw liPtMD6WbWeRMAoIolglKiZo9hxnhRHRnymq7gn70lCCzQgMhbcwhFKZPceglT3M0guo hmb+9RDrjRIst5Eqe8HeBfRQ1ayupWG2S9OZ9da5rZsefLdjaa+skCC4731aarkOcj9R WslQ== X-Gm-Message-State: AOJu0YxLhXkIv1kLw1nU1n/FiTXC0l27iYujpuH4RYvvHmk7sNHWYq+1 L61K1JFJFngRtpg5Vd0dQvBG2f0F8Q+SY7tbcvNK2rV7rIupdGuHLOUHwQFnkn7dtvfHNtaEoR8 g+hk= X-Google-Smtp-Source: AGHT+IHXdI3qRlOirqdTEp/qvlK2rKbjNAbsWEF0ROQkgpQeDm+SAjhBzLzZxpeQnJjRElH1msw6mw== X-Received: by 2002:a05:6830:6e09:b0:704:47db:cd68 with SMTP id 46e09a7af769-708e3778001mr1007107a34.4.1721196588116; Tue, 16 Jul 2024 23:09:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 15/17] target/arm: Use {,s}extract in handle_vec_simd_wshli Date: Wed, 17 Jul 2024 16:09:01 +1000 Message-ID: <20240717060903.205098-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196781463116600 Content-Type: text/plain; charset="utf-8" Combine the right shift with the extension via the tcg extract operations. Signed-off-by: Richard Henderson Reviewed-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 d0ad6c90bc..627d4311bb 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -10466,8 +10466,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); =20 for (i =3D 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); } --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196699; cv=none; d=zohomail.com; s=zohoarc; b=lzQtL9vsc0zrlQBTajRT/X1m/3J1DhhpVsMD0nLaW76z8E6v9zkJ6Z9FOBLA60iJ/6m3R1Im+4F0hWIqzsOMOOjoYZIPRsPtv3hqK88zxzot5fA3ZaVlBnO/5Y7EtLyqzHiYk/HA7HjzgYhIaZy28xFG93uOTW4nVfkIN7kcJUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196699; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8LtNgDhy4E7cEUJMsKObImZDBL0RRTKw5zfiAHlfw94=; b=NR+YGBWNvq91Bqsug+QTG0UYYflj3c1WkO93K38dep/4qKDOxOj42mLLNBqggsR2DQM5S05JGdIsxpJI+4x3ShdagfILGIaWKmZwxpCYwyHN2k1Qkevf3fQHHEFu3UJQNwqFtJE3iY7zn5GiMWpTWs5RSaUK+80dQk6Nnmww3mY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196699225587.9795564731596; Tue, 16 Jul 2024 23:11:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxrq-00080r-NC; Wed, 17 Jul 2024 02:10:22 -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 1sTxrP-0005iA-4h for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:55 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxrN-000375-B6 for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:54 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-70b0e9ee7bcso4786706b3a.1 for ; Tue, 16 Jul 2024 23:09:51 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196590; x=1721801390; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8LtNgDhy4E7cEUJMsKObImZDBL0RRTKw5zfiAHlfw94=; b=jY23WuMnSpbeVu0voG4ZEVC+OeX2UZgJfyea/TxmFcSFOiq/O8RyPpakzcveFtqxjZ 39FXbRVDEAGIZ03RaTJXbo53kwUpUYx4xbNqK+zbzU6b28TmG9DC9PuJOIsoPOH4ctcO NGcZBGAow/RFs3AqRX6AYlxFc108Y3mnh2AxWUb7h4ESzCdgHSlRnnI1QH7kt+c0Q1Lt ONI/Gc/YFL+suN7hNeErO5pv2Or8h1SchAk9uRp2+zqkkCuq4ws0pDzebbitzR9kVmXQ W0jwEi8IGusA/FpxNraWvDfXDyb7FAcHttHGJPJbKBK2oKSDzIBKX+M2uSZL68prt9Hk LJvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196590; x=1721801390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8LtNgDhy4E7cEUJMsKObImZDBL0RRTKw5zfiAHlfw94=; b=W76q6036xdWDBWTbWBDfYPBSLUSzk1YwAwCts6kz1D6p3pYltUKU605ECkIsgf3Gsf Q3TkxK7/4NB1eVLnjU+yObQVCMsj2rdBweZUYQ3sDRmEr4pmOOhVzIKxVRUNpqM7SUHg 3ORChswdwUWYvJNwkqDdC33o3DPUkF14UhmNLeSs1gXKXdk5t/D8CYjotP6tgX43iIN9 MHox6EMhU8eZJN21++tkhnKIK71dHud1TyDY7eXC3xzr1T1E0ziDZjVuAo11Mk0/+0ad 1DCHFZObgpY1qpxApXlZnXhEE4SKlpNMt05+uIjqNfddJ9LqwoqLBTuI3NABNaENIQH0 YlpA== X-Gm-Message-State: AOJu0Yw4rcIVp5Flt3NYyx4XgXX5lvIsZWjVO35KwBl5Lwqp6/8bWQrO hkdkAvYC1dTas8UVZ9ezUWWcSXhgNzRKGxGAMG1gn74lszi35GvRYeETnln0NFU2RtQ7KlKO3qS PAR8= X-Google-Smtp-Source: AGHT+IFurGtiqOxSqLYRuKiVLuec3GNSC60d8C67RVZI+3SEvUQR1dDApSvPFUStD9C4i826mFbF+w== X-Received: by 2002:a05:6a00:c94:b0:70a:f38c:74cc with SMTP id d2e1a72fcca58-70ce4edc6a1mr867525b3a.8.1721196590494; Tue, 16 Jul 2024 23:09:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 16/17] target/arm: Convert SSHLL, USHLL to decodetree Date: Wed, 17 Jul 2024 16:09:02 +1000 Message-ID: <20240717060903.205098-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196701191116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 84 ++++++++++++++++------------------ target/arm/tcg/a64.decode | 3 ++ 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 627d4311bb..2a9cb3fbe0 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6972,6 +6972,45 @@ 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); =20 +static bool do_vec_shift_imm_wide(DisasContext *s, arg_qrri_e *a, bool is_= u) +{ + TCGv_i64 tcg_rn, tcg_rd; + int esz =3D a->esz; + int esize; + + if (esz < 0 || esz >=3D MO_64) { + return false; + } + if (!fp_access_check(s)) { + return true; + } + + /* + * For the LL variants the store is larger than the load, + * so if rd =3D=3D rn we would overwrite parts of our input. + * So load everything right now and use shifts in the main loop. + */ + tcg_rd =3D tcg_temp_new_i64(); + tcg_rn =3D tcg_temp_new_i64(); + read_vec_element(s, tcg_rn, a->rn, a->q, MO_64); + + esize =3D 8 << esz; + for (int i =3D 0, elements =3D 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 @@ -10436,47 +10475,6 @@ static void disas_simd_scalar_two_reg_misc(DisasCo= ntext *s, uint32_t insn) } } =20 -/* 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, i= nt rd) -{ - int size =3D 32 - clz32(immh) - 1; - int immhb =3D immh << 3 | immb; - int shift =3D immhb - (8 << size); - int dsize =3D 64; - int esize =3D 8 << size; - int elements =3D dsize/esize; - TCGv_i64 tcg_rn =3D tcg_temp_new_i64(); - TCGv_i64 tcg_rd =3D tcg_temp_new_i64(); - int i; - - if (size >=3D 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 =3D=3D 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 =3D 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, i= nt rd) @@ -10566,9 +10564,6 @@ static void disas_simd_shift_imm(DisasContext *s, u= int32_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); @@ -10593,6 +10588,7 @@ static void disas_simd_shift_imm(DisasContext *s, u= int32_t insn) case 0x06: /* SRSRA / URSRA (accum + rounding) */ case 0x08: /* SRI */ case 0x0a: /* SHL / SLI */ + case 0x14: /* SSHLL / USHLL */ unallocated_encoding(s); return; } diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 6aa8a18240..d13d680589 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -1218,5 +1218,8 @@ FMOVI_v_h 0 q:1 00 1111 00000 ... 1111 11 .....= rd:5 %abcdefgh =20 SHL_v 0.00 11110 .... ... 01010 1 ..... ..... @qlshifti SLI_v 0.10 11110 .... ... 01010 1 ..... ..... @qlshifti + + SSHLL_v 0.00 11110 .... ... 10100 1 ..... ..... @qlshifti + USHLL_v 0.10 11110 .... ... 10100 1 ..... ..... @qlshifti ] } --=20 2.43.0 From nobody Mon Sep 16 19:13:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1721196710; cv=none; d=zohomail.com; s=zohoarc; b=LHOvLa6lKBuIl/392A7prpLJ1RKj+Cbqh2QQ84g6hQNULZJuMoTYP5L+cq7TwDUwpOeC18zig/oMbJpVLhIb2B2gNA14PVbTG2vtZA7/gKT0sd4MR2T5C8hFRYCN3kr4on+A6HOpUyaQ4hk6VbA/qwCDCuh7raW26UyXiaAhZrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721196710; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=k+oYXE4L2h80inyKqiRmXD3B0YphDkaBHXm+psrg+vQ=; b=KIqBDww3+VWDanxzAVTfIK4+NyEa8ssb+tMTc1G0gcZKTkRTqJwVJ5NWxwPP9uUFbar3FLn/Wfh7cmRNgjyj5q9lyGqn3xev+un88eGxlYg+vtb1hrQeg0ds9mUS+FBhzJWwXNUj2t2sI3YND9V5953mk5vEKld7CX2FcCQEXhs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721196710634529.0815203959073; Tue, 16 Jul 2024 23:11:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTxs2-0000lP-63; Wed, 17 Jul 2024 02:10:34 -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 1sTxrS-0005xz-Kw for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:58 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTxrO-00037a-7z for qemu-devel@nongnu.org; Wed, 17 Jul 2024 02:09:56 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-70b1207bc22so5367647b3a.3 for ; Tue, 16 Jul 2024 23:09:53 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7ecd603bsm7330404b3a.219.2024.07.16.23.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 23:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721196593; x=1721801393; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k+oYXE4L2h80inyKqiRmXD3B0YphDkaBHXm+psrg+vQ=; b=g+tOtrZ92V2PZNTfVH9aMsS1c+c57ujzHlicbRQL6+1OpzAx8uAOYcv0IKWP40R/Gk cHp7X49nZMgyWotKIThb3WVr/I85subfbf7eNZB79l010fineqt7q6bNxrxRbxXvOX1g VvaRjnT6GG5bT/SESqd5cYclB8ugU4ds9kPNZNSYIaYv/Fef7i9vzIMt70vcXH7Gqzrz 2v9JCX35au7b/OVhGSdXKo4lDaZ3fiYV/4BgVXXl4n4XbcKSX7aQ19EAdSu4/gG7N9b/ D7vGHGe7bTV2zw+8VBDmQg2UNULuqvOvN+0uk48S6SneBhQGJnCNRyKaVUUjk7HOnPD3 Tqjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721196593; x=1721801393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k+oYXE4L2h80inyKqiRmXD3B0YphDkaBHXm+psrg+vQ=; b=rEUYoNZugQXkF6/8F7TcH18kxFe1nqveo0aumMhmgeV85wSOt92SdaWprWsW8P2Xa6 dNaY6EvUgcqYKqcTFGzZGvhZR8rzNUzyTCpldDi5mEeYD8Kxgb+SC00MdkhSWUq2fNRw ZlsvJ2iXYPxfMDNJ0Tc9WBHpuxwi4Y0+dHhdlfB8Hs207hKmW7AbbxUmdKA+atP3WFbY AgSfr9dU46uaGgAIYxCL9La62DrwilGsUw8ZEsOIer1jU9iGAeXW2z/jfWKPAQBvkseZ nmcpp0miFBovU6KH+95r2ykq7e0IrABg46f1ZpkP9W6s0WfKlts+NB0a8VMz6Hrjgq8G W9OQ== X-Gm-Message-State: AOJu0YyUuQjVFbvS1BAAe/laHofYQ4UxhkcvLccd8/q/NdOjBiYreUpC 9xAw50/okq8+F2pV2RI66WurHfOLWiGPlNjVnY/ByA/X+ZeeGUULHbccwPwM1EgqHz4O2+pzonv 2Hqg= X-Google-Smtp-Source: AGHT+IFTBloKj339jIs5AnaKm6VZAqt2eUYTkBp6m4mHHhwTz2e90UcJ4kfqJ03uQujE8p121Cc/Zw== X-Received: by 2002:a05:6a00:1743:b0:706:62b6:cbd3 with SMTP id d2e1a72fcca58-70ce4fff799mr1028138b3a.26.1721196592847; Tue, 16 Jul 2024 23:09:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 17/17] target/arm: Push tcg_rnd into handle_shri_with_rndacc Date: Wed, 17 Jul 2024 16:09:03 +1000 Message-ID: <20240717060903.205098-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717060903.205098-1-richard.henderson@linaro.org> References: <20240717060903.205098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1721196711215116600 Content-Type: text/plain; charset="utf-8" We always pass the same value for round; compute it within common code. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 2a9cb3fbe0..f4ff698257 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9197,11 +9197,10 @@ static void disas_data_proc_fp(DisasContext *s, uin= t32_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 =3D false; - bool round =3D tcg_rnd !=3D NULL; int ext_lshift =3D 0; TCGv_i64 tcg_src_hi; =20 @@ -9219,6 +9218,7 @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res,= TCGv_i64 tcg_src, =20 /* Deal with the rounding step */ if (round) { + TCGv_i64 tcg_rnd =3D tcg_constant_i64(1ull << (shift - 1)); if (extended_result) { TCGv_i64 tcg_zero =3D tcg_constant_i64(0); if (!is_u) { @@ -9286,7 +9286,6 @@ static void handle_scalar_simd_shri(DisasContext *s, bool insert =3D false; TCGv_i64 tcg_rn; TCGv_i64 tcg_rd; - TCGv_i64 tcg_round; =20 if (!extract32(immh, 3, 1)) { unallocated_encoding(s); @@ -9312,12 +9311,6 @@ static void handle_scalar_simd_shri(DisasContext *s, break; } =20 - if (round) { - tcg_round =3D tcg_constant_i64(1ULL << (shift - 1)); - } else { - tcg_round =3D NULL; - } - tcg_rn =3D read_fp_dreg(s, rn); tcg_rd =3D (accumulate || insert) ? read_fp_dreg(s, rd) : tcg_temp_new= _i64(); =20 @@ -9331,7 +9324,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); } =20 @@ -9384,7 +9377,7 @@ static void handle_vec_simd_sqshrn(DisasContext *s, b= ool is_scalar, bool is_q, int elements =3D is_scalar ? 1 : (64 / esize); bool round =3D extract32(opcode, 0, 1); MemOp ldop =3D (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; =20 @@ -9429,15 +9422,9 @@ static void handle_vec_simd_sqshrn(DisasContext *s, = bool is_scalar, bool is_q, tcg_rd_narrowed =3D tcg_temp_new_i32(); tcg_final =3D tcg_temp_new_i64(); =20 - if (round) { - tcg_round =3D tcg_constant_i64(1ULL << (shift - 1)); - } else { - tcg_round =3D NULL; - } - for (i =3D 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); @@ -10487,7 +10474,6 @@ static void handle_vec_simd_shrn(DisasContext *s, b= ool is_q, int shift =3D (2 * esize) - immhb; bool round =3D extract32(opcode, 0, 1); TCGv_i64 tcg_rn, tcg_rd, tcg_final; - TCGv_i64 tcg_round; int i; =20 if (extract32(immh, 3, 1)) { @@ -10504,15 +10490,9 @@ static void handle_vec_simd_shrn(DisasContext *s, = bool is_q, tcg_final =3D tcg_temp_new_i64(); read_vec_element(s, tcg_final, rd, is_q ? 1 : 0, MO_64); =20 - if (round) { - tcg_round =3D tcg_constant_i64(1ULL << (shift - 1)); - } else { - tcg_round =3D NULL; - } - for (i =3D 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); =20 tcg_gen_deposit_i64(tcg_final, tcg_final, tcg_rd, esize * i, esize= ); --=20 2.43.0