From patchwork Tue May 28 20:30:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 799522 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp422044wrz; Tue, 28 May 2024 13:34:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXh14HDKy9D+eUtVXjDyQdoE8YEDAJkmu9R3k2DrS+atj74jhsI52zdBTt3u5/8OMTqe2RlEf2pTXE3jKU0gVFe X-Google-Smtp-Source: AGHT+IEJ8J3aS1/CdZa24jDm9AixIrhgfgvKnEmsIhL/opB61j7aCJMWj10Tujfep6d2g11r60Ni X-Received: by 2002:a05:6808:2015:b0:3c9:934b:6cd2 with SMTP id 5614622812f47-3d1a62fcaebmr15607244b6e.32.1716928446660; Tue, 28 May 2024 13:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716928446; cv=none; d=google.com; s=arc-20160816; b=KtljXsWJ5+CXoLvyVjkugftw6my+WYtqQUzvk/gkkkBnYTyStsPuXt00JWd06o09FT w9fiNcrZxGM66W2AxyylClTMAvZeXXjHJ42rLlPrfOJB3QUkovUAhhU4TIaUFIgTLUjy g3TJb1t5fCgQw1uXjujEt/bUZaOWWM5yMABTsTwdri550DxHo1HxNc9T56KlSzNENDEj +84Qy/vV1cgB4oYJenZfi/27+lVu4U5ay3CXj5yLstnzvLqIW60j558W9aqiHPo3t8Gg I9ZzDJmpy6edynEhRXxLYJ9qyVQzqYbQz6MvnKPGW0NzbFV0ihBD4tIWKa44wBl+iftH ijlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:cc:to :from:dkim-signature; bh=Bw2OR3avNdEp8SO81AHF6+sbRJu+jw044WvC2PSZAd8=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=tBuKAqSEN6kYiXDw3ZRTJ312L/rbwxtDzOTztih2/PclLT/7/7qK8Ga5kM2/mYKG+5 9YZzC0ku+gHwxV9zyZtJdFHw5Uf5I5KnFFGdzCheGhrNOb/f036PAwaSz/SF3LT5vZNi Z1h/Z1FDe9ptI0MeztPuMbMK0pc5zH2+V9+5MamzO2gMeFNWMGQ574JfnXAIrTojHqch 89/2Uso6R0dK3eLKCyQQJf2G+G1KyoUtkjB4cTwhDwCx3Ymd5dTKwE1hNkr5ZFcOfGJD bHD187BPwERLDtuL8aoiu+Uy8HBHVmjH01tY3rf9XA0wuSDg4lv1eFydqjGDBZXpPTIs bdTw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Z1B/BjVQ"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6ad7a546603si63059116d6.366.2024.05.28.13.34.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 13:34:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Z1B/BjVQ"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sC3TU-0002sz-Vn; Tue, 28 May 2024 16:31:14 -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 1sC3TL-0002o5-D4 for qemu-devel@nongnu.org; Tue, 28 May 2024 16:31:04 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sC3TA-0003ZG-O1 for qemu-devel@nongnu.org; Tue, 28 May 2024 16:31:02 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6fcbd812b33so1132827b3a.3 for ; Tue, 28 May 2024 13:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716928248; x=1717533048; 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=Bw2OR3avNdEp8SO81AHF6+sbRJu+jw044WvC2PSZAd8=; b=Z1B/BjVQrhnsBkN+1VdTuJoEf4Jna6F4+PtPvTW2ih6FInMPrAiKe6WxmlB3oSwOQS wOeUvXWsopRTb9apLyf0QZ/LxNiSSxy6XQgylhJz3/uMg02UMMmChkLxq1pkA1L10auz LhrvGmz5MYq4FmVO1iXOkrGqc1rZ7oUpUuWMdMvPQSPbF1KpWea20AHd1uaKTPYZRgZo se2ZjcrSbKWFtU12/XNMbC9dokikr/XsuugQ8Zit0vuFYRgyu7rgSEsnNU8P1g0c/bcg /Xoc5dNv6L+m8e7WZvKcpvu/z66+t8gMZ/TwbKJsPk3+4BySWL1MPThcHa59zQBpdYh/ LQkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716928248; x=1717533048; 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=Bw2OR3avNdEp8SO81AHF6+sbRJu+jw044WvC2PSZAd8=; b=jGvwCLiBvE+hRwKb/oui8CMCjD5IBW/7C4C986LOgKEO1dFxmW5QEiqABxkstjy5IZ qB14AeyUnV9oIjRvPBuV9PuKF2nkF7S1vhR+eSIozbaoBtS2fxSslghhbh/FEK7djsHO ruoYEw9t2XgeCciMclY7rF2lDaENh4gHDNv4xXIWqrf/Z0CM77E+aGbYiwBe2hN66rqh 43F24rZJRF9D/0oIorsIaUfm0UQ/tgC1d18heVbR/GrQok1dBu4wXZ/YADIPOpzWGVxI skgkPm1TQxKz1iumXlWfP3HPH5YuIDF5GcKD8pKdKvO8vOGldTMTe8J6bi/+20rzXIQn Kbnw== X-Gm-Message-State: AOJu0YyEZ7Wxp6t3rqOezYMtNaKtkqxJrZb50ByAn765WKenud8TxQqb rC29s7i/X7mD2a49BvylRLrRJ8cb/UU90DEkURaK9tthiXSRi5VwnWRLw1Fgy5f+TFZRAt2yejj z X-Received: by 2002:a05:6a00:39a2:b0:6f8:fe77:8a0a with SMTP id d2e1a72fcca58-6f8fe778b79mr13467121b3a.32.1716928247724; Tue, 28 May 2024 13:30:47 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fbd3dbe9sm7042036b3a.10.2024.05.28.13.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 13:30:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 02/33] target/arm: Improve vector UQADD, UQSUB, SQADD, SQSUB Date: Tue, 28 May 2024 13:30:13 -0700 Message-Id: <20240528203044.612851-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240528203044.612851-1-richard.henderson@linaro.org> References: <20240528203044.612851-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=unavailable 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 No need for a full comparison; xor produces non-zero bits for QC just fine. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/gengvec.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/target/arm/tcg/gengvec.c b/target/arm/tcg/gengvec.c index 22c9d17dce..bfe6885a01 100644 --- a/target/arm/tcg/gengvec.c +++ b/target/arm/tcg/gengvec.c @@ -1217,21 +1217,21 @@ void gen_gvec_sshl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, &ops[vece]); } -static void gen_uqadd_vec(unsigned vece, TCGv_vec t, TCGv_vec sat, +static void gen_uqadd_vec(unsigned vece, TCGv_vec t, TCGv_vec qc, TCGv_vec a, TCGv_vec b) { TCGv_vec x = tcg_temp_new_vec_matching(t); tcg_gen_add_vec(vece, x, a, b); tcg_gen_usadd_vec(vece, t, a, b); - tcg_gen_cmp_vec(TCG_COND_NE, vece, x, x, t); - tcg_gen_or_vec(vece, sat, sat, x); + tcg_gen_xor_vec(vece, x, x, t); + tcg_gen_or_vec(vece, qc, qc, x); } void gen_gvec_uqadd_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz) { static const TCGOpcode vecop_list[] = { - INDEX_op_usadd_vec, INDEX_op_cmp_vec, INDEX_op_add_vec, 0 + INDEX_op_usadd_vec, INDEX_op_add_vec, 0 }; static const GVecGen4 ops[4] = { { .fniv = gen_uqadd_vec, @@ -1259,21 +1259,21 @@ void gen_gvec_uqadd_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, &ops[vece]); } -static void gen_sqadd_vec(unsigned vece, TCGv_vec t, TCGv_vec sat, +static void gen_sqadd_vec(unsigned vece, TCGv_vec t, TCGv_vec qc, TCGv_vec a, TCGv_vec b) { TCGv_vec x = tcg_temp_new_vec_matching(t); tcg_gen_add_vec(vece, x, a, b); tcg_gen_ssadd_vec(vece, t, a, b); - tcg_gen_cmp_vec(TCG_COND_NE, vece, x, x, t); - tcg_gen_or_vec(vece, sat, sat, x); + tcg_gen_xor_vec(vece, x, x, t); + tcg_gen_or_vec(vece, qc, qc, x); } void gen_gvec_sqadd_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz) { static const TCGOpcode vecop_list[] = { - INDEX_op_ssadd_vec, INDEX_op_cmp_vec, INDEX_op_add_vec, 0 + INDEX_op_ssadd_vec, INDEX_op_add_vec, 0 }; static const GVecGen4 ops[4] = { { .fniv = gen_sqadd_vec, @@ -1301,21 +1301,21 @@ void gen_gvec_sqadd_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, &ops[vece]); } -static void gen_uqsub_vec(unsigned vece, TCGv_vec t, TCGv_vec sat, +static void gen_uqsub_vec(unsigned vece, TCGv_vec t, TCGv_vec qc, TCGv_vec a, TCGv_vec b) { TCGv_vec x = tcg_temp_new_vec_matching(t); tcg_gen_sub_vec(vece, x, a, b); tcg_gen_ussub_vec(vece, t, a, b); - tcg_gen_cmp_vec(TCG_COND_NE, vece, x, x, t); - tcg_gen_or_vec(vece, sat, sat, x); + tcg_gen_xor_vec(vece, x, x, t); + tcg_gen_or_vec(vece, qc, qc, x); } void gen_gvec_uqsub_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz) { static const TCGOpcode vecop_list[] = { - INDEX_op_ussub_vec, INDEX_op_cmp_vec, INDEX_op_sub_vec, 0 + INDEX_op_ussub_vec, INDEX_op_sub_vec, 0 }; static const GVecGen4 ops[4] = { { .fniv = gen_uqsub_vec, @@ -1343,21 +1343,21 @@ void gen_gvec_uqsub_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, &ops[vece]); } -static void gen_sqsub_vec(unsigned vece, TCGv_vec t, TCGv_vec sat, +static void gen_sqsub_vec(unsigned vece, TCGv_vec t, TCGv_vec qc, TCGv_vec a, TCGv_vec b) { TCGv_vec x = tcg_temp_new_vec_matching(t); tcg_gen_sub_vec(vece, x, a, b); tcg_gen_sssub_vec(vece, t, a, b); - tcg_gen_cmp_vec(TCG_COND_NE, vece, x, x, t); - tcg_gen_or_vec(vece, sat, sat, x); + tcg_gen_xor_vec(vece, x, x, t); + tcg_gen_or_vec(vece, qc, qc, x); } 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) { static const TCGOpcode vecop_list[] = { - INDEX_op_sssub_vec, INDEX_op_cmp_vec, INDEX_op_sub_vec, 0 + INDEX_op_sssub_vec, INDEX_op_sub_vec, 0 }; static const GVecGen4 ops[4] = { { .fniv = gen_sqsub_vec,