From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Sandra Loosemore <sandra@codesourcery.com>
Cc: Mike Stump <mikestump@comcast.net>,
Joseph Myers <joseph@codesourcery.com>,
Jason Merrill <jason@redhat.com>,
Richard Biener <richard.guenther@gmail.com>,
gcc-patches Patches <gcc-patches@gcc.gnu.org>
Subject: Re: #pragma GCC unroll support
Date: Fri, 06 Mar 2015 12:37:00 -0000 [thread overview]
Message-ID: <CAC1BbcQ4VQZbL2bbfHd0rbpCKZOgOdKDL45Ksyd2VDo_14+1YA@mail.gmail.com> (raw)
In-Reply-To: <54F90389.8070101@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]
On 6 March 2015 at 02:31, Sandra Loosemore <sandra@codesourcery.com> wrote:
> On 03/05/2015 04:12 PM, Mike Stump wrote:
>>
>>
>> Ping?
>>
>
> Just commenting on the documentation part:
[]
and a few coding style nits:
+++ b/gcc/c-family/c-pragma.c
@@ -1459,6 +1459,10 @@ init_pragma (void)
cpp_register_deferred_pragma (parse_in, "GCC", "ivdep",
PRAGMA_IVDEP, false,
false);
+ if (!flag_preprocess_only)
+ cpp_register_deferred_pragma (parse_in, "GCC", "unroll",
PRAGMA_UNROLL, false,
+ false);
+
overlong line (also for the IVDEP above)
+++ b/gcc/c/c-parser.c
+static void c_parser_while_statement (c_parser *, bool, unsigned short);
+static void c_parser_do_statement (c_parser *, bool, unsigned short);
+static void c_parser_for_statement (c_parser *, bool, unsigned short);
since we're now a C++ app I would have added a default for the
unsigned short unroll of = 0
Same for
finish_while_stmt_cond, finish_do_stmt, finish_for_cond et al.
In cp_parser_range_for() i take it you remember there is a //TODO
I am attaching an unroll-5.C which might show that this does not seem
to be implemented yet, IIUC
gcc/loop-unroll.c::decide_unrolling()
I'd put the "if (loop->unroll == 1) {continue}" earlier in the
FOR_EACH_LOOP body (we're C++ nowadays) but maybe our optimizers are
good enough to do that anyway (but i fear we're not up to that?).
I did not see c/c++ tests for both !DIR$ UNROLL and !DIR$ IVDEP, fwiw.
You seem to handle both placements proper, though.
cheers,
[-- Attachment #2: unroll-5.C --]
[-- Type: text/x-csrc, Size: 1012 bytes --]
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-rtl-loop2_unroll -fdump-tree-cunrolli-details" } */
#include <string>
#include <vector>
void bar(int);
int j;
void test1() {
unsigned long m = j;
const std::string s("abcdefgh");
const std::vector<int> v = {7, 6, 5, 4, 3, 2, 1, 0};
const std::size_t v_sz = 8;
// { dg-final { scan-tree-dump "18:\[0-9\]*: note: loop turned into non-loop" "cunrolli" } }
#pragma GCC unroll sizeof("abcdefgh") * 4
for (auto ch : s)
bar(ch);
// { dg-final { scan-tree-dump "23:\[0-9\]*: note: loop turned into non-loop" "cunrolli" } }
#pragma GCC unroll v_sz
for (auto i : v)
bar(i);
// { dg-final { scan-tree-dump "28:\[0-9\]*: note: loop turned into non-loop" "cunrolli" } }
#pragma GCC unroll 99
for (auto i : v)
bar(i);
}
// { dg-final { scan-rtl-dump-not "Unable to prove that the loop iterates constant times" "loop2_unroll" } }
// { dg-final { cleanup-tree-dump "cunrolli" } }
// { dg-final { cleanup-rtl-dump "loop2_unroll" } }
next prev parent reply other threads:[~2015-03-06 12:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-22 21:51 Mike Stump
2014-12-23 20:22 ` Andi Kleen
2015-01-08 12:45 ` Richard Biener
2015-01-26 21:13 ` Mike Stump
2015-01-26 21:18 ` Mike Stump
2015-01-30 2:51 ` Joseph Myers
2015-01-30 6:12 ` Mike Stump
2015-01-30 2:54 ` Joseph Myers
2015-01-30 6:57 ` Mike Stump
2015-01-30 17:46 ` Joseph Myers
2015-01-30 17:52 ` Mike Stump
2015-01-30 18:06 ` Marek Polacek
2015-01-30 23:48 ` Bernhard Reutner-Fischer
2015-01-30 22:16 ` Mike Stump
2015-02-02 23:22 ` [PATCH, v0] fortran: !GCC$ unroll for DO Bernhard Reutner-Fischer
2015-02-03 8:42 ` Tobias Burnus
2015-02-02 23:22 ` [PATCH, RFC] fortran [was Re: #pragma GCC unroll support] Bernhard Reutner-Fischer
2015-02-03 0:08 ` Mike Stump
2015-05-28 9:56 ` Bernhard Reutner-Fischer
2015-05-28 12:29 ` Mike Stump
2015-11-02 12:18 ` Bernhard Reutner-Fischer
2015-03-05 23:13 ` #pragma GCC unroll support Mike Stump
2015-03-06 1:32 ` Sandra Loosemore
2015-03-06 12:37 ` Bernhard Reutner-Fischer [this message]
2015-03-07 1:16 ` Joseph Myers
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=CAC1BbcQ4VQZbL2bbfHd0rbpCKZOgOdKDL45Ksyd2VDo_14+1YA@mail.gmail.com \
--to=rep.dot.nop@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.com \
--cc=mikestump@comcast.net \
--cc=richard.guenther@gmail.com \
--cc=sandra@codesourcery.com \
/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).