From patchwork Sun Sep 22 12:00:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 830133 Delivered-To: patch@linaro.org Received: by 2002:adf:ebcc:0:b0:367:895a:4699 with SMTP id v12csp1554604wrn; Sun, 22 Sep 2024 05:06:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV9/bwX3V/M1xLCMTOBpzy3VkvBbStpGOWFG+VKogYO41tJvfsiK1uDzCFVs5r7tG0dd6nH6A==@linaro.org X-Google-Smtp-Source: AGHT+IGXfYj8Vp6r74hR6Z15d89R86dZHCf63EMHvUCwjUW7V0YgXxF6HG0qRli+P/xS32MMvN3D X-Received: by 2002:a05:620a:3908:b0:7a9:be1b:7a41 with SMTP id af79cd13be357-7acb7d60e70mr1456284885a.4.1727006786822; Sun, 22 Sep 2024 05:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727006786; cv=none; d=google.com; s=arc-20240605; b=WlKA01izsawZUJjc4PxhatUyvERYrcoB9Io5j0URTmQPPIF1U0L9qAlrcQ3lioXqjV gkbu5RXqHnqGPMYUT7DT9IcHMrrAZXIXveqzJQzJXjA/fP9s4V9OQiwsKpPjCzPElTd7 11F+f17eN0c23U9E2FJf3UzxxGfhciKKOgBRG+7Qc4xRO8GrLdd7IcTY67yfku0df/dJ bOnqTR9MC7q7YEO+W4BSPAm4GT+mcF2GgePGDSf55Jp3BEk3ynjY0M7Sa79SmNx4ZM5M F24NViq4Em3cKM1uPjafrfmDx/3FO6jPyR7cTRO/YMZfCbgPPd+dRvVwWkJKN2tvIw/8 6xew== 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=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=b+EZGpLhZBBWjv1uWPtYMEpr6Tls9vHQPDdu/9NVqvS0AqEnm3vmeh+XDPtiN0W2dI d1UkywzobfTBGShuiTk9NE56DcY9LUEAuOQS1+pbIVgZORvFYVN4pEKe2QgXyhoWIBs7 scRgWiZlPmW4p56rbZdKsxXsbrDdf253UC53bal7/jDyTDwsfcVbz9VdBJbxYhoSxVzJ wriXN/xwRM0gcQcMx5L+3SyqpVJp8LRZnjSz0gYK17TKotgL+lEh7FtAJllQ1wWA8Fcp 6FJYflPb54DBrYC+iKk9mGSFOzbPoC5mX3hTaeAbAk9VSJBYQmkpEFvGUP30z2mQy/qh 9pkQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MP4NSeIy; 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-7acb07f8106si829212285a.139.2024.09.22.05.06.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Sep 2024 05:06:26 -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=MP4NSeIy; 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 1ssLHh-0001ld-CU; Sun, 22 Sep 2024 08:01:49 -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 1ssLHP-0000x3-SW for qemu-devel@nongnu.org; Sun, 22 Sep 2024 08:01:37 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ssLHJ-0002OE-A5 for qemu-devel@nongnu.org; Sun, 22 Sep 2024 08:01:28 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-374c4c6cb29so3366370f8f.3 for ; Sun, 22 Sep 2024 05:01:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727006483; x=1727611283; 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=MP4NSeIyjYva+V6FtEDCSRoJ1qPDZ9Jpd0muitCpiI04CpYZW+LbEuarELScOJh+fD j5vXyCpHyJiEXlZx7BevkP7miu7/1kc82Jo2uNc+WEqUHEfVD1n5Dq/T9AufLy7TXwHm pqD2xcZ7iytFmQ+HI20X6SgD4ZjINh5j7FEOrT3LnAXmtKSgF5tZmyRhjz+P4c9kjqlv ISI7EAlQjtig0kbxLKEvHLQXgeCb3O7MzPPOP4XmTSvs0SiT61x7zhcRMORxVSaJRYmH otTaUEPf2f/oL8tS2Vh0CkIdNi/3Y0i2qtYUIytZxa39fGmWYkXcy10bAbQ0jM+6Og+k zuCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727006483; x=1727611283; 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=rGwiXq+dyUtnmkr6FJrTcxK9GK49zARbiC1V2AYjFJE8ZS9PzEk7ci5l+afaCRAJHu 5vnR7yK+HX6gFgc5aBDSVF7o5oF8ykbnYe8L6HbFxxnyvzjEV0UFYiH4WIKdusk7IQH2 v3EL5374D2Kk+KkZlwxbVnExk8467mkKcwHdZsJojeJpJ/Og8Tlc0bJDEFVs3uhvurbW IXZmkfzl6p2Z9DYjODMXeQwz16u+fuOIVVKxUQANzUkAfBswvHer96bvMA7IqnBYoysw 5859iOab36LpCiykzPnGv6ZPUITUN69LvAgAczqeEPpXtftAJ8SWGy5Xs1XNjII8c/UL l5Hw== X-Gm-Message-State: AOJu0YzB3TmmNfYX+80nN1XXorQ7MJM38O1DcR4aZVy+kmwDNIgPUGRY UYcxp6x8hMtisZlgHnQTPXgV7To1q0tX0yLWXSXCU66ChTvKUdf5XnYEK+BvmkuZF2peWzwko2D GX9o= X-Received: by 2002:a5d:45c3:0:b0:374:c318:2190 with SMTP id ffacd0b85a97d-37a424b019bmr6903800f8f.59.1727006483351; Sun, 22 Sep 2024 05:01:23 -0700 (PDT) Received: from stoup.. (90-181-218-29.rco.o2.cz. [90.181.218.29]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612df525sm1067909966b.159.2024.09.22.05.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 05:01:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PULL 16/31] tcg/i386: Implement cmpsel_vec with avx512 insns Date: Sun, 22 Sep 2024 14:00:57 +0200 Message-ID: <20240922120112.5067-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240922120112.5067-1-richard.henderson@linaro.org> References: <20240922120112.5067-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42c.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<