From patchwork Tue Oct 22 00:11:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 837525 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c9:0:b0:37d:45d0:187 with SMTP id f9csp2287822wrt; Mon, 21 Oct 2024 17:13:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXgAZTv9+YLOryjRyRRU07kIpK/N9tp9NzwALhSRnPbOZoVBL0egiuoKo2797QH4W50S7PGqQ==@linaro.org X-Google-Smtp-Source: AGHT+IGHkQx0bQTGy/aQiZiM0rOOkUSA5zVUxhKP+0mQRpXp7P2sI0l5Y1P8K9wJQ+R0UlxZwYWA X-Received: by 2002:a05:6214:5b10:b0:6cb:9359:1e90 with SMTP id 6a1803df08f44-6cde16616bbmr237054456d6.43.1729556018708; Mon, 21 Oct 2024 17:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729556018; cv=none; d=google.com; s=arc-20240605; b=JB1GYmRhPvWSUNeDmr+iAibbVBn0NgU+ftWTvMk6Rie4bFJUNHc1SPKLgx6y13tULE B3UuUVNZQem3TQHYokc/NvArU8oAi8Wb5i3luV/X60d0B48MDO/2cILtqHba1raxwUfh JukGHPRngAJPFT75AakxRuePXxezw6v7bVE380CHY+r7ywl3ZkUU4w7RO7u/NW0jNgfR WROhPinTQ6sG/ShiEkJ1YPzRR5IXmLoy2G+hhGlAgUyPBeSVbJfng4xJvzyic4jK+qfa VBT5QyeW5GYrQ+lRbb9JfL92W1dBlYtirJD4Y87mM7vsZcY6gX8SHsvrRz8FQuy22Qe/ MH4w== 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=NcoVC7uASE005078E1lCBep8eFF9gWSTNDssD7Ljns8=; b=Vk8IkJPIc8RKs1DLvAhgtOWps8LR66xMm96fh2onMOzWs4bYRa6uRVNP8ns1Mo1pUx YcASPRulZd3BAvT2866V8us5GDicj5wFfOSf39Q5eI3ca8JGGa7o0PwDQ4AddAPqKj3t Ifb0ppsap4D4TpdVDFVDM3l0Ai2xtJUIxT3ml2388nz1LVWbPPlrX0Ix+yNK3IHiAoOp MScLHNvK2qNYVk4790erbi76VJZ9rz5RkwJjUfB59HYYHZLQGvV/vlI6ux3M2tSnZows hYqvsBjjhewejiT6DP4RO6oXr56+vLemA099LwlbKYuA3YCSuNQzNz6wFTe4mLeRgTdB 4DdQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KQNvrJGg; 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 6a1803df08f44-6ce0089953bsi51844996d6.59.2024.10.21.17.13.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Oct 2024 17:13:38 -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=KQNvrJGg; 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 1t32VU-0000Ec-PQ; Mon, 21 Oct 2024 20:12:16 -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 1t32V4-000060-Hk for qemu-devel@nongnu.org; Mon, 21 Oct 2024 20:11:50 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t32V0-0005VE-ES for qemu-devel@nongnu.org; Mon, 21 Oct 2024 20:11:50 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-20ca388d242so35153815ad.2 for ; Mon, 21 Oct 2024 17:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729555903; x=1730160703; 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=KQNvrJGgzlb7NypIPYvw9vOfZRt2MDeKPnYeip7T3OCGrFxZNEB3itEG3Utnd/IEKZ Vzctdw69FqqWXfhBdiAZjpFO2jwLK0jDS4fMppyYCeYseDGPk1qZqydY5Ac+yliFLiXV b4LrciNJbcr0yI1hnwVsTz3vVM+WcKxxSClSNdaUH70F6nme659j9RYwkD+c3kak0Ze5 hcAuF+nXuia3/SIqTGd5xmkDxlg0uahNN7eGmX6hFfqu3ltM/d0DVm+H2VT/b3IhZW6D fvDCzIcp0aTGvuNoMjT1Krl8AKiTMh/DljIFRILhlkVVintq9OJ1FWMTofEoDer60yk5 oalw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729555903; x=1730160703; 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=O01Ef1IiN78mphGi0t+Y1mnBZu2i6DdFI1yNTq+HG4ytKMhlSyJTwaGPxDpeTydyB8 LwUJ7cBb2dpQonRgqD5zyMVfH8ELuKIatH70oc/JLFenkp7susk3fvyeLZsD1yNk6Tmw kCOo////PyidIHo8plMJsos+MOaiQpxwxzVyDuQ1y5pPHKtrfTKYlwoM+qLjRKEOEHi4 NrCE0AjkrySKsA+ZMd8gPWBVSER24sNwAySaX8pnQ4Dh3inW3fcuJLZQoWbXnmU5ZjdQ YuLxvHKBLUhbcJqdAdoMMCDkxT7/t8RMBdVFRFI/XvCvoNfCAwfnL7YMdswuSJ/TV6Gv 6AtA== X-Gm-Message-State: AOJu0Yw8IgvujHQgkz1cJXu3EjSBS4GpCNg025slfKXL8GKxLJwnnXNO +/FkRKiO4m2NhqgUJrugw6B9I7qhi7mC3oD6eLf2rDGnUbcpCE/zwraeDPNoA+DJfzzHF492LDy d X-Received: by 2002:a17:902:e552:b0:20b:8ed8:9c75 with SMTP id d9443c01a7336-20e5a9927f3mr197908595ad.59.1729555903619; Mon, 21 Oct 2024 17:11:43 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20e7f0f6462sm31681145ad.272.2024.10.21.17.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 17:11:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, dbarboza@ventanamicro.com, alistair23@gmail.com, TANG Tiancheng , Liu Zhiwei Subject: [PATCH v7 10/14] tcg/riscv: Implement vector sat/mul ops Date: Mon, 21 Oct 2024 17:11:30 -0700 Message-ID: <20241022001134.828724-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241022001134.828724-1-richard.henderson@linaro.org> References: <20241022001134.828724-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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: