From patchwork Sat Dec 18 19:42:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 525502 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp2727051imb; Sat, 18 Dec 2021 11:56:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2CdbpwuA+dSozyfVFgeibA9Z3kHwAFzUm3FEijjtSdjYZbZRWjJYMvNfa5Dv9siQ5/ZhX X-Received: by 2002:a25:4c8:: with SMTP id 191mr12591514ybe.357.1639857400375; Sat, 18 Dec 2021 11:56:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639857400; cv=none; d=google.com; s=arc-20160816; b=yKByqkzNRZAjQYpxwdRQm1WJB7LO3xVt/xiFPv6GTQxzr/z9N3MYzrL93vTkykzvoL nYO0deYa/OSnkJYgHGDNeNVBLW67o6MclHmg88PCPNGrt/cmRSxCLI/w8j0s7R38RRIS 3fGuBLKCXjmjKoesUoVCWnUgJ2NicI7y43QCMF6Xqu+HdrYF9kU5LWgLsHelIGh49VQp 4CIDEp90J84gA8f4XYBExhTBa93tsuDvJfotOC8MlDtojbhCgNWQrka/gm1kIR4yAfIG tAxRUUQLcQWI+0/TUlGMAR5MFs+4s6L0USSMDvKNP2uY5iaU1NA4ALruBvUJykt3xujr JYhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:to:from :dkim-signature; bh=XHyeOii0ZhnExA6vwEVQHkpV1I3AvOoVnhEEyh3pzMc=; b=AKVbv3nSxl0l8xl5JFCbUjsZlrUEffd9MVp0Orgi38kWJTT3TTYVNyLH/Y/T/m8Z+w XlHqTXTv0+wDiR+N9CPv5sgfoRqXiNROUB3zppVDcpSidWYa07c2udUffGHswY8zLwFS DcLcq88fPvBfvWJhfCeoS7HEzouJoN7EVxMxCjhJnNL6KcGniK8VcgML7foB/RvzIJd9 67Dhkdqw0TjEbAEWCx5R5IqQgKmvFzlYeEb6Zf49vKV+EPphAM4lCgRVT85T38ZRd/zm QcGuXgBU3JP7EfvcUzFcOmjuuCEMkFCTuvhkacgFcd7ZdoSYEz0xjc+BHu+gbF66VCXo C3JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gxIqnur4; 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 l14si16008893ybt.267.2021.12.18.11.56.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Dec 2021 11:56:40 -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=gxIqnur4; 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]:47270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myfot-0007Go-NC for patch@linaro.org; Sat, 18 Dec 2021 14:56:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myfbo-000144-04 for qemu-devel@nongnu.org; Sat, 18 Dec 2021 14:43:08 -0500 Received: from [2607:f8b0:4864:20::433] (port=35551 helo=mail-pf1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1myfbj-0003UP-2A for qemu-devel@nongnu.org; Sat, 18 Dec 2021 14:43:07 -0500 Received: by mail-pf1-x433.google.com with SMTP id v11so1949976pfu.2 for ; Sat, 18 Dec 2021 11:43:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=XHyeOii0ZhnExA6vwEVQHkpV1I3AvOoVnhEEyh3pzMc=; b=gxIqnur4TdMe/uQ/DG9SIUW/C6R/AEL7wRrDN4A4w/Bam1AG+dBzj6o3J3UJQ1ag+o 65SySWE5NwjufColxCtZxCaNdFlwckg3WO9uJdYbmGqh1oMESoxPJH1i6wBSUZ3agV3y bdpfgeqE5hSdjFc8aHPbP7z2bcVkXK+lvcnzhroHMx4SjV2kAbI3Ryu36+TMj+BooCSp 45vcTl2LPum33LkBKq9oWYYf80uhec0lMJktJmEcQPUVkHptK35r5Vn3BknIzhzvjVNt pmKKKsbZ4yWMe+taGTOlmzeCT5FRcOco2t0nvc7l9/I/qf5UgLY8wjBCe/FG1O3xj9Pl jgUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XHyeOii0ZhnExA6vwEVQHkpV1I3AvOoVnhEEyh3pzMc=; b=YSOykuW+4d3xEMtDIIvObdqbqfeAuUr4qqbE3bs/fh0cwGaCY7YCFMglNHgztYX6Lt 1nRWyb2/h0PruFm7B1CxjXo/mMJvdsCWJ2H9la3iaOMJ/9G1IWSsEPpHFV/FTj0jYcli DWOjDub1EvFZ9LYBQLuyArUx74PCHSqP+WNBC8aKWpD4tTBCdXXAwohOC7pJrqXEHDuJ X9GKnBlrB0bWz9SY2GVwC/eBeNALXchARNgnSZ5S1QNtSNmUiX4pN1bSBEwtJzuaKFYO +vNFKqiWl+mfFJqfWphjJKDnTvBCpux6uqcjfvBhtB8jnUq2IHSHv0pGcGREmfE5CpBJ b+Iw== X-Gm-Message-State: AOAM533qMlrlkT94WmkVd+Y/qhAI81TFL6m85E9767RBpyPoTTmshHpz Jzwurv7cLAWcfV9jhiS3qIvp7Sk5l2R+SA== X-Received: by 2002:a63:81c3:: with SMTP id t186mr8194696pgd.150.1639856581777; Sat, 18 Dec 2021 11:43:01 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id g19sm10645919pfc.145.2021.12.18.11.43.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Dec 2021 11:43:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 16/20] tcg/i386: Expand scalar rotate with avx512 insns Date: Sat, 18 Dec 2021 11:42:46 -0800 Message-Id: <20211218194250.247633-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211218194250.247633-1-richard.henderson@linaro.org> References: <20211218194250.247633-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::433 (failed) 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: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Expand 32-bit and 64-bit scalar rotate with VPRO[LR]V; expand 16-bit scalar rotate with VPSHLDV. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- tcg/i386/tcg-target.c.inc | 49 +++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 99ec31977a..447aab7438 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -3508,26 +3508,6 @@ static void expand_vec_rotli(TCGType type, unsigned vece, tcg_temp_free_vec(t); } -static void expand_vec_rotls(TCGType type, unsigned vece, - TCGv_vec v0, TCGv_vec v1, TCGv_i32 lsh) -{ - TCGv_i32 rsh; - TCGv_vec t; - - tcg_debug_assert(vece != MO_8); - - t = tcg_temp_new_vec(type); - rsh = tcg_temp_new_i32(); - - tcg_gen_neg_i32(rsh, lsh); - tcg_gen_andi_i32(rsh, rsh, (8 << vece) - 1); - tcg_gen_shls_vec(vece, t, v1, lsh); - tcg_gen_shrs_vec(vece, v0, v1, rsh); - tcg_gen_or_vec(vece, v0, v0, t); - tcg_temp_free_vec(t); - tcg_temp_free_i32(rsh); -} - static void expand_vec_rotv(TCGType type, unsigned vece, TCGv_vec v0, TCGv_vec v1, TCGv_vec sh, bool right) { @@ -3554,6 +3534,35 @@ static void expand_vec_rotv(TCGType type, unsigned vece, TCGv_vec v0, tcg_temp_free_vec(t); } +static void expand_vec_rotls(TCGType type, unsigned vece, + TCGv_vec v0, TCGv_vec v1, TCGv_i32 lsh) +{ + TCGv_vec t = tcg_temp_new_vec(type); + + tcg_debug_assert(vece != MO_8); + + if (vece >= MO_32 ? have_avx512vl : have_avx512vbmi2) { + tcg_gen_dup_i32_vec(vece, t, lsh); + if (vece >= MO_32) { + tcg_gen_rotlv_vec(vece, v0, v1, t); + } else { + expand_vec_rotv(type, vece, v0, v1, t, false); + } + } else { + TCGv_i32 rsh = tcg_temp_new_i32(); + + tcg_gen_neg_i32(rsh, lsh); + tcg_gen_andi_i32(rsh, rsh, (8 << vece) - 1); + tcg_gen_shls_vec(vece, t, v1, lsh); + tcg_gen_shrs_vec(vece, v0, v1, rsh); + tcg_gen_or_vec(vece, v0, v0, t); + + tcg_temp_free_i32(rsh); + } + + tcg_temp_free_vec(t); +} + static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, TCGv_vec v1, TCGv_vec v2) {