public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: sgk@troutmask.apl.washington.edu
Cc: gcc-patches@gcc.gnu.org, gfortran <fortran@gcc.gnu.org>
Subject: Re: [fortran] Add support for #pragma GCC unroll v3
Date: Tue, 28 Nov 2017 09:59:00 -0000	[thread overview]
Message-ID: <1758060.ZELOYyS0nn@polaris> (raw)
In-Reply-To: <20171125173149.GB40985@troutmask.apl.washington.edu>

> 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

  reply	other threads:[~2017-11-28  9:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-25 17:31 Eric Botcazou
2017-11-25 18:57 ` Steve Kargl
2017-11-28  9:59   ` Eric Botcazou [this message]
2017-12-06  9:21   ` Eric Botcazou
2017-12-08 12:23     ` Janne Blomqvist

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1758060.ZELOYyS0nn@polaris \
    --to=ebotcazou@adacore.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=sgk@troutmask.apl.washington.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).