From patchwork Mon Jul 3 16:52:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 1802887 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.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=hWjXx+sT; dkim-atps=neutral Received: from server2.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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QvsSf6Pq0z20bT for ; Tue, 4 Jul 2023 02:53:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C4A0A3858023 for ; Mon, 3 Jul 2023 16:53:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4A0A3858023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688403215; bh=sJ7X23WWuO12nsKD7bUaASgY2tYRu3AJY5Sq1/V6YfM=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=hWjXx+sTU6NH1dITu6TD+7h4b/en8jkP9lmuB1KXRLBFz5XD+Szxdc7ktC/GJh3Vy TKw1q8u0yIEjiLXOiR0xEkInfC6x+SgCeYL6XERiC/HNSeBjUOC7ANnJqVoogu5/Lx ZUPqPz9tXIt/9tBy335Qed0cNLuKY51YwHtmDa0k= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 949D33858D32 for ; Mon, 3 Jul 2023 16:53:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 949D33858D32 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0D3132F4; Mon, 3 Jul 2023 09:53:59 -0700 (PDT) Received: from [10.57.76.20] (unknown [10.57.76.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DDA453F663; Mon, 3 Jul 2023 09:52:55 -0700 (PDT) Message-ID: <9bcc1810-a2a3-8eee-5926-f3ae0a4d2891@arm.com> Date: Mon, 3 Jul 2023 17:52:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Cc: Richard Sandiford , Richard Biener Subject: [PATCH] vect: Treat vector widening IFN calls as 'simple' [PR110436] X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: "Andre Vieira \(lists\) via Gcc-patches" From: "Andre Vieira (lists)" Reply-To: "Andre Vieira \(lists\)" Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch makes the vectorizer treat any vector widening IFN as simple, like it did with the tree codes VEC_WIDEN_*. I wasn't sure whether I should make all IFN's simple and then exclude some (like GOMP_ ones), or include more than just the new widening IFNs. But since this is the only behaviour that changed with the ifn patch, I decided to only special case the widening IFNs for now. Let me know if you have different thoughts on this. Bootstrapped and regression tested on aarch64-unknow-linux-gnu. gcc/ChangeLog: PR tree-optimization/110436 * tree-vect-stmts.cc (is_simple_and_all_uses_invariant): Treat widening IFN's as simple. gcc/testsuite/ChangeLog: * gcc.dg/pr110436.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr110436.c b/gcc/testsuite/gcc.dg/pr110436.c new file mode 100644 index 0000000000000000000000000000000000000000..c146f99fac9f0524eaa3b1230b56e9f94eed5bda --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr110436.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#include "pr83089.c" + diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index d642d3c257f8d540a8562eedbcd40372b9550959..706055e9af94f0c1500c25faf4bd74fc08bf3cd6 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -296,8 +296,11 @@ is_simple_and_all_uses_invariant (stmt_vec_info stmt_info, tree op; ssa_op_iter iter; - gassign *stmt = dyn_cast (stmt_info->stmt); - if (!stmt) + gimple *stmt = stmt_info->stmt; + if (!is_gimple_assign (stmt) + && !(is_gimple_call (stmt) + && gimple_call_internal_p (stmt) + && widening_fn_p (gimple_call_combined_fn (stmt)))) return false; FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)