From patchwork Thu Mar 3 20:59:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 547831 Delivered-To: patch@linaro.org Received: by 2002:ac0:f585:0:0:0:0:0 with SMTP id s5csp987153imq; Thu, 3 Mar 2022 13:16:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgp1mfkHDKjaFtGFJI0SVreQu27EOg6viXGRqv+s09NoWOotxh5mf75esPjWcG92pbSWea X-Received: by 2002:a25:c241:0:b0:61d:8fd1:2954 with SMTP id s62-20020a25c241000000b0061d8fd12954mr35923428ybf.584.1646342170346; Thu, 03 Mar 2022 13:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646342170; cv=none; d=google.com; s=arc-20160816; b=B2fUVEcdnkeZ2KOSlzrL8C71SOkSVadvkhRpgJHV+zA5OLLY1bc06wgykZgiCJrMy8 qgBzLGCYu85grUsj//xxwyTBvldAVzgD/fjT2ng+qEX0QR6/fQcxaoPTsAUNJVuR63h3 SRX+HwkcWiiezqN9e5w2zr4DkrSoqDdJxauv3B1v1uWY+22AzwwiOODmPpx5Qye0xFPO 43apzWR5fV+psjFb1bSS599JcN5j3oaweW0POXC1P4HeHFjiRpz/PHfNQR6UA7CjqW4y ehXph6Y4tnAQc9C9zuP4tHm8dCy1OYUxB+ty+G6YabLWxit4vdV84wX2aihKs7LEkyZN 9SqA== 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=GxqbaeGaqhtNNI3GWh/zd5zM1ofbIy5Pq91AeE2m2ho=; b=j1o+Jym5GzB4B2IdBkzETuZRGWEXNdJSzKjQBTm+0l76Dpc2FcI2WolZTmd2+NzvAo SaqZsswpCkLXtXKEZHWK6+qZd7DTh74K80x8GG/1cjmdRpqnjjw1OuhipbK7tkUtFP0K gPHhqn18H6QaEHMzxVw43xXvd11jCk5+667jppKysbdbxvXjIG89079FoxUKQ1tZPv04 fg3EDchbpanli7XRxY8gDD1jFHjyAcoo9XggN2xFCu1z/lh1STEsUoaPsDuF6AOxYdSh WxXW6onRO2g0FpzvtRW0fch4nVk5rFElmOfaGuDiinbop1/vl7h6upmdFFbTZg55MlWp XEcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fjOajX71; 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 e2-20020a5b0042000000b00628dc7c62f2si686733ybp.342.2022.03.03.13.16.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Mar 2022 13:16:10 -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=fjOajX71; 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]:42320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPsnx-00035R-Ro for patch@linaro.org; Thu, 03 Mar 2022 16:16:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPsYV-00063b-QV for qemu-devel@nongnu.org; Thu, 03 Mar 2022 16:00:14 -0500 Received: from [2607:f8b0:4864:20::1029] (port=36400 helo=mail-pj1-x1029.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPsYT-0004I0-VG for qemu-devel@nongnu.org; Thu, 03 Mar 2022 16:00:11 -0500 Received: by mail-pj1-x1029.google.com with SMTP id g7-20020a17090a708700b001bb78857ccdso8903341pjk.1 for ; Thu, 03 Mar 2022 13:00:09 -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=GxqbaeGaqhtNNI3GWh/zd5zM1ofbIy5Pq91AeE2m2ho=; b=fjOajX71PR2ShO7W4/DTEvLAcGAR7K20ltudoHLPQ9YWBeYaj/B0AszLpu2EYmvQ9n OdFDvv4hqALSdXVaGr4apmOcb+jZDFZZ+c5sPQ8A+2ADNp+GziaK2oJze9LtQraBXyOz ieR2EggunVga2pm/BnH8yS+pW4T3mJ0vHZ6KA2TO6SHIYGK02F8KnqYVeaXj6Y/x93Xw fA9CH8nRpVonjW9ikFlWrguBDu7qga7z0vJLPBfhw09B7Ad/ExpPIrbU2xntArZtUFAr 0EpaX4h6A1kaK7uUZc0ikDCbYs//8s6/kSsEOdjOrse4rClcou+830WGpxBN86/rOC8f SvfQ== 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=GxqbaeGaqhtNNI3GWh/zd5zM1ofbIy5Pq91AeE2m2ho=; b=7H9fydruaMuM8SR9F1u7aMl7ZyI+C7BMZHM+cR0lDUjn0AlOabbqbyJbUI8JaYjRHH 5em5sVPfqkA3fqQW9N/G2E77zc8NlL2UWGQSNIohQAHi1BLkSW+CfqYMbMGALkJu6hqE hDZxAUgzL5m3mVYqj9U0VlryqbZ16nbXoQgdyKMtxtZ2McO2L/5Zc7J005EZmQsKKsOF UpSXs+MqgWZMRUzKFQjqiTKW5ak2BWjFuhg/BDEvutp493AABsHy28LmF2wwTIE4xhUZ +Oa/Xkr5DVKtrCIiJQu26iUc+Dqt4bPl5FyXE1xOTHxlsNk3jftqhOCUbvaNnMNBvk66 W+VA== X-Gm-Message-State: AOAM530ubvAgSuwnhocq5D2AW10BZbqn/WXuipVMQMJw4atAGPPJaIaq OEJx8+mVRtdbqLZCBn2cCgA53/r2pI30vw== X-Received: by 2002:a17:90b:4f8f:b0:1bf:ac1:2016 with SMTP id qe15-20020a17090b4f8f00b001bf0ac12016mr6153283pjb.21.1646341208672; Thu, 03 Mar 2022 13:00:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 13:00:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 14/30] tcg/i386: Support avx512vbmi2 vector shift-double instructions Date: Thu, 3 Mar 2022 10:59:28 -1000 Message-Id: <20220303205944.469445-15-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::1029 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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" We will use VPSHLD, VPSHLDV and VPSHRDV for 16-bit rotates. Tested-by: Alex Bennée Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/i386/tcg-target-con-set.h | 1 + tcg/i386/tcg-target.opc.h | 3 +++ tcg/i386/tcg-target.c.inc | 38 +++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/tcg/i386/tcg-target-con-set.h b/tcg/i386/tcg-target-con-set.h index 78774d1005..91ceb0e1da 100644 --- a/tcg/i386/tcg-target-con-set.h +++ b/tcg/i386/tcg-target-con-set.h @@ -45,6 +45,7 @@ C_O1_I2(r, r, rI) C_O1_I2(x, x, x) C_N1_I2(r, r, r) C_N1_I2(r, r, rW) +C_O1_I3(x, 0, x, x) C_O1_I3(x, x, x, x) C_O1_I4(r, r, re, r, 0) C_O1_I4(r, r, r, ri, ri) diff --git a/tcg/i386/tcg-target.opc.h b/tcg/i386/tcg-target.opc.h index 1312941800..b5f403e35e 100644 --- a/tcg/i386/tcg-target.opc.h +++ b/tcg/i386/tcg-target.opc.h @@ -33,3 +33,6 @@ DEF(x86_psrldq_vec, 1, 1, 1, IMPLVEC) DEF(x86_vperm2i128_vec, 1, 2, 1, IMPLVEC) DEF(x86_punpckl_vec, 1, 2, 0, IMPLVEC) DEF(x86_punpckh_vec, 1, 2, 0, IMPLVEC) +DEF(x86_vpshldi_vec, 1, 2, 1, IMPLVEC) +DEF(x86_vpshldv_vec, 1, 3, 0, IMPLVEC) +DEF(x86_vpshrdv_vec, 1, 3, 0, IMPLVEC) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 712ae3a168..a39f890a7d 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -424,6 +424,15 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) #define OPC_VPROLVQ (0x15 | P_EXT38 | P_DATA16 | P_VEXW | P_EVEX) #define OPC_VPRORVD (0x14 | P_EXT38 | P_DATA16 | P_EVEX) #define OPC_VPRORVQ (0x14 | P_EXT38 | P_DATA16 | P_VEXW | P_EVEX) +#define OPC_VPSHLDW (0x70 | P_EXT3A | P_DATA16 | P_VEXW | P_EVEX) +#define OPC_VPSHLDD (0x71 | P_EXT3A | P_DATA16 | P_EVEX) +#define OPC_VPSHLDQ (0x71 | P_EXT3A | P_DATA16 | P_VEXW | P_EVEX) +#define OPC_VPSHLDVW (0x70 | P_EXT38 | P_DATA16 | P_VEXW | P_EVEX) +#define OPC_VPSHLDVD (0x71 | P_EXT38 | P_DATA16 | P_EVEX) +#define OPC_VPSHLDVQ (0x71 | P_EXT38 | P_DATA16 | P_VEXW | P_EVEX) +#define OPC_VPSHRDVW (0x72 | P_EXT38 | P_DATA16 | P_VEXW | P_EVEX) +#define OPC_VPSHRDVD (0x73 | P_EXT38 | P_DATA16 | P_EVEX) +#define OPC_VPSHRDVQ (0x73 | P_EXT38 | P_DATA16 | P_VEXW | P_EVEX) #define OPC_VPSLLVW (0x12 | P_EXT38 | P_DATA16 | P_VEXW | P_EVEX) #define OPC_VPSLLVD (0x47 | P_EXT38 | P_DATA16) #define OPC_VPSLLVQ (0x47 | P_EXT38 | P_DATA16 | P_VEXW) @@ -2867,6 +2876,15 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, static int const sars_insn[4] = { OPC_UD2, OPC_PSRAW, OPC_PSRAD, OPC_VPSRAQ }; + static int const vpshldi_insn[4] = { + OPC_UD2, OPC_VPSHLDW, OPC_VPSHLDD, OPC_VPSHLDQ + }; + static int const vpshldv_insn[4] = { + OPC_UD2, OPC_VPSHLDVW, OPC_VPSHLDVD, OPC_VPSHLDVQ + }; + static int const vpshrdv_insn[4] = { + OPC_UD2, OPC_VPSHRDVW, OPC_VPSHRDVD, OPC_VPSHRDVQ + }; static int const abs_insn[4] = { /* TODO: AVX512 adds support for MO_64. */ OPC_PABSB, OPC_PABSW, OPC_PABSD, OPC_UD2 @@ -2959,6 +2977,16 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_x86_packus_vec: insn = packus_insn[vece]; goto gen_simd; + case INDEX_op_x86_vpshldv_vec: + insn = vpshldv_insn[vece]; + a1 = a2; + a2 = args[3]; + goto gen_simd; + case INDEX_op_x86_vpshrdv_vec: + insn = vpshrdv_insn[vece]; + a1 = a2; + a2 = args[3]; + goto gen_simd; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_dup2_vec: /* First merge the two 32-bit inputs to a single 64-bit element. */ @@ -3061,7 +3089,12 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, insn = OPC_VPERM2I128; sub = args[3]; goto gen_simd_imm8; + case INDEX_op_x86_vpshldi_vec: + insn = vpshldi_insn[vece]; + sub = args[3]; + goto gen_simd_imm8; gen_simd_imm8: + tcg_debug_assert(insn != OPC_UD2); if (type == TCG_TYPE_V256) { insn |= P_VEXL; } @@ -3305,6 +3338,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_x86_vperm2i128_vec: case INDEX_op_x86_punpckl_vec: case INDEX_op_x86_punpckh_vec: + case INDEX_op_x86_vpshldi_vec: #if TCG_TARGET_REG_BITS == 32 case INDEX_op_dup2_vec: #endif @@ -3319,6 +3353,10 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_x86_psrldq_vec: return C_O1_I1(x, x); + case INDEX_op_x86_vpshldv_vec: + case INDEX_op_x86_vpshrdv_vec: + return C_O1_I3(x, 0, x, x); + case INDEX_op_x86_vpblendvb_vec: return C_O1_I3(x, x, x, x);