From patchwork Wed Oct 16 19:31:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 835827 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp604287wru; Wed, 16 Oct 2024 12:34:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVQEBTXzvIEAuPj2RUbirWedloOu9BdWzSQ3JG59XR6rvwXiSSs/Zc5NKcksyxxjmuQUyS+sA==@linaro.org X-Google-Smtp-Source: AGHT+IG7fiMBHNYhotwUVdCW2TjQWs7hMYZYGNpr0ReuhmdpQoaIkSKfZRiKLK1p3pFtCAJLPvFu X-Received: by 2002:a05:620a:4491:b0:7a9:b049:1c3c with SMTP id af79cd13be357-7b144ad226fmr554676885a.59.1729107281633; Wed, 16 Oct 2024 12:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729107281; cv=none; d=google.com; s=arc-20240605; b=dR1jGWIosuEyheAbRbgIKBz5/BQaYjWu2XuusFg9xFZKR8VzfanHr/yaVhzo1dydLO cJwqWUfyAtiyx9uKzNEsPl/412vPIa7zF66RBF06xR7B5qijWuatCr6zyuM9XRlo8tzR WiBTfHIdwlOY0WwSMt+3B9J1lNwTODndgwFMWXP5FsgW07ymVEwcLXn6j+ao/kDmtlKJ ZNURIsMMs/Ipk06jKcmOXlmYeOupuz3AgsrRwo5Gi+3GJ9ctteqyjRyz+Ny/b390jp8y RvXxsTLIx6dR01G6xOiDL5rsGsoXjy7Aw0A2VvXze80CuY6Ij/WIy8JX0pBpo0bDkZbx 73Tg== 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:cc:to :from:dkim-signature; bh=dluUCaEndjBCunQfjOsd/2zhh5fJAnoMBhZPYS0jDTY=; fh=0y6cSxTabxslIGhKb2QlpT+4cpL34OsHjArvPUG+rq0=; b=HkjFm6cPAZr7YFPy8VPeyFUBv7pN1GyZWklBJRvIwtKosK1IuLIIVymJpOLWcnx/ma MHvN/40g1FjAv+ZG71IgjHXBTDuTFk2IXM2VEt5X6UrMdzknRNVmRykDUCqCiC87EW1p nv0bFrnCrKhUsrMsL9O69PxxbP3H0zZaK6oPBBuR+kkb/qyRWDcBmh1LlzUrvKBfrPgA HK14Ys14RPWMZNNMXQwxZEP1F19uyRERlvwrOafIzhvUsST/sfvbcfTIsmmxQhcxB4Tv 546BbuAIahkXWs1t0Rc4NQ0kjqiQJB8c/lgWy/QI4YeTmaEjwFFnCsAz4vfeTMKCgm+P 46bA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s7GsZPax; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4607b4f5c56si46613581cf.767.2024.10.16.12.34.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Oct 2024 12:34:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s7GsZPax; 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 1t19kT-0002lZ-H9; Wed, 16 Oct 2024 15:31:57 -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 1t19kO-0002hf-Pq for qemu-devel@nongnu.org; Wed, 16 Oct 2024 15:31:53 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t19kL-0003pu-MT for qemu-devel@nongnu.org; Wed, 16 Oct 2024 15:31:52 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20c6f492d2dso2155405ad.0 for ; Wed, 16 Oct 2024 12:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729107108; x=1729711908; 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=dluUCaEndjBCunQfjOsd/2zhh5fJAnoMBhZPYS0jDTY=; b=s7GsZPaxxkxY9mrAShlFoEkdDaGA1fSqSQsCnG55hHPlVJHxhJV9kRBdu0QmG4jvcc c0pGWoeNEcBwR7xrmcUhe+mMpHaU+Q2eQAqvbl3rVmfJ1L6RbZuKPwUQxVSm6QysqLjw I632etlBZi/UQOgpLoXDFApfNz/MD94VwSaxQmzGy3/5Dtl9CwZJZQ5HyWniinaMjqrX e5iT7vEeL4bLLGVm7UNE69zWUP7H53mMgN6+EFz9gRHWdqqJQRCJoPmfnXBBuDmg4Dqj dLe4hB7+RC2EL/dFz+R+wZGma2LaDIQhyra3zgy3DbKW2daZ6jmG0gux/VjE1yhQkr96 ECYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729107108; x=1729711908; 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=dluUCaEndjBCunQfjOsd/2zhh5fJAnoMBhZPYS0jDTY=; b=vcTTbQi9G3hOYjsQWPe2dbdhneiykqrxxtb5Inzxa0cAhhxJOJtRX5rWCpD4xXpPf6 RtwLgB2S6wncKh6f6dPbzWhr7u5GwSWYW3RF62BeLhYpJ1hfEx63iWWmlodyN3D5/Wp3 QektMdAVAb+Ndo9LnAF4s/7aH9lojjyON6NtoEnkJlTrgu5gUSwlw52cjRqBRAe+hLTJ QBc8FycN3csI9fB1w/b6oMfYcxp/TZ/AGvgiIktiFPMZbsXhIlNenhcDmCE/rwHFDTpa 01XEMMvtzt8jyOAMo0ZTSvieS9ox3X0dKN7i679HsVMrEToJB5JVOCX4MYxGfl2cs3jz GRYw== X-Gm-Message-State: AOJu0YwpEeNUOLjjiyiZwwCbwrb+BtSWgFMRh7Dw2Hy+mDVV5fZzlYRl WnbqcoRHwpMlQjNVe+6ijR2Qp5V4mtEYOrHwRmiBO5agKSbfsyRPnaKX+qWan14j5EbnkM+Ajnx U X-Received: by 2002:a17:902:e951:b0:20b:59be:77b with SMTP id d9443c01a7336-20cbb1a9654mr260092385ad.6.1729107108225; Wed, 16 Oct 2024 12:31:48 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20d1804b6b1sm32323945ad.189.2024.10.16.12.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 12:31:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, zhiwei_liu@linux.alibaba.com, TANG Tiancheng Subject: [PATCH v6 10/14] tcg/riscv: Implement vector sat/mul ops Date: Wed, 16 Oct 2024 12:31:36 -0700 Message-ID: <20241016193140.2206352-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016193140.2206352-1-richard.henderson@linaro.org> References: <20241016193140.2206352-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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=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 From: TANG Tiancheng Signed-off-by: TANG Tiancheng Reviewed-by: Liu Zhiwei Reviewed-by: Richard Henderson Message-ID: <20241007025700.47259-9-zhiwei_liu@linux.alibaba.com> Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.h | 4 ++-- tcg/riscv/tcg-target.c.inc | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h index ae10381e02..1d4d8878ce 100644 --- a/tcg/riscv/tcg-target.h +++ b/tcg/riscv/tcg-target.h @@ -160,8 +160,8 @@ typedef enum { #define TCG_TARGET_HAS_shi_vec 0 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 0 -#define TCG_TARGET_HAS_mul_vec 0 -#define TCG_TARGET_HAS_sat_vec 0 +#define TCG_TARGET_HAS_mul_vec 1 +#define TCG_TARGET_HAS_sat_vec 1 #define TCG_TARGET_HAS_minmax_vec 0 #define TCG_TARGET_HAS_bitsel_vec 0 #define TCG_TARGET_HAS_cmpsel_vec 1 diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 1ce2f291d3..4758555565 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -284,6 +284,16 @@ typedef enum { OPC_VXOR_VV = 0x2c000057 | V_OPIVV, OPC_VXOR_VI = 0x2c000057 | V_OPIVI, + OPC_VMUL_VV = 0x94000057 | V_OPMVV, + OPC_VSADD_VV = 0x84000057 | V_OPIVV, + OPC_VSADD_VI = 0x84000057 | V_OPIVI, + OPC_VSSUB_VV = 0x8c000057 | V_OPIVV, + OPC_VSSUB_VI = 0x8c000057 | V_OPIVI, + OPC_VSADDU_VV = 0x80000057 | V_OPIVV, + OPC_VSADDU_VI = 0x80000057 | V_OPIVI, + OPC_VSSUBU_VV = 0x88000057 | V_OPIVV, + OPC_VSSUBU_VI = 0x88000057 | V_OPIVI, + OPC_VMSEQ_VV = 0x60000057 | V_OPIVV, OPC_VMSEQ_VI = 0x60000057 | V_OPIVI, OPC_VMSEQ_VX = 0x60000057 | V_OPIVX, @@ -2376,6 +2386,26 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, set_vtype_len_sew(s, type, vece); tcg_out_opc_vi(s, OPC_VRSUB_VI, a0, a1, 0); break; + case INDEX_op_mul_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vv(s, OPC_VMUL_VV, a0, a1, a2); + break; + case INDEX_op_ssadd_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vv_vi(s, OPC_VSADD_VV, OPC_VSADD_VI, a0, a1, a2, c2); + break; + case INDEX_op_sssub_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vv_vi(s, OPC_VSSUB_VV, OPC_VSSUB_VI, a0, a1, a2, c2); + break; + case INDEX_op_usadd_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vv_vi(s, OPC_VSADDU_VV, OPC_VSADDU_VI, a0, a1, a2, c2); + break; + case INDEX_op_ussub_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vv_vi(s, OPC_VSSUBU_VV, OPC_VSSUBU_VI, a0, a1, a2, c2); + break; case INDEX_op_cmp_vec: tcg_out_cmpsel(s, type, vece, args[3], a0, a1, a2, c2, -1, true, 0, true); @@ -2407,6 +2437,11 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_xor_vec: case INDEX_op_not_vec: case INDEX_op_neg_vec: + case INDEX_op_mul_vec: + case INDEX_op_ssadd_vec: + case INDEX_op_sssub_vec: + case INDEX_op_usadd_vec: + case INDEX_op_ussub_vec: case INDEX_op_cmp_vec: case INDEX_op_cmpsel_vec: return 1; @@ -2567,9 +2602,15 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_and_vec: case INDEX_op_or_vec: case INDEX_op_xor_vec: + case INDEX_op_ssadd_vec: + case INDEX_op_sssub_vec: + case INDEX_op_usadd_vec: + case INDEX_op_ussub_vec: return C_O1_I2(v, v, vK); case INDEX_op_sub_vec: return C_O1_I2(v, vK, v); + case INDEX_op_mul_vec: + return C_O1_I2(v, v, v); case INDEX_op_cmp_vec: return C_O1_I2(v, v, vL); case INDEX_op_cmpsel_vec: