From patchwork Tue Oct 22 00:11:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 837533 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c9:0:b0:37d:45d0:187 with SMTP id f9csp2288213wrt; Mon, 21 Oct 2024 17:14:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXLOI4G57uRDzkx3o9+I1g0+esDEeQ9JR+koo6+dh7EDAUCLy2wito8c2ibS5vZdyK8G3Ngcw==@linaro.org X-Google-Smtp-Source: AGHT+IHmaRbmki5d1vj+nTC2xJpte54x0+02U9qEW1nm7Jkw97mUQxDaYp4jtMJH3dZgnVkfdhWK X-Received: by 2002:a05:622a:214:b0:453:5f05:2ba3 with SMTP id d75a77b69052e-460aed18fc8mr232221511cf.8.1729556083883; Mon, 21 Oct 2024 17:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729556083; cv=none; d=google.com; s=arc-20240605; b=FlOKmIVCXEhfn7MHGsoP8SEmpnatJhrsnhJsipV+SJ1vvcZ4ap4TljAK96A0YSIbou +WW+mez5XvPqsUj6obZT5UPcgbKFbgSBHa0eFcXA3AByV9ioGsMctUTKUqsH4cd20GpA tVDjrMwpxgJx4Dy6xEMAlW9ysKADY9F6uKNXsiyJ5VxqTeroGfrt9xuADPqf7kvf9J+r Q6tWLwLDyE8i5rC9xJ/B0KT1P38fVhh/VblGk+fxo6cdrkwyxlk2A2mnHbXyxGctf8RN ZsRo9kiIRWNT11gCn6YDgkoaiqRxLVM0cdyc9y8ls60iPmrWU/sE5lN3NF9XHscrxLxJ VR0A== 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=F16mOGOCEtDulhf7gkD6+zfYNl/76OFFUvZQ0M86ofc=; fh=NcoVC7uASE005078E1lCBep8eFF9gWSTNDssD7Ljns8=; b=aNelbG/328d7RZWpnSR5aU76Gvj3c19n+lv8jV33GZwrwJmAann21bXP0vs4OZO1az GsCHhlMBHg7Z4p3NDViYfFPQdNO1YNCJeRSVegktS6HN2mVVQ4MFEJIeW/j2n7qU6fL5 cV9fR9Bx0tDFTRJOBHbfXooTnCcxp9EvsGzRUwVSDs0Zz+0+JERvuQSXuDJVFVTTVoiQ KG11mRyOCbu4x1TIrN+ZMVgON4iVvaHZduClHqN5e4elvkPYWqtc6ZsREon7LWy3jBSV wE11k6ujHeUrYn0rhSMjjhJcM6xNMbj8flxbGXDnA8ABBJtTKvMtj5gxUUmANfoBITZ9 /8SA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UGJTP61R; 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-460d3d6dbe0si51108231cf.644.2024.10.21.17.14.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Oct 2024 17:14:43 -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=UGJTP61R; 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 1t32VV-0000Ei-5e; Mon, 21 Oct 2024 20:12:17 -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 1t32V3-000052-6E for qemu-devel@nongnu.org; Mon, 21 Oct 2024 20:11:49 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t32Uy-0005Uh-Qo for qemu-devel@nongnu.org; Mon, 21 Oct 2024 20:11:48 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-20c7ee8fe6bso47877225ad.2 for ; Mon, 21 Oct 2024 17:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729555902; x=1730160702; 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=F16mOGOCEtDulhf7gkD6+zfYNl/76OFFUvZQ0M86ofc=; b=UGJTP61REZJsfISa6Cxk8Fj8LnGJyGSoAtREALjQXa1J7YV+EFWr9s58Ak5WxTv7IZ f8GlVL+qK4KuGL9U+qG77n87EbJm+XUd2SqrA1wWkOHYxrt+LQHk0AQcrAhpop4vcpVA i+vd5YZeXlVOiug8Atb1OV2m06SN0JubSyZ+AAIeblpLCnLhXUAX1raMacf7H552iobI k+SHdM8UapBb3vrrYv4/y6I1sU0BTRITyLeqTnesFG/r0ctgln+ONWGsIOrwaucmraIC 4a42WpaO2LPzvx8H0N05ofLwzCqVA+55066JDMsvLGXgDUbw0yMZc2oshoqLc7XDxdYa JKIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729555902; x=1730160702; 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=F16mOGOCEtDulhf7gkD6+zfYNl/76OFFUvZQ0M86ofc=; b=Q8qyYFuo3nP8PuXoR2W7GRjx3NekFbh7ziW/2zVHojcAqhTLnv4kwlArNdN2vfaODY 7xSqf2kbNVfbWgimNP0XN+YqwALpHy/IFBrx4qpnTeKhHZ7Wk1SqBTzV25iBN3v4h4TY JKzm2Ot1xQ8q7DJY/Myze/oMzMUGMknu2uqnQoTTMBlY1CuSTfLf0A9p2awRIFVdHOC6 sLghgWZOuzcBfYvTIdERkiYajQfZi9YyxngsFXwCPUeTn5mYHRTAl4pgtQ78xk0rCNa7 O8xviYTUGpTHBxUrcXa7hk6yZ1SUuKgXiKfHU2qwn2U6sjADkF0nqWFsp6KG9/CfOzVp 9Eng== X-Gm-Message-State: AOJu0Yx2br7TpWUgaWMPzmwAHSOjF1vDCeDJMS+Ay7aHE+4FiFbjYB2b yESaLc4ExJ4RwwRDZE/WlEZw76FprXezu/qpp1Sdx0G3KPS4KxzzMcqCjaC67GdDHHJO3X6RWGp 1 X-Received: by 2002:a17:902:da90:b0:20b:951f:6dff with SMTP id d9443c01a7336-20e59aa0261mr193502755ad.0.1729555902376; Mon, 21 Oct 2024 17:11:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 17:11:42 -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 08/14] tcg/riscv: Implement vector neg ops Date: Mon, 21 Oct 2024 17:11:28 -0700 Message-ID: <20241022001134.828724-9-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::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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-8-zhiwei_liu@linux.alibaba.com> Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.h | 2 +- tcg/riscv/tcg-target.c.inc | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h index 94034504b2..ae10381e02 100644 --- a/tcg/riscv/tcg-target.h +++ b/tcg/riscv/tcg-target.h @@ -152,7 +152,7 @@ typedef enum { #define TCG_TARGET_HAS_nor_vec 0 #define TCG_TARGET_HAS_eqv_vec 0 #define TCG_TARGET_HAS_not_vec 1 -#define TCG_TARGET_HAS_neg_vec 0 +#define TCG_TARGET_HAS_neg_vec 1 #define TCG_TARGET_HAS_abs_vec 0 #define TCG_TARGET_HAS_roti_vec 0 #define TCG_TARGET_HAS_rots_vec 0 diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 1893c419c6..ce8d6d0293 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -276,6 +276,7 @@ typedef enum { OPC_VADD_VV = 0x57 | V_OPIVV, OPC_VADD_VI = 0x57 | V_OPIVI, OPC_VSUB_VV = 0x8000057 | V_OPIVV, + OPC_VRSUB_VI = 0xc000057 | V_OPIVI, OPC_VAND_VV = 0x24000057 | V_OPIVV, OPC_VAND_VI = 0x24000057 | V_OPIVI, OPC_VOR_VV = 0x28000057 | V_OPIVV, @@ -2367,6 +2368,10 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, set_vtype_len(s, type); tcg_out_opc_vi(s, OPC_VXOR_VI, a0, a1, -1); break; + case INDEX_op_neg_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vi(s, OPC_VRSUB_VI, a0, a1, 0); + break; case INDEX_op_cmp_vec: tcg_out_cmpsel(s, type, vece, args[3], a0, a1, a2, c2, -1, true, 0, true); @@ -2397,6 +2402,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_or_vec: case INDEX_op_xor_vec: case INDEX_op_not_vec: + case INDEX_op_neg_vec: case INDEX_op_cmp_vec: case INDEX_op_cmpsel_vec: return 1; @@ -2550,6 +2556,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_dupm_vec: case INDEX_op_ld_vec: return C_O1_I1(v, r); + case INDEX_op_neg_vec: case INDEX_op_not_vec: return C_O1_I1(v, v); case INDEX_op_add_vec: