From patchwork Thu Sep 19 13:10:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829603 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316704wrn; Thu, 19 Sep 2024 06:12:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWovBmVScoWwYtBmMtCNm555IKsyuxgm9bl/4oeV8Tmn8teJYJcNUXHizewQEQ0UpGXWQpjtQ==@linaro.org X-Google-Smtp-Source: AGHT+IGReJL2VPrC9k0WLu2xP2RrFeOmMaoFJBF38ibHgT4kbqFFVhCvQ0WHLllIlqsqJniuptll X-Received: by 2002:a05:6122:3710:b0:501:13b1:d2e0 with SMTP id 71dfb90a1353d-503c9b824f5mr2346499e0c.1.1726751575565; Thu, 19 Sep 2024 06:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751575; cv=none; d=google.com; s=arc-20240605; b=Idr2plVVf4EjpyldUQvbsotO0NZ6bo2spKqpsrLyAPaULmSjvjHn3V+13DuX4MMAcO maNRSkT4sKqznlE70Bna988YQC/svcboKJMIqBsZEew2UT+eB/hwiJXfRDlxsCRBGwJZ Xo3Ac0yai9cIt9pQ+zn+jGKT0nkuD6+kE5YdyLzshwwnXqJzdAkMH20/8DC+mhf6Yx04 f8coDiwByjLitwxVpHGZ2ACXEW7ZQzj71NlaxAYnG7SFlozFS4wAx65lKMVb94OupY2N ZJhLdCmadMBtc/hAUFN9vTAt3vozh2HUAl9xrEbwQWRROphk0C88Y78acmDlbLswPukR LALQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yJUYEhTNiz8x7jW5BdcZtlOjlfWgR1fgHUkwcdaNL2s=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=VuA4D+Ls5yggqIdXT9vkyk0oE5ahkDoNnMFH6UOK3DmsvCAkpHxYMdgA7K4uEQ59Nv w4pZzPnZt1Bpa1dwy4OG58QNvkLfMRoe5hn17i17zfH04rkI32KwQHMH8qHisPgspyP6 FPthQs+jSLUmMiL4iCOXz9tApElHNm2A1kND9c9Ow29IH3uvxFtriDHyWYazie6bQd55 a0+Ho8KxV53DwwsR8LxndqEc3u7o0sjhHTE8P2niTQzgXoi6DYyjljXsEttaZNgqxRPQ Ss/JXxq447/+l0JQ04DUE6WpjRQ8FHJ2SmM9kCaiodfyg9V81okA1HdPyaRmnlhA5lDS pPrQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UnWSGbjV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5035bc817desi2467273e0c.231.2024.09.19.06.12.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UnWSGbjV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwI-0004Xg-EE; Thu, 19 Sep 2024 09:11:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srGwF-0004Tl-Dd for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:15 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwB-000105-Kz for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:13 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-42bb7298bdeso10283695e9.1 for ; Thu, 19 Sep 2024 06:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751470; x=1727356270; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yJUYEhTNiz8x7jW5BdcZtlOjlfWgR1fgHUkwcdaNL2s=; b=UnWSGbjVkFHYKDRJ3N4FXxzNJmzRxWv8pa7mXko1KRVWA5C4RcAMughRDhwWz9V83j EpzCfBM7JW7SvFmFbNqG4uVJ7Yo9Bb5atGSy9nklMYP5qkGmprJz47whsfuvifvbMAOc yTTQcPh1wcb4khPZE/TYNg3cB4Ycd9NYW/bF97ujea7qPAFbFR/u+6XH11234+ghE9Ed EQi2aO1O/ffX71GES7+9lHph5fFozAjCCSqM063xK0A66Ruk071lEwJcAJ82tqnPtyxe 5PXbe47LJC7q5MEWv6lld98x+mkezIdi4YxUrPhYQX6fvbIodrJtJhecGLCBtRD+Vhz0 5/Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751470; x=1727356270; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yJUYEhTNiz8x7jW5BdcZtlOjlfWgR1fgHUkwcdaNL2s=; b=r25lWFsoYbO16JVZt4PMvvr3SPHTfyyP1779U/E8VLFYfb4HKPQN13IAfBopkagZ// 4r6vPI4tMF/IUn94is9Z3DC5su2TKqtkSsQccP56zArga7i4TlRl0IG3j/0b+uZyfkXs fYPrqzMH+kbwHTat7I2usjn7zZHN5U8QDxZgiFbHIe4TGxi5iMvrbypx4MLD4DKGNKZZ JP6V76EXINuWaaxNhS7RtQAEFmvb0DsFjQtbk3vP/iG/QJeqizfC3xxyQvitBwkdxxYD D+m8f6BBbEpIw/+xMwkj2UjEze1RP0n4DD2Zg8fxO9KgbPtxabELOS+hAufnaT/Kt+i2 Wnbw== X-Gm-Message-State: AOJu0YwdzGFEkOogFh68CUTmJVK1RXBL3pOA9kKdYhJ3TXRVhaxUdusX WkC6olv3Fdi7l1mLPWZcSCrx8SslrIIFIhkJYIJ9TzSrrcs04/0/30ymL7saizO9GZ0+9BxyQjg 4 X-Received: by 2002:a05:600c:4f01:b0:42c:aeaa:6b0d with SMTP id 5b1f17b1804b1-42d907205a5mr212889925e9.9.1726751469997; Thu, 19 Sep 2024 06:11:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/38] target/arm: Use cmpsel in gen_sshl_vec Date: Thu, 19 Sep 2024 14:10:32 +0100 Message-Id: <20240919131106.3362543-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Instead of cmp+and or cmp+andc, use cmpsel. This will be better for hosts that use predicate registers for cmp. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-5-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/gengvec.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 3edbf3a2627..c5fc1b6cfbf 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -1160,7 +1160,6 @@ static void gen_sshl_vec(unsigned vece, TCGv_vec dst, TCGv_vec rval = tcg_temp_new_vec_matching(dst); TCGv_vec lsh = tcg_temp_new_vec_matching(dst); TCGv_vec rsh = tcg_temp_new_vec_matching(dst); - TCGv_vec tmp = tcg_temp_new_vec_matching(dst); TCGv_vec max, zero; /* @@ -1180,16 +1179,15 @@ static void gen_sshl_vec(unsigned vece, TCGv_vec dst, /* Bound rsh so out of bound right shift gets -1. */ max = tcg_constant_vec_matching(dst, vece, (8 << vece) - 1); tcg_gen_umin_vec(vece, rsh, rsh, max); - tcg_gen_cmp_vec(TCG_COND_GT, vece, tmp, lsh, max); tcg_gen_shlv_vec(vece, lval, src, lsh); tcg_gen_sarv_vec(vece, rval, src, rsh); /* Select in-bound left shift. */ - tcg_gen_andc_vec(vece, lval, lval, tmp); + zero = tcg_constant_vec_matching(dst, vece, 0); + tcg_gen_cmpsel_vec(TCG_COND_GT, vece, lval, lsh, max, zero, lval); /* Select between left and right shift. */ - zero = tcg_constant_vec_matching(dst, vece, 0); if (vece == MO_8) { tcg_gen_cmpsel_vec(TCG_COND_LT, vece, dst, lsh, zero, rval, lval); } else { @@ -1203,7 +1201,7 @@ void gen_gvec_sshl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, { static const TCGOpcode vecop_list[] = { INDEX_op_neg_vec, INDEX_op_umin_vec, INDEX_op_shlv_vec, - INDEX_op_sarv_vec, INDEX_op_cmp_vec, INDEX_op_cmpsel_vec, 0 + INDEX_op_sarv_vec, INDEX_op_cmpsel_vec, 0 }; static const GVecGen3 ops[4] = { { .fniv = gen_sshl_vec,