From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64627 invoked by alias); 28 Nov 2017 09:49:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 64607 invoked by uid 89); 28 Nov 2017 09:49:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT,KB_WAM_FROM_NAME_SINGLEWORD,RCVD_IN_BRBL_LASTEXT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Nov 2017 09:49:52 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id C42D181390; Tue, 28 Nov 2017 10:49:49 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BLbSWOhaIX2D; Tue, 28 Nov 2017 10:49:49 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 891C381392; Tue, 28 Nov 2017 10:49:49 +0100 (CET) From: Eric Botcazou To: sgk@troutmask.apl.washington.edu Cc: gcc-patches@gcc.gnu.org, gfortran Subject: Re: [fortran] Add support for #pragma GCC unroll v3 Date: Tue, 28 Nov 2017 09:59:00 -0000 Message-ID: <1758060.ZELOYyS0nn@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; ) In-Reply-To: <20171125173149.GB40985@troutmask.apl.washington.edu> References: <1957613.VqFDUkVbj2@polaris> <20171125173149.GB40985@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2017-11/txt/msg02379.txt.bz2 > The patch looks ok to me. Thanks. > For documentation, the gfortran manual has 2 sections: > > 6.1 Extensions implemented in GNU Fortran > 7.2 GNU Fortran Compiler Directives > > 6.1 describes extension covering legacy code and vendor extensions. > 7.2 describes other !$GCC directives. Currently, the section is > mainly calling conventions (CDECL, STDCALL, etc) and library > macroc (DLLEXPORT). These should probably be in 7.2.1 and the > UNROLL directive in 7.2.2. > > I can help with the documentation (although it might take a weekend > or two to get done), but need to know sematics. Does the directive > apply to only the immediately following loop? Does it apply to all > loops that follow the directive? The former. Here's the documentation for the C & C++ compilers: `#pragma GCC unroll N' You can use this pragma to control how many times a loop should be unrolled. It must be placed immediately before a `for', `while' or `do' loop or a `#pragma GCC ivdep', and applies only to the loop that follows. N is an integer constant expression specifying the unrolling factor. The values of 0 and 1 block any unrolling of the loop. > What is the interaction of the directive with -funroll-loops and --param > max-unroll-times=4? It's independent and always prevails, i.e. it doesn't need -funroll-loops to be effective, #pragma GCC 0 will block unrolling despite -funroll-loops and #pragma GCC N wins over --param max-unroll-times=M. -- Eric Botcazou