From patchwork Thu Mar 3 20:59:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 547829 Delivered-To: patch@linaro.org Received: by 2002:ac0:f585:0:0:0:0:0 with SMTP id s5csp986191imq; Thu, 3 Mar 2022 13:14:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzM72qGHWX9MKwG+AF91x/keYc8FSPk19u1bIt/fyyioh7hDZlRzZS79VG/DfQKCDnsIvuj X-Received: by 2002:a25:6b4c:0:b0:628:757c:a379 with SMTP id o12-20020a256b4c000000b00628757ca379mr15892589ybm.645.1646342088282; Thu, 03 Mar 2022 13:14:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646342088; cv=none; d=google.com; s=arc-20160816; b=0cdfZgXTvHHL48fKD0JEtSN5AUP3I08R/4YLLwVi+1Jj+GEfXnHpAdp+NSbl67I/4v PzLvnpbtJnIa96OcHwae8lGWJWjTwXhxN7mWRQkSjvEUnlrIJirHeSdrczAWTg2HkriB FaCNxnfd1K1g2owIwo9udvVbndww85nDA8S1Fpij2cja1F9/hdPIXj8xIF+5y6WQhHqz yiMaQ3QKmZnFk4DwuY1SF2rVmXhRwmbceXw7fsS0VVIJlmZfj1t0t4+TYfgt1lB81wko 85mI0DrHsLiXZDxhm12HFUTTpVNmOaceS4XBwZ+oOdHhn9Msjjr9JBm1yxM5C0OWr58U uwmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=QDDlJN6MJVLgjog2f3d7nAGveYgDV1Ef+8NhvEcVhw0=; b=YC1xod2KbqUz5Jjiu2jmA+3HWpMaH/sgKW3n/zAw4hZSG3tpARt0Sj4T0UfiGQ/hRR uDuuNv2C4T7oZfGpp1LHlfws3tvA386nEhffPFeTnJdFn4dVyq8LFNAd4njS9FCudWzx hbrSMe6RweoEe5yhugZLAZaev6SfSX/yn+KDNTyeU6Vt1Zc6MohUTb+HxZjQreztjiVP yEpyo29riG1ran2it3cv/QH520FANIYcX5ABNPVtPTOsAt8Eh/SN2wNGv8YtG0lF5i7d MQcfWSrZHkZdh4uFCwvSnE/BVcQPkS7xG5+BHCOP40pE04r4IxP+sXrKHFF+2k34H4U+ J88g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lZAummEd; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n132-20020a81598a000000b002dc0e26dd0dsi2476752ywb.428.2022.03.03.13.14.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Mar 2022 13:14:48 -0800 (PST) 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=lZAummEd; 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 Received: from localhost ([::1]:39410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPsmd-00019v-Q9 for patch@linaro.org; Thu, 03 Mar 2022 16:14:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPsYW-000642-Ub for qemu-devel@nongnu.org; Thu, 03 Mar 2022 16:00:14 -0500 Received: from [2607:f8b0:4864:20::431] (port=39680 helo=mail-pf1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPsYV-0004IK-FJ for qemu-devel@nongnu.org; Thu, 03 Mar 2022 16:00:12 -0500 Received: by mail-pf1-x431.google.com with SMTP id y11so5797947pfa.6 for ; Thu, 03 Mar 2022 13:00:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QDDlJN6MJVLgjog2f3d7nAGveYgDV1Ef+8NhvEcVhw0=; b=lZAummEdnh+Z7wOIbjqpW/rwV70H/w3ucGyUVo+HyLkATZGqNPP8UkLjf+sz0hZ+y6 jwuObTzX695uToHv5ehrGZ2MtNbaA4nKpJwF0vo1dw+ad09kgNud59NAve6j1hylMH5N FH4r9qAsNbBoiold7MZHvFqVKCdZEFSpWi5w2EKdF036XQ/m3gmQwOtouQoS/9mcR51s 6410YxxaTqG+P3i95z86RzcaQK/zO3Ssto+XEuytUJDCe8CcT/cO86bYBBMG1nI08Oaq HvOrlJaFm7CaxeiEt77v/18FXSwWWQ9D+n7PDpaTxXKJdDRhWjrCFo+CWIZvC/41+3Zo LnAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QDDlJN6MJVLgjog2f3d7nAGveYgDV1Ef+8NhvEcVhw0=; b=HU7zLqfMAE9/j8ILBm1HGmqEtRCtWfX5YxjvoJA3N6qyeuovSv/QR9mw5+qo+4u4W/ ENpAjBek/gKizeeehpK8Lv3/yOs3OgQvQBb1LAXtsKKzBwYgE2Hp1VbNakA1+4apLsju fdsZ8uitZuEy87CEMiJp+eO+p7h3xErrJvIJbzJmO3X5CtbByH/41VIaCHCvALdQc1bQ LcebR6OFtFljpXsPnpJg/rrc0nRchKCglPfZnMfTpYRHltZYLxgNr7gf2Yg5/25epb5f jrRj6U4W/fdCt8z1O0qMX9AvyoDMtNKnT6w55tSBBaGdzmK3cnbVY0rAi3aR9cXUyL9W 95oQ== X-Gm-Message-State: AOAM530ctvrWuSP/qhTUj9Gnw4hfDnc8jydYPDBrX/sLwKakzAAD0gnv MreFBTnDWfT+3MscJ+K5/pGjYyxXG2dHXw== X-Received: by 2002:a63:202:0:b0:37c:4cfc:b89f with SMTP id 2-20020a630202000000b0037c4cfcb89fmr5635880pgc.396.1646341210102; Thu, 03 Mar 2022 13:00:10 -0800 (PST) Received: from localhost.localdomain (2603-800c-1201-c600-119c-490c-a4ee-08e8.res6.spectrum.com. [2603:800c:1201:c600:119c:490c:a4ee:8e8]) by smtp.gmail.com with ESMTPSA id t8-20020a6549c8000000b00372eb3a7fb3sm2729934pgs.92.2022.03.03.13.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 13:00:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 15/30] tcg/i386: Expand vector word rotate as avx512vbmi2 shift-double Date: Thu, 3 Mar 2022 10:59:29 -1000 Message-Id: <20220303205944.469445-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303205944.469445-1-richard.henderson@linaro.org> References: <20220303205944.469445-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::431 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" While there are no specific 16-bit rotate instructions, there are double-word shifts, which can perform the same operation. Tested-by: Alex Bennée Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index a39f890a7d..19cf124456 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -3444,6 +3444,8 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_rotlv_vec: case INDEX_op_rotrv_vec: switch (vece) { + case MO_16: + return have_avx512vbmi2 ? -1 : 0; case MO_32: case MO_64: return have_avx512vl ? 1 : have_avx2 ? -1 : 0; @@ -3588,6 +3590,12 @@ static void expand_vec_rotli(TCGType type, unsigned vece, return; } + if (have_avx512vbmi2) { + vec_gen_4(INDEX_op_x86_vpshldi_vec, type, vece, + tcgv_vec_arg(v0), tcgv_vec_arg(v1), tcgv_vec_arg(v1), imm); + return; + } + t = tcg_temp_new_vec(type); tcg_gen_shli_vec(vece, t, v1, imm); tcg_gen_shri_vec(vece, v0, v1, (8 << vece) - imm); @@ -3618,8 +3626,16 @@ static void expand_vec_rotls(TCGType type, unsigned vece, static void expand_vec_rotv(TCGType type, unsigned vece, TCGv_vec v0, TCGv_vec v1, TCGv_vec sh, bool right) { - TCGv_vec t = tcg_temp_new_vec(type); + TCGv_vec t; + if (have_avx512vbmi2) { + vec_gen_4(right ? INDEX_op_x86_vpshrdv_vec : INDEX_op_x86_vpshldv_vec, + type, vece, tcgv_vec_arg(v0), tcgv_vec_arg(v1), + tcgv_vec_arg(v1), tcgv_vec_arg(sh)); + return; + } + + t = tcg_temp_new_vec(type); tcg_gen_dupi_vec(vece, t, 8 << vece); tcg_gen_sub_vec(vece, t, t, sh); if (right) {