public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/50037] New: Unroll factor exceeds max trip count
@ 2011-08-10 14:44 enkovich.gnu at gmail dot com
  2011-08-10 15:14 ` [Bug rtl-optimization/50037] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: enkovich.gnu at gmail dot com @ 2011-08-10 14:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50037

             Bug #: 50037
           Summary: Unroll factor exceeds max trip count
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: enkovich.gnu@gmail.com


Created attachment 24971
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24971
Reproducer

Here is a small loop on which GCC performs inefficient unroll:

for ( count = ((*(hdrptr)) & 0xf) * 2; count > 0; count--, addr++ )
    sum += *addr;

This loop has maximum 30 iterations. If we use -O3 then this loop is
vectorized. Resulting loop has maximum 30 / 8 = 3 iteration. Also vectorizer
generates prologue and epilogue loops. Each of them has maximum 7 iterations.

If we add -funroll-loops option then each of 3 generated by vectorizer loops is
unrolled with unroll factor 8. It creates a lot of code which is never executed
and also decreases performance due to additional checks and branches.

Target: x86_64-unknown-linux-gnu
Configured with: ../gcc1/configure --prefix=/export/gcc-perf/install
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.7.0 20110615 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-O3' '-funroll-loops' '-S' '-v' '-mtune=generic'
'-march=x86-64'
 /export/gcc-perf/install/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1 -quiet
-v unroll_test.c -quiet -dumpbase unroll_test.c -mtune=generic -march=x86-64
-auxbase unroll_test -O3 -version -funroll-loops -o unroll_test.s
GNU C (GCC) version 4.7.0 20110615 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.4.3, GMP version 4.3.1, MPFR version 2.4.2,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-12-18 23:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-10 14:44 [Bug rtl-optimization/50037] New: Unroll factor exceeds max trip count enkovich.gnu at gmail dot com
2011-08-10 15:14 ` [Bug rtl-optimization/50037] " rguenth at gcc dot gnu.org
2011-08-10 15:33 ` enkovich.gnu at gmail dot com
2011-08-10 15:42 ` rguenth at gcc dot gnu.org
2011-08-10 16:57 ` matz at gcc dot gnu.org
2011-08-11 11:23 ` rguenth at gcc dot gnu.org
2011-08-11 11:41 ` rguenth at gcc dot gnu.org
2011-08-11 12:14 ` rguenth at gcc dot gnu.org
2011-08-15  9:12 ` enkovich.gnu at gmail dot com
2021-12-18 23:15 ` pinskia at gcc dot gnu.org

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).