From patchwork Thu Sep 19 13:10:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 829599 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp316310wrn; Thu, 19 Sep 2024 06:12:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWaYVtsCTv4rKNbuSpufPnBEmpK/6I1Xiv6xK9YEF2OogdmzGSxXgNfc1SvHXL43LrUFc06Dw==@linaro.org X-Google-Smtp-Source: AGHT+IGabwSTXWJi9T8d5oOJMbk6ELnN7zs/ebrRc4Eu8AHpi1utHUx5SADe7jnbY+o5O49tFXX0 X-Received: by 2002:a05:6808:3207:b0:3e0:4ed8:80a4 with SMTP id 5614622812f47-3e07a1331ffmr12916260b6e.28.1726751527377; Thu, 19 Sep 2024 06:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726751527; cv=none; d=google.com; s=arc-20240605; b=hoG5/I8EG4bz9fls3Nh9214Q7JMOQ1jLBFwL/Wq/aZm3cuSqpAiTQUlHNpDtg+IrmR uv+t8jqoCx++66z2xXfq65q3vC5eiIcwQfI9iURg3cyZvNyGtPd37dvgn86MzRCUldbx 84fn+xtpg5qwkFkh3aNFLNxWkAaUXAJnAcBnjWrXtc6qBjUczhPaDoQ0pCLgcwU/gtGL bB0oFgTkl7/KNI2YenkW8kniZVoT2mOjg+TItLA5+Kfahc99QTiLIzLTqPg6nlGbSPV/ OD8MXUS7J9amTWqMYDEdXKMAfI7VtO3VLUHz2dvEUIR0IrTku8Ch4a0cRAiy7SDceUUX IRsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=He6YBSgRqmlZmIL7adkdTXMZx39goQaKpXwPEt+3grs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=VtiBQtq4bMQQyCMSsb/IviBNf0OHc+7d0+VFxGNCG9CSQN8zwGpVMY1+U9G3KOheE6 Jo5YOdoRY10Hvf+pKSz3H56PvoQXDq75OTS8/wuD2H87mJGbS7oAf1awi5xW+75ciplN uGE/IHlt7a9cup7vDIZpuGRfvYI+wGc2/epBItTvSaBxsOT7tmhaQN0cEUfoz1lhTDQW IYWSaEVM+/oNWzzC+972CD3Witf0oTNLlfLK0IJ9cp/Awk1GIfSuMKL9w9dWE7nmFViQ i4Qo1ay96SWs35lJcOu8iU6Hnam9ExVLdG9+p6oa7nfmuJvf+pybDKgbFCqBuPvu8vuF 52nQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwJmh3L4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a1e0cc1a2514c-8493990c38esi2058069241.119.2024.09.19.06.12.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2024 06:12:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwJmh3L4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srGwJ-0004dd-EB; Thu, 19 Sep 2024 09:11:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srGwE-0004Sz-Od for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:14 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srGwB-0000zw-3l for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:11:13 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42cacabd2e0so6925015e9.3 for ; Thu, 19 Sep 2024 06:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726751469; x=1727356269; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=He6YBSgRqmlZmIL7adkdTXMZx39goQaKpXwPEt+3grs=; b=xwJmh3L4Zc1scCPkauPp8ZiXEucFVL3SC0HDEeyHBk0+YjQVael30atiHQUctb1u2A Eyvo9YjW1W7vGZFLAuH+oylor1DPRVJwvuOI2UQXwHUO7PG1u/kwoUxyEdY5PhVS8kCF 8rxMiWsscUSXEsVzwYO0kYfb71/DTnbpRZcHzK0CO1syauZdK4DKmOuTmzpI/r+QllaH cZhkefrrsrrgvki2ieaIfUXOLKkwJC+yKLTWGMA4qDnn4k+XtBOW57C4tyDcAPQRTFVm f6LEx+m7EF+4WaJChk8IqNIHaNI+4Ga485g6/Fy5rNPgLhG0noAbIKPAP1QHbscLSW3V D8Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726751469; x=1727356269; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=He6YBSgRqmlZmIL7adkdTXMZx39goQaKpXwPEt+3grs=; b=OCpF0ewHGOS6VKq8n8BWSywI7xYCD5wJHHNa/fU2ZfMSKEStqRbbHSGyccOTuT9zg6 XT3QeVFGB/aCMr8PynLHVrzFOf07V0FkKfWQzAus+2k/oNYhvVIXDHiRSXVYebxUbkmu gMmU11XLaEggaHawSPjmTWkd4iRC7adAP0ZTbumE3jB+V49Q5Pzg32xYsvYhuu3DwEa4 hTGOdVqvMjJDVHYNnys/vFo7cprCqizSMaQmTw8p0Z93Eo7gbKggr/o3ubw+n/pwpxF0 nV+pjDpNgaEXR2DwSvbX5nPMBJ/lwlI1d0K7Q4eCgYGagNTDmvX5S20jEKT0NZ9o5Man 77tg== X-Gm-Message-State: AOJu0YzwS0b81bJcNiDhia8TGTlLxKKfUf0ChG5XgknguHEmGASdTedt VKFe0+OWqMt6dmHQpXLwbQiobX388nftCdxF4ggCxvFpyaKsl7zmjbEnhp5j48NbcOfXfl0dEJh d X-Received: by 2002:a05:600c:3108:b0:42c:be90:fa2f with SMTP id 5b1f17b1804b1-42cdb5662bfmr205865065e9.25.1726751469457; Thu, 19 Sep 2024 06:11:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e754091d3sm21667845e9.10.2024.09.19.06.11.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:11:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/38] target/arm: Use cmpsel in gen_ushl_vec Date: Thu, 19 Sep 2024 14:10:31 +0100 Message-Id: <20240919131106.3362543-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919131106.3362543-1-peter.maydell@linaro.org> References: <20240919131106.3362543-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Instead of cmp+and or cmp+andc, use cmpsel. This will be better for hosts that use predicate registers for cmp. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20240912024114.1097832-4-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/gengvec.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 726a1383aed..3edbf3a2627 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -1041,7 +1041,7 @@ static void gen_ushl_vec(unsigned vece, TCGv_vec dst, TCGv_vec rval = tcg_temp_new_vec_matching(dst); TCGv_vec lsh = tcg_temp_new_vec_matching(dst); TCGv_vec rsh = tcg_temp_new_vec_matching(dst); - TCGv_vec max; + TCGv_vec max, zero; tcg_gen_neg_vec(vece, rsh, shift); if (vece == MO_8) { @@ -1061,23 +1061,20 @@ static void gen_ushl_vec(unsigned vece, TCGv_vec dst, tcg_gen_shrv_vec(vece, rval, src, rsh); /* - * The choice of LT (signed) and GEU (unsigned) are biased toward + * The choice of GE (signed) and GEU (unsigned) are biased toward * the instructions of the x86_64 host. For MO_8, the whole byte * is significant so we must use an unsigned compare; otherwise we * have already masked to a byte and so a signed compare works. * Other tcg hosts have a full set of comparisons and do not care. */ + zero = tcg_constant_vec_matching(dst, vece, 0); max = tcg_constant_vec_matching(dst, vece, 8 << vece); if (vece == MO_8) { - tcg_gen_cmp_vec(TCG_COND_GEU, vece, lsh, lsh, max); - tcg_gen_cmp_vec(TCG_COND_GEU, vece, rsh, rsh, max); - tcg_gen_andc_vec(vece, lval, lval, lsh); - tcg_gen_andc_vec(vece, rval, rval, rsh); + tcg_gen_cmpsel_vec(TCG_COND_GEU, vece, lval, lsh, max, zero, lval); + tcg_gen_cmpsel_vec(TCG_COND_GEU, vece, rval, rsh, max, zero, rval); } else { - tcg_gen_cmp_vec(TCG_COND_LT, vece, lsh, lsh, max); - tcg_gen_cmp_vec(TCG_COND_LT, vece, rsh, rsh, max); - tcg_gen_and_vec(vece, lval, lval, lsh); - tcg_gen_and_vec(vece, rval, rval, rsh); + tcg_gen_cmpsel_vec(TCG_COND_GE, vece, lval, lsh, max, zero, lval); + tcg_gen_cmpsel_vec(TCG_COND_GE, vece, rval, rsh, max, zero, rval); } tcg_gen_or_vec(vece, dst, lval, rval); } @@ -1087,7 +1084,7 @@ void gen_gvec_ushl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, { static const TCGOpcode vecop_list[] = { INDEX_op_neg_vec, INDEX_op_shlv_vec, - INDEX_op_shrv_vec, INDEX_op_cmp_vec, 0 + INDEX_op_shrv_vec, INDEX_op_cmpsel_vec, 0 }; static const GVecGen3 ops[4] = { { .fniv = gen_ushl_vec,