From patchwork Tue Oct 22 00:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 837531 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c9:0:b0:37d:45d0:187 with SMTP id f9csp2288161wrt; Mon, 21 Oct 2024 17:14:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXGQZQ9ccOZWOm2YNsw0fbIjN7O41+V12ZrUc6hqgzrTDIzO+R2IgE69ptkk/XLFBz8yr0Aog==@linaro.org X-Google-Smtp-Source: AGHT+IEADNut/5CpnpySB+F3RTTsYvDuNxR99EdSqZbzjHN0qIyt9Sbo4KwHe8DYz8S6hpxNJCWw X-Received: by 2002:a05:6902:1029:b0:e28:f054:a2bc with SMTP id 3f1490d57ef6-e2bb11de592mr12657037276.8.1729556074944; Mon, 21 Oct 2024 17:14:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729556074; cv=none; d=google.com; s=arc-20240605; b=ANuHYjB466upfWTjspGrRghO/WF4Y40QQJwi7psMXw/jCP7tWgpbNe6/9cI11UNHc5 kkEd+BF0SgTPczByk98tITwKQmXxohY+gUkxZ/SWP+lF7i7NBNJV3wAiuWGO6YfiDs7+ zfSUGRKkfq0HNqtcqIlHlWav2zO/2DV+fbAr2UE6V87+BNPsX+gXZ14zSIhdiGM4aovm 5xNkw5afB7R9dxHRgJMRPh6dRYYjgMJgYqmiFGdmvzyKy5edJhc7YKLJuPgpDSwG/cfS oJSsaKCwC1yCA65c7t0A2nuj8guyy/fKdXmnJJpnpB6B6ukF0di+sxaxp8Olh713YdNw LgzA== 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=C2l5tEjtrAAJ1z36wG6T8MRNWs0qyEl5t+tOFHscABs=; fh=NcoVC7uASE005078E1lCBep8eFF9gWSTNDssD7Ljns8=; b=J+j+g7pX+VQN4Wj+OLc9T5eZfjY1SkWBnfuY/jYtO0rGKRgsZ84X37jhCPXpBQNa1X 8ftQc3TdKJsFFoTAplxBsMuTu26tijmdO/1K+o0uJzJ83pCCC2w7rQRfPQSwRvRtf8aJ Cd92TQkS7yKHcCmH+StelZJd+4G71VYPMRGF/W1uYAmsAsqd0Yb1kwUTRF8Z2F0Ptp0G qxcJpNw8jxdA/nwkd4FMAFfBJQGb/0ZCF2SfecEjmG3GLcT3U/WhdF7TWgHl5xjao2MQ QEndnOFmcYu0StU2DIDABI8TQXB5hp6ve873c0HPccVra7Y/323CSs0XwXosC/XvGOX5 jE/g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TLo4tzaC; 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-460e1c6993csi43751261cf.496.2024.10.21.17.14.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Oct 2024 17:14:34 -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=TLo4tzaC; 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 1t32VW-0000FF-0F; Mon, 21 Oct 2024 20:12:18 -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-00005S-Bx for qemu-devel@nongnu.org; Mon, 21 Oct 2024 20:11:49 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t32V0-0005Vb-Eg for qemu-devel@nongnu.org; Mon, 21 Oct 2024 20:11:49 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-20cf6eea3c0so39689585ad.0 for ; Mon, 21 Oct 2024 17:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729555904; x=1730160704; 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=C2l5tEjtrAAJ1z36wG6T8MRNWs0qyEl5t+tOFHscABs=; b=TLo4tzaCU1k12EdR9xC5xT2PQ/hd90hI2rJ9ZlIWdDOLEjY04CyYHDEa651jLgA9Pq NEneW52QYLSPWJxguORVs1IUb3jh4CoQsXHzIQg/PRpB/6m7Hqas0C1rC/aHALjdZD/c U87csFy3U5xliFt/oHQf2TweYDsgox2SH+DUOQcnaBIQU99DpbqiQ8w5kJgdGwOojOhm hnihz69tcCEFFE9+3Sb2NxLdCUvl144gQ6HCsbmVjcEMmoHkqAtDVNEBshrkO8VgKhUH u7foenvrddSmX+M9Ul+1+9kgZJNy8jtYgA6KU3xVVuol/pNIhVOU9PPkqoFqY6avyL/k IpCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729555904; x=1730160704; 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=C2l5tEjtrAAJ1z36wG6T8MRNWs0qyEl5t+tOFHscABs=; b=J/K5FPck412uHAehYAqF12rXPvXwqcAHu8cfXuCO8wpHDYmwx9+Z2yywshD9Ny2U05 yUHw3emi2cNR/MQvK2b/ydapfKOrsmw5zmag4Uun2Z5LNLxoEg/l1FMSysw+IRIJu+t3 alwdRkjSt2sN4cU0a4J5otB9aZS+AUyk/5yo55PXVlFLXABXb7cJdF48rt91wvd4Iv1J 6GbU5Qn4v4tfCFJSPef/yQ+D5rN3cnRMNiUVZxR1dQCoU+um2eXHA0zY4RjDn4p440hQ WWUzH1ByvXMe7VUCSRd2TzAIVCvZw/abvKwxAwUUqLO7fb9CUJ0dP+jNZl7eXMaUAFuO RL+g== X-Gm-Message-State: AOJu0YxzKHswAvRN/blSSMII9qzPUJvVdtY/Jk9WrHAVLE9K1Cf5DXup 5YYWT9JWzRsbxX7UX4OENfxXWwhRdLTEQP9uRtA/or++uGX6sX+B6U6fUFo5NsDZ4esYbjCkGhU E X-Received: by 2002:a17:903:1104:b0:20b:c1e4:2d6c with SMTP id d9443c01a7336-20e5a943ad0mr151179705ad.57.1729555904414; Mon, 21 Oct 2024 17:11:44 -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:44 -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 11/14] tcg/riscv: Implement vector min/max ops Date: Mon, 21 Oct 2024 17:11:31 -0700 Message-ID: <20241022001134.828724-12-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::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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: TANG Tiancheng Signed-off-by: TANG Tiancheng Reviewed-by: Liu Zhiwei Reviewed-by: Richard Henderson Message-ID: <20241007025700.47259-10-zhiwei_liu@linux.alibaba.com> Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.h | 2 +- tcg/riscv/tcg-target.c.inc | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h index 1d4d8878ce..7005099810 100644 --- a/tcg/riscv/tcg-target.h +++ b/tcg/riscv/tcg-target.h @@ -162,7 +162,7 @@ typedef enum { #define TCG_TARGET_HAS_shv_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_minmax_vec 1 #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 4758555565..35b244b7a2 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -294,6 +294,15 @@ typedef enum { OPC_VSSUBU_VV = 0x88000057 | V_OPIVV, OPC_VSSUBU_VI = 0x88000057 | V_OPIVI, + OPC_VMAX_VV = 0x1c000057 | V_OPIVV, + OPC_VMAX_VI = 0x1c000057 | V_OPIVI, + OPC_VMAXU_VV = 0x18000057 | V_OPIVV, + OPC_VMAXU_VI = 0x18000057 | V_OPIVI, + OPC_VMIN_VV = 0x14000057 | V_OPIVV, + OPC_VMIN_VI = 0x14000057 | V_OPIVI, + OPC_VMINU_VV = 0x10000057 | V_OPIVV, + OPC_VMINU_VI = 0x10000057 | V_OPIVI, + OPC_VMSEQ_VV = 0x60000057 | V_OPIVV, OPC_VMSEQ_VI = 0x60000057 | V_OPIVI, OPC_VMSEQ_VX = 0x60000057 | V_OPIVX, @@ -2406,6 +2415,22 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, 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_smax_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vv_vi(s, OPC_VMAX_VV, OPC_VMAX_VI, a0, a1, a2, c2); + break; + case INDEX_op_smin_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vv_vi(s, OPC_VMIN_VV, OPC_VMIN_VI, a0, a1, a2, c2); + break; + case INDEX_op_umax_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vv_vi(s, OPC_VMAXU_VV, OPC_VMAXU_VI, a0, a1, a2, c2); + break; + case INDEX_op_umin_vec: + set_vtype_len_sew(s, type, vece); + tcg_out_opc_vv_vi(s, OPC_VMINU_VV, OPC_VMINU_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); @@ -2442,6 +2467,10 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_sssub_vec: case INDEX_op_usadd_vec: case INDEX_op_ussub_vec: + case INDEX_op_smax_vec: + case INDEX_op_smin_vec: + case INDEX_op_umax_vec: + case INDEX_op_umin_vec: case INDEX_op_cmp_vec: case INDEX_op_cmpsel_vec: return 1; @@ -2606,6 +2635,10 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_sssub_vec: case INDEX_op_usadd_vec: case INDEX_op_ussub_vec: + case INDEX_op_smax_vec: + case INDEX_op_smin_vec: + case INDEX_op_umax_vec: + case INDEX_op_umin_vec: return C_O1_I2(v, v, vK); case INDEX_op_sub_vec: return C_O1_I2(v, vK, v);