From patchwork Wed Jul 31 20:07:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 1967291 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=orange.fr header.i=@orange.fr header.a=rsa-sha256 header.s=t20230301 header.b=jk5rC1y8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZ39648z9z1ybb for ; Thu, 1 Aug 2024 06:09:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CF0E33858424 for ; Wed, 31 Jul 2024 20:09:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from msa.smtpout.orange.fr (msa-215.smtpout.orange.fr [193.252.23.215]) by sourceware.org (Postfix) with ESMTPS id EF73C3858C3A; Wed, 31 Jul 2024 20:07:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF73C3858C3A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=orange.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=orange.fr ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EF73C3858C3A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=193.252.23.215 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722456466; cv=none; b=CGmTy9ft1o67bHL6R5MuhQ2KIzb/r2eStnl2013Rl7GJyjNN01BzSLFn/EUqzX8DgfzXlLuWbsCV8xQIjGPlDEoLzuCwoIUtBCthUCck4g7ILwCkqOlOgHgf/1nrmqhBcmUJ8C33kOhySvi2jssKIKJMMIscNhLBa3amCswMqq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722456466; c=relaxed/simple; bh=keqlbMVepDGUInmafno7JyukOTBZkRvcZBWpvvib9/Q=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gU4FEZEX5Bqrsfg9YQ8YBXz28seO/4KXUU2gfNr6LgMeD6IEsB6VnpKOqFrzXR7LWlMVAutm8mbVrXqwOXiv/LYCG4mXP7nEiAQ8V6HDDOpZv51ZcEamuJHCzPZgKGa698DZb1Fe5aOKTD3wa1LYrl4WEEttsiKwKQpngLyalC8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from cyrano.home ([86.215.161.51]) by smtp.orange.fr with ESMTPA id ZFbisBHiIYjQzZFbqsqYRE; Wed, 31 Jul 2024 22:07:42 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1722456462; bh=Ajc7yH73Mqcz+SUwYDgnETSix6Yk41QofBADBsa58OQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=jk5rC1y8pl+v6ie8zq93Ho2vICIbbGGjh2YxgdOqUhZ3hIH2zWAiQQthT3gxUVWQO VWUtB9JjhpiIc3w0W4QEsb2bTvMwhWmo0CvOPkG9iqzn+UrlhIE0kpnfaQgvgr753V gDMcNkfi8+nE1HLGUmXKrddFPvjglB8jwDFmBAzkEipwth9LthuezdLc8LdElcZvQV HbEVoUZfGhX9oVfhWTdrssMoD9sCb7wJMnTeU6QmiLKPQ2JhDKzuw9m9PJBcmJUwgd t2Z5evb0ec/AcRN4ouqJ04Rlh6RK7F147+0AGuiyuoIAaN7SGYUXAa6VeIOdZebWf+ hJaznqXClzO2w== X-ME-Helo: cyrano.home X-ME-Auth: bW9yaW4tbWlrYWVsQG9yYW5nZS5mcg== X-ME-Date: Wed, 31 Jul 2024 22:07:42 +0200 X-ME-IP: 86.215.161.51 From: Mikael Morin To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: [PATCH 0/8] fortran: Inline MINLOC/MAXLOC without DIM argument [PR90608] Date: Wed, 31 Jul 2024 22:07:27 +0200 Message-ID: <20240731200735.229898-1-morin-mikael@orange.fr> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Mikael Morin This series of patches enable the generation of inline code for the MINLOC and MAXLOC intrinsics, when the DIM argument is not present. The generated code is based on the inline implementation already generated in the scalar case, that is when ARRAY has rank 1 and DIM is present. The code is extended by using several variables (one for each dimension) where the scalar code used just one, and collecting the variables to an array before returning. The patches are split in a way that allows inlining in more and more cases as controlled by the gfc_inline_intrinsic_p predicate which evolves with the patches. They have been generated on top of the patch: https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657959.html Mikael Morin (8): fortran: Add tests covering inline MINLOC/MAXLOC without DIM [PR90608] fortran: Disable frontend passes for inlinable MINLOC/MAXLOC [PR90608] fortran: Inline MINLOC/MAXLOC with no DIM and ARRAY of rank 1 [PR90608] fortran: Outline array bound check generation code fortran: Inline integral MINLOC/MAXLOC with no DIM and no MASK [PR90608] fortran: Inline integral MINLOC/MAXLOC with no DIM and scalar MASK [PR90608] fortran: Inline non-character MINLOC/MAXLOC with no DIM [PR90608] fortran: Continue MINLOC/MAXLOC second loop where the first stopped [PR90608] gcc/fortran/frontend-passes.cc | 3 +- gcc/fortran/trans-array.cc | 382 ++++++++------- gcc/fortran/trans-intrinsic.cc | 454 +++++++++++++----- gcc/testsuite/gfortran.dg/maxloc_7.f90 | 220 +++++++++ gcc/testsuite/gfortran.dg/maxloc_bounds_4.f90 | 4 +- gcc/testsuite/gfortran.dg/maxloc_bounds_5.f90 | 4 +- gcc/testsuite/gfortran.dg/maxloc_bounds_6.f90 | 4 +- gcc/testsuite/gfortran.dg/maxloc_bounds_7.f90 | 4 +- .../gfortran.dg/maxloc_with_mask_1.f90 | 393 +++++++++++++++ gcc/testsuite/gfortran.dg/minloc_8.f90 | 220 +++++++++ .../gfortran.dg/minloc_with_mask_1.f90 | 392 +++++++++++++++ 11 files changed, 1792 insertions(+), 288 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/maxloc_7.f90 create mode 100644 gcc/testsuite/gfortran.dg/maxloc_with_mask_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/minloc_8.f90 create mode 100644 gcc/testsuite/gfortran.dg/minloc_with_mask_1.f90