From patchwork Mon Oct 14 15:08:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 1997019 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=ZicWfIg1; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XS0xd2S7kz1xvK for ; Tue, 15 Oct 2024 02:09:08 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 918133858414 for ; Mon, 14 Oct 2024 15:09:06 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from msa.smtpout.orange.fr (smtp-71.smtpout.orange.fr [80.12.242.71]) by sourceware.org (Postfix) with ESMTPS id 1E0E53858414; Mon, 14 Oct 2024 15:08:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1E0E53858414 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 1E0E53858414 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=80.12.242.71 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728918514; cv=none; b=kjzUi26yqiOKB+M8eCL5T06twqYfX6Hq2YsVFH/RMlNgNgnr9kqBv18AVX3EzPHIqG+YF31AcNRJ02Y50NiQizbdQ3a8wgI+bm5GkgPZnoK/f+9vLMYt6uw8uJl5daiZrw/s3WGgGSWBp0nAkOW/qmeCB4XIkyb27CYw5gaETyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728918514; c=relaxed/simple; bh=1vkE1gduiMkAOCD7SUA6F8PPKh/WT4MYZIO4ZnzffxM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ruzPTWTGdaZ+Yin67CwB1bHejjwMtKGJ4Xcj2jTKaesqy7jdIEuORt/BqoO0yCNJGYH0bJ1BjTGpnNtro8+EIsEa9OTnN07K9gWBrKpumcU125rr2SNl7LKMA7FSp7heUJsAq0CEMgqQ+4X8rIN4DeV5G8AXXh/BBXSxFaFAueM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from cyrano.home ([86.215.161.51]) by smtp.orange.fr with ESMTPA id 0MgBtHlyUIPG80MgOtVhIH; Mon, 14 Oct 2024 17:08:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1728918509; bh=RR43Ee05TaLdpFZQ0ik+ueSYkhb5Muo1wCuboStRnJ0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ZicWfIg15yrLNkQeORGvaxUKJk08xbs1xBdBKL50vp/MC43/gUfVd+vLEgEvpOwXy C/Uxqn60BbokY79XlU/xuD0XpZZlsQGVbZDqVoqv1HIl4/qa5lsa0LgD44vqtPUU+b NLqOtbPigc0Qqf5t+VfWVzLvIPsI6Ehxoecd15Evc+I4FRu9hykJ+hr8DwLJ9j5YN8 5mhTmBU9fo2F+GQJD4XpgfUwIDVMVlhXIGLf7xUITVz24yeVORAkKJtDKdY2I+7ys9 D1BCx1m5t/3gQurdwjzMIGqdXZCYUtDPUT5MVKo5NlSn8z2BJoMaX7EccmMHdpTsqj /WG8APO0YmnbQ== X-ME-Helo: cyrano.home X-ME-Auth: bW9yaW4tbWlrYWVsQG9yYW5nZS5mcg== X-ME-Date: Mon, 14 Oct 2024 17:08:29 +0200 X-ME-IP: 86.215.161.51 From: Mikael Morin To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: [PATCH 0/7] fortran: Inline MINLOC/MAXLOC with DIM [PR90608] Date: Mon, 14 Oct 2024 17:08:09 +0200 Message-ID: <20241014150816.315478-1-morin-mikael@orange.fr> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 Hello, this is the second (and last) series of patches to inline MINLOC and MAXLOC. The previous series added support for inlining without DIM. This one focuses on the cases where the DIM argument is present (and is a constant), using the existing support for reduction functions in the scalarizer. The changes involve the creation of a nested loop at expression walking time, and its usage in gfc_conv_intrinsic_minmaxloc as a replacement of the local loop variable used when DIM is absent, the existing scalarizer code taking care of its full setup in between. The series is split similarly to the previous one, with the unmasked integral cases being inlined first, followed by scalar MASK cases, and finally REAL and masked cases. Mikael Morin (7): fortran: Add tests covering inline MINLOC/MAXLOC with DIM [PR90608] fortran: Inline unmasked integral MINLOC/MAXLOC with DIM [PR90608] fortran: Inline MINLOC/MAXLOC with DIM and scalar MASK [PR90608] fortran: Check MASK directly instead of its scalarization chain fortran: Inline non-character MINLOC/MAXLOC with DIM [PR90608] fortran: Check for empty MINLOC/MAXLOC ARRAY along DIM only fortran: Evaluate once BACK argument of MINLOC/MAXLOC with DIM [PR90608] gcc/fortran/trans-intrinsic.cc | 362 +++++++---- .../gfortran.dg/ieee/maxloc_nan_2.f90 | 64 ++ .../gfortran.dg/ieee/minloc_nan_2.f90 | 64 ++ gcc/testsuite/gfortran.dg/maxloc_8.f90 | 349 +++++++++++ gcc/testsuite/gfortran.dg/maxloc_bounds_1.f90 | 4 +- gcc/testsuite/gfortran.dg/maxloc_bounds_2.f90 | 4 +- gcc/testsuite/gfortran.dg/maxloc_bounds_3.f90 | 4 +- gcc/testsuite/gfortran.dg/maxloc_bounds_8.f90 | 4 +- .../gfortran.dg/maxloc_with_dim_1.f90 | 201 ++++++ .../maxloc_with_dim_and_mask_1.f90 | 452 ++++++++++++++ gcc/testsuite/gfortran.dg/minloc_9.f90 | 349 +++++++++++ .../gfortran.dg/minloc_with_dim_1.f90 | 201 ++++++ .../minloc_with_dim_and_mask_1.f90 | 452 ++++++++++++++ gcc/testsuite/gfortran.dg/minmaxloc_19.f90 | 182 ++++++ gcc/testsuite/gfortran.dg/minmaxloc_20.f90 | 182 ++++++ gcc/testsuite/gfortran.dg/minmaxloc_21.f90 | 572 ++++++++++++++++++ gcc/testsuite/gfortran.dg/minmaxloc_22.f90 | 26 + 17 files changed, 3354 insertions(+), 118 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/ieee/maxloc_nan_2.f90 create mode 100644 gcc/testsuite/gfortran.dg/ieee/minloc_nan_2.f90 create mode 100644 gcc/testsuite/gfortran.dg/maxloc_8.f90 create mode 100644 gcc/testsuite/gfortran.dg/maxloc_with_dim_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/maxloc_with_dim_and_mask_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/minloc_9.f90 create mode 100644 gcc/testsuite/gfortran.dg/minloc_with_dim_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/minloc_with_dim_and_mask_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/minmaxloc_19.f90 create mode 100644 gcc/testsuite/gfortran.dg/minmaxloc_20.f90 create mode 100644 gcc/testsuite/gfortran.dg/minmaxloc_21.f90 create mode 100644 gcc/testsuite/gfortran.dg/minmaxloc_22.f90