From patchwork Wed Sep 11 16:50:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 827466 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp891700wrc; Wed, 11 Sep 2024 09:53:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW0WJJGTf7Rvk6sJrB4k1Ft7nOB2gi3fRaqKWk9YJ+uGOxVnwD2tYj8cvwIKDtw6XBVr2Ohfw==@linaro.org X-Google-Smtp-Source: AGHT+IG5/2xTuj2IKXSRsFS0rx0c/V3w6c/9bo9XC8vgt1poGINyx/H7IhdlgDMaf5/Y51ToPSwh X-Received: by 2002:a05:6358:496:b0:1b8:3242:3286 with SMTP id e5c5f4694b2df-1bb14e0a298mr26747855d.12.1726073595032; Wed, 11 Sep 2024 09:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726073595; cv=none; d=google.com; s=arc-20240605; b=Dq1YYAZYs8hw1nUq0hB0vUvl9ZOJtoLa1P4iYVKKGtiPQilBvy5g5s3JdpT9jEy82+ crOjmjIbWJjxnkHRax5IWM9pKsNt+qndUnaRhOcdjvTo4oSVT1dnuGZ4ukPsYvRelHse +m3ZksoJjMn1Qar5736IAsBlTAKHMPbKNGDMvfDjllLcGFHs5FBIgP0panBbjkdyNkK0 PYE+ErB9g3fNFQINwilctuTB+wVk1AxBeyRNdt7h1mO4rgdRzyqXxII9jyMNHs78/ANb p5ebsGCHYCUZP3n+eXYmM1hu8JLWFZ/o/DTHvSqgv017poG5zeE3SAK9w49vJ6jO1xLu CaBw== 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=zmsViYQuZcRw3+Xw3xnkrlUzHZT6vqkjOcHzmQVj1eI=; fh=gW8xxqNJ+GKzLr7OBpcms3Apqae8iNJSKgK4r5swIT4=; b=gO8Maa6wKpBwcVUhAjOF6jxYAK71aWTBDDPsnCBIGESFvI09x5S0grEo3Syz7IKYp1 Ru3IhSSIIiWzI8kxqcHQGSovoGMvqiU2/m6jCSQBNs8+xtIu49Sq0WImpGc/N22CtGy/ GF51cv6E6znXEvtsSwAS2ETOBfA95Ejr5i7liWUPGI6rRqbtvB1thrmxU1If/ALod/2R SeC2Y6XJRasDyuuIiCCb36quHqVDE5zuyp++uNN2M/ir/PDqtZV+CDfoe8NevhIJMc6D uqVLJQQsX7YOwqqkZBdtasLmkQylk6z8jpuWmQBKD31oHL2xZ9+Qm1Wyp94U6edAuCgx RT2Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K+6c07qM; 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 af79cd13be357-7a9a79ee79bsi1106616385a.172.2024.09.11.09.53.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2024 09:53:14 -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=K+6c07qM; 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 1soQYn-00032K-9x; Wed, 11 Sep 2024 12:51: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 1soQYa-0002Uw-PA for qemu-devel@nongnu.org; Wed, 11 Sep 2024 12:51:04 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1soQYY-0003gY-V2 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 12:51:04 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-71790ed8c2dso6096634b3a.3 for ; Wed, 11 Sep 2024 09:51:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726073461; x=1726678261; 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=zmsViYQuZcRw3+Xw3xnkrlUzHZT6vqkjOcHzmQVj1eI=; b=K+6c07qMAeWsb/aUfoN1xs232iauJXkiIzfL7sNkj1x4SSkgL9MPmcSwaZJQuQLu3u hFrCvq2vnrYJBtdrVmMrnque1d0mfgOL7DgS36rkPt94av9xFvlBi4TOmMb8frqOGQiI IY3vysIIJWcmgtskbIDCTpmmFfPt7ilpCuOlFld9I5N1U48RvlqrdwDkoxbQTsEAWFoS ymMXAxmTsxnuyzM72VdTpeAunSwpaa/99HNw5iwTaAqp8yrjWYsQ+NIdvpCzoeB2Coui ZgE14P0K/cHb83LY8LMybAgvjsburHUMkHiYjVGYq8AbKHs8Osvw8SutjvGUiWc+/YU8 dsDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726073461; x=1726678261; 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=zmsViYQuZcRw3+Xw3xnkrlUzHZT6vqkjOcHzmQVj1eI=; b=fP0QBsBoqodmLJYQkFbhkboP2WoSfuu67V2o7t0KrLMSs/OdZbhuP7oKcCLnoW4sxL iHP7iGqPV832bkoGSEyLfI2/QIdWXQnI9FIHnkh9rcHKxLi0ipngqlOt4qvqxS6ZFH36 j1yXMj7GLYPDbQvJSoBPfx7TT8m389bdn8A8GcGPDWiEIaJrPR775LtybhTw7U1P9UIR Sy57tXhDO3T+EN1cNIx0yDP4ecin6HhJeW1ybMn1gM7tqvEvm8vy7kOCtBFBms3FJYbg EQ9D8mrDF1r2NTWktVCYNkzI94clrLX2pVSizQZRZK5Lbn5GyukRfqrTO+XoIVg6zoj0 0K+g== X-Gm-Message-State: AOJu0YzNfrJBz18Qjm3cvpsX5Lju/rmUj+TNHbrBcYTk+b7DeLX6K1oq o7evtUX0uslrgnszBp0MdsvUpXLicJjzTqm6CT1WHJg0PBEP5mZdGRunr16Hb6CHn5G0VCueZn8 V X-Received: by 2002:a05:6a00:218f:b0:70d:2892:402b with SMTP id d2e1a72fcca58-7192608123fmr18890b3a.7.1726073461551; Wed, 11 Sep 2024 09:51:01 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71908fe4e7esm3186947b3a.80.2024.09.11.09.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 09:51:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: zhiwei_liu@linux.alibaba.com, tangtiancheng.ttc@alibaba-inc.com, philmd@linaro.org Subject: [PATCH v2 13/18] tcg/i386: Implement cmpsel_vec with avx512 insns Date: Wed, 11 Sep 2024 09:50:42 -0700 Message-ID: <20240911165047.1035764-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911165047.1035764-1-richard.henderson@linaro.org> References: <20240911165047.1035764-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 The avx512 vpblendm* instructions exactly implement cmpsel, using a predicate input. Of course this matches nicely with the avx512 predicate comparison instructions. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 44 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index f94a2a2385..d473dc7a5e 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -413,6 +413,10 @@ static bool tcg_target_const_match(int64_t val, int ct, #define OPC_UD2 (0x0b | P_EXT) #define OPC_VPBLENDD (0x02 | P_EXT3A | P_DATA16) #define OPC_VPBLENDVB (0x4c | P_EXT3A | P_DATA16) +#define OPC_VPBLENDMB (0x66 | P_EXT38 | P_DATA16 | P_EVEX) +#define OPC_VPBLENDMW (0x66 | P_EXT38 | P_DATA16 | P_VEXW | P_EVEX) +#define OPC_VPBLENDMD (0x64 | P_EXT38 | P_DATA16 | P_EVEX) +#define OPC_VPBLENDMQ (0x64 | P_EXT38 | P_DATA16 | P_VEXW | P_EVEX) #define OPC_VPCMPB (0x3f | P_EXT3A | P_DATA16 | P_EVEX) #define OPC_VPCMPUB (0x3e | P_EXT3A | P_DATA16 | P_EVEX) #define OPC_VPCMPW (0x3f | P_EXT3A | P_DATA16 | P_VEXW | P_EVEX) @@ -738,6 +742,16 @@ static void tcg_out_vex_modrm_type(TCGContext *s, int opc, tcg_out_vex_modrm(s, opc, r, v, rm); } +static void tcg_out_evex_modrm_type(TCGContext *s, int opc, int r, int v, + int rm, int aaa, bool z, TCGType type) +{ + if (type == TCG_TYPE_V256) { + opc |= P_VEXL; + } + tcg_out_evex_opc(s, opc, r, v, rm, 0, aaa, z); + tcg_out8(s, 0xc0 | (LOWREGMASK(r) << 3) | LOWREGMASK(rm)); +} + /* Output an opcode with a full "rm + (index<