From patchwork Sun Jun 13 19:53:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1491494 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Y85HIAmL; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G34zJ1nHBz9sW4 for ; Mon, 14 Jun 2021 05:54:18 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C9D4A389366D for ; Sun, 13 Jun 2021 19:54:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C9D4A389366D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1623614055; bh=gTQM8NHRy+CvBko3wpXPQlDbYBFxn9K6/He5A6oeTdI=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Y85HIAmL+fmu01WoImCvnrONFR7f1pR7vdj4affi0yiiwpIxePzOwNH6oeeoBkEqj WPvIGAp+C4qHujG3ISYec+nve/Zrgup7g416OIlvZiEaRBjv8017cBgY3Wkub5eOhq mGgGhAjYXGoTpua1LvxuaJMWpQQ8nxOXG6hEZ7Mg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by sourceware.org (Postfix) with ESMTPS id 2515F385BF9C for ; Sun, 13 Jun 2021 19:53:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2515F385BF9C Received: by mail-qk1-x733.google.com with SMTP id c9so10201523qkm.0 for ; Sun, 13 Jun 2021 12:53:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=gTQM8NHRy+CvBko3wpXPQlDbYBFxn9K6/He5A6oeTdI=; b=e7+Qfdmlf/UblIo8V3GWuDLNolxErwgV5yzTBNADAKwWo1TU120FvhFQ5/9qmYZz2/ gGJHPfeJS05V7yF76Zjnpq5U/XEv2TlUKOzI5BRCqPYCA/p2oklUPeuMuO+fIFs8HY/7 NBDM3zXtulSduzrRtl9KiRfNrRKv3C74K0Q8xd7pXJR7vGSBSHIQa9uZgXZ4vWLZlmm/ OfL1u7+8MPBraZqqxC/re/CZgvLDu9aj//GSwjiiUtM23rJikT+fAknszRI3QQ58W/Av mHbSagjmdw5Cws0EHEY3JLA28oAtYX8xwDTa3iwRt0O2MQBJIhVYhlORAulWIE0b0Oeq oo2w== X-Gm-Message-State: AOAM531nk+1V9fUdg3xteZzdJU2lNFV80UUX67amwaEYEhOCvJc+XY/D d8rOIoxmYQsFnBmkTwU47Gs51Rgc4sF6NMIAtvVJ79vg6uLHUw== X-Google-Smtp-Source: ABdhPJx7DdBHyXrm/0+Uq5TtYdrs6qQdkasF10jjnRrZcZbanDYqnkwZMudZ3BCDTcL+wdWwUaAXReh8Fwdg+4o72dU= X-Received: by 2002:ae9:dd06:: with SMTP id r6mr13633026qkf.74.1623614034604; Sun, 13 Jun 2021 12:53:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 13 Jun 2021 21:53:43 +0200 Message-ID: Subject: [PATCH] i386: Improve variable permutation insn avoidance [PR101021] To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Uros Bizjak via Gcc-patches From: Uros Bizjak Reply-To: Uros Bizjak Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Emit constant permutation insn directly from expand_vec_perm_shufb. 2021-06-13 Uroš Bizjak gcc/ PR target/101021 * config/i386/i386-expand.c (expand_vec_perm_pshufb): Emit constant permutation insn directly from here. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Pushed to master. Uros. diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index 2fa3a18dc6a..6e33f6f8196 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -17593,13 +17593,16 @@ expand_vec_perm_pshufb (struct expand_vec_perm_d *d) return false; } - /* Try to avoid variable permutation instruction. */ - if (canonicalize_vector_int_perm (d, &nd) && expand_vec_perm_1 (&nd)) - return false; - if (d->testing_p) return true; + /* Try to avoid variable permutation instruction. */ + if (canonicalize_vector_int_perm (d, &nd) && expand_vec_perm_1 (&nd)) + { + emit_move_insn (d->target, gen_lowpart (d->vmode, nd.target)); + return true; + } + if (vmode == V8SImode) for (i = 0; i < 8; ++i) rperm[i] = GEN_INT ((d->perm[i * nelt / 8] * 8 / nelt) & 7);