From patchwork Thu Mar 3 20:59:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 547828 Delivered-To: patch@linaro.org Received: by 2002:ac0:f585:0:0:0:0:0 with SMTP id s5csp985389imq; Thu, 3 Mar 2022 13:13:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpnQQArWGe9inXuuVH+1UO5ZANNywPKAjITELHx0TT2bkscYCSdW7Bb095UCZJnE1DujZw X-Received: by 2002:a25:678b:0:b0:628:aa84:f6a1 with SMTP id b133-20020a25678b000000b00628aa84f6a1mr8177629ybc.557.1646342011347; Thu, 03 Mar 2022 13:13:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646342011; cv=none; d=google.com; s=arc-20160816; b=Kki72K8EfGbA3xC3ow2uwm3OVK2EDqs5mkIDXW/EE+g+lq+CjTHpJpcYTgAowjzhfl WVXqizzIIGnlP9tK3craSiHWHczmVkRo0f6hTzTppf+l9KDd5bLY2/qiAT4y9Q0FRLRr kpORwM6/ZOp0Zq02XcS43G6EA4PwxoQb+fc7avxUtBewpyncGeN9diGeSJWfdmsLZ7aT sXhV6ygO5IXnbXXBeHNMzjF2d1kXDzkQBrfGvAYzrBVYXO1OvhNDdZDuAGfLqlbgtZs4 VxhuOEbmQ1uo7ZP0G7hEktBJvbskSDZqWFj0FejO84R0ijMWIKz1kzlUtuj4tvshDXZM QaFQ== 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=pd3yrxT35d4SOyEjqIqaXgmr9vG25Nh62apx3szcfnk=; b=XqZbFzHqwt8/dWZ3TjOoLAq0fSCue5/jFRUL+mehLi0LSUh/dxrn3lnNqMsjo5PvMW g8iEaqbI4Zz2b2LpXtX5FyNZmK5WgbyHZ1GYOu3ApEvrBfqrjcoCAQd/RSdlBbaSybql nyaAZghtoNqMQx9cGsYbBRvQEt2OiF0uw7CRBrL23+fpPxcijtj+s7Sj6p8VTMjddfZJ lxT44d7bB095LOGII4rEY2zimAMH14MLzWVHEcsp8ndgTHZJeDKvgeEuXyzcTFoL9RuX vJySmTejtmkA27vSvf5Xi/he0j+ymJAkN1zIuzmHTnrOBIzow66VrK7htvkpDPrywVGT r6UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mm93nEYK; 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 h20-20020a81b654000000b002dbc3590913si2446239ywk.532.2022.03.03.13.13.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Mar 2022 13:13:31 -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=Mm93nEYK; 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]:33756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPslO-0005qe-SR for patch@linaro.org; Thu, 03 Mar 2022 16:13:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPsYR-0005wx-EB for qemu-devel@nongnu.org; Thu, 03 Mar 2022 16:00:07 -0500 Received: from [2607:f8b0:4864:20::52b] (port=36452 helo=mail-pg1-x52b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPsYP-0004EL-M1 for qemu-devel@nongnu.org; Thu, 03 Mar 2022 16:00:07 -0500 Received: by mail-pg1-x52b.google.com with SMTP id t14so5754911pgr.3 for ; Thu, 03 Mar 2022 13:00:05 -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=pd3yrxT35d4SOyEjqIqaXgmr9vG25Nh62apx3szcfnk=; b=Mm93nEYKmYEUiPnIUUa+xvTossscaaaO41G7bRxukfRsnxlNcMEzYy5lcugLvjLGsl ZCgWh78UcerFpj1XCwKvPnIofcBu5p0Hm5nwAPOElO8ypbYGsYyGf2m4WTs3PU/Bp+/f FSF+BHJqj14ccVVH/PnHhYiQrwXYUJRR7KLbuxKNs8zkjg1esWKGfN9GypI4/hqYCShb YINwVVdkH1nyxZcFVMLSP0n/P7SjyNA34v+fV2Qp00tSd2ponnC6bBzdn/fruNzTSlTH G+NX0zoXDbQ2RRgS9/KEgCJwLUNmFdpRQHVXGMDQwqq4dqa0YkDHu5JqwoiRyjXPFBzJ J8Hg== 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=pd3yrxT35d4SOyEjqIqaXgmr9vG25Nh62apx3szcfnk=; b=u+5CSnqigdGTjVuHefbQcr19nZvucteXUJTL4ReCGVN7ohbiyFI9vRnYKiUJTBYui+ qb4n8CkZA2COe6mHsPNBRRE8AA73qxQS0NJSulvOqgA7QaGRK5nCKK9rZNxXpdxKO9ni F5QvCNW22N9GCH/70I/P4Rz9RoSP0r2+/BhYAClOHlhVqzN6j9KAD+CS8pWcWDWfMshD ZNDffls6ajGTjDkaW6sq5LyNlT8+rsxT1Ehp1KJXY92IL63mKzS4ckItfVXIfDbJTaPf xZq3o6tcmCf5MCo4lH1ahtUWxa+YIi8VjYnjYpgV5A0Ab/yOistv/+Q1mLj3SHD+iV1i iYzQ== X-Gm-Message-State: AOAM532FOUkKRckNwf2GGLragUUYHPSFjbKWLN1I2rmK7XPxzL+1a4CU wxDTF2jEbYZDHyoBEgTlsxsucz46y2ZCjQ== X-Received: by 2002:aa7:85d8:0:b0:4f6:8ae9:16a8 with SMTP id z24-20020aa785d8000000b004f68ae916a8mr3181958pfn.15.1646341204358; Thu, 03 Mar 2022 13:00:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 13:00:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 11/30] tcg/i386: Implement avx512 immediate sari shift Date: Thu, 3 Mar 2022 10:59:25 -1000 Message-Id: <20220303205944.469445-12-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::52b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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" AVX512 has VPSRAQ with immediate operand, in the same form as with AVX, but requires EVEX encoding and W1. Tested-by: Alex Bennée Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 1ef34f0b52..de01fbf40c 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -2986,17 +2986,22 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_shli_vec: + insn = shift_imm_insn[vece]; sub = 6; goto gen_shift; case INDEX_op_shri_vec: + insn = shift_imm_insn[vece]; sub = 2; goto gen_shift; case INDEX_op_sari_vec: - tcg_debug_assert(vece != MO_64); + if (vece == MO_64) { + insn = OPC_PSHIFTD_Ib | P_VEXW | P_EVEX; + } else { + insn = shift_imm_insn[vece]; + } sub = 4; gen_shift: tcg_debug_assert(vece != MO_8); - insn = shift_imm_insn[vece]; if (type == TCG_TYPE_V256) { insn |= P_VEXL; } @@ -3316,16 +3321,23 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) return vece == MO_8 ? -1 : 1; case INDEX_op_sari_vec: - /* We must expand the operation for MO_8. */ - if (vece == MO_8) { + switch (vece) { + case MO_8: return -1; - } - /* We can emulate this for MO_64, but it does not pay off - unless we're producing at least 4 values. */ - if (vece == MO_64) { + case MO_16: + case MO_32: + return 1; + case MO_64: + if (have_avx512vl) { + return 1; + } + /* + * We can emulate this for MO_64, but it does not pay off + * unless we're producing at least 4 values. + */ return type >= TCG_TYPE_V256 ? -1 : 0; } - return 1; + return 0; case INDEX_op_shls_vec: case INDEX_op_shrs_vec: