public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/49616] New: REGRESSION vectorization fails in case of runtime dimensioned vector Date: Sun, 03 Jul 2011 10:00:00 -0000 [thread overview] Message-ID: <bug-49616-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49616 Summary: REGRESSION vectorization fails in case of runtime dimensioned vector Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: vincenzo.innocente@cern.ch 4.7 fails while 4.6.1 succeed. Test case at the end of the message: I was not able to reduce it more (the one that fails is at the bottom) gcc version 4.7.0 20110702 (experimental) (GCC) c++ -O3 -std=c++0x -ftree-vectorizer-verbose=2 -c vectBug.cc vectBug.cc:68: note: LOOP VECTORIZED. vectBug.cc:68: note: LOOP VECTORIZED. vectBug.cc:71: note: vectorized 2 loops in function. vectBug.cc:35: note: not vectorized: data ref analysis failed *bs$__b_46[k_320] = D.2547_242; vectBug.cc:48: note: not vectorized: data ref analysis failed *bs$__b_46[k_187] = D.2556_271; vectBug.cc:45: note: not vectorized: data ref analysis failed *bs$__b_46[k_70] = D.2553_262; vectBug.cc:40: note: not vectorized: data ref analysis failed *bs$__b_46[k_317] = D.2550_251; vectBug.cc:35: note: LOOP VECTORIZED. vectBug.cc:48: note: LOOP VECTORIZED. vectBug.cc:45: note: LOOP VECTORIZED. vectBug.cc:40: note: LOOP VECTORIZED. vectBug.cc:16: note: LOOP VECTORIZED. vectBug.cc:28: note: LOOP VECTORIZED. vectBug.cc:25: note: LOOP VECTORIZED. vectBug.cc:20: note: LOOP VECTORIZED. vectBug.cc:16: note: LOOP VECTORIZED. vectBug.cc:28: note: LOOP VECTORIZED. vectBug.cc:25: note: LOOP VECTORIZED. vectBug.cc:20: note: LOOP VECTORIZED. vectBug.cc:94: note: vectorized 12 loops in function. while c++ -O3 -std=c++0x -ftree-vectorizer-verbose=2 -c vectBug.cc -DFIXED vectBug.cc:68: note: LOOP VECTORIZED. vectBug.cc:68: note: LOOP VECTORIZED. vectBug.cc:71: note: vectorized 2 loops in function. vectBug.cc:35: note: LOOP VECTORIZED. vectBug.cc:48: note: LOOP VECTORIZED. vectBug.cc:45: note: LOOP VECTORIZED. vectBug.cc:40: note: LOOP VECTORIZED. vectBug.cc:35: note: LOOP VECTORIZED. vectBug.cc:48: note: LOOP VECTORIZED. vectBug.cc:45: note: LOOP VECTORIZED. vectBug.cc:40: note: LOOP VECTORIZED. vectBug.cc:16: note: LOOP VECTORIZED. vectBug.cc:28: note: LOOP VECTORIZED. vectBug.cc:25: note: LOOP VECTORIZED. vectBug.cc:20: note: LOOP VECTORIZED. vectBug.cc:16: note: LOOP VECTORIZED. vectBug.cc:28: note: LOOP VECTORIZED. vectBug.cc:25: note: LOOP VECTORIZED. vectBug.cc:20: note: LOOP VECTORIZED. vectBug.cc:94: note: vectorized 16 loops in function. and gcc version 4.6.1 20110520 (prerelease) (GCC) c++ -O3 -std=c++0x -ftree-vectorizer-verbose=2 -c vectBug.cc vectBug.cc:68: note: LOOP VECTORIZED. vectBug.cc:68: note: LOOP VECTORIZED. vectBug.cc:71: note: vectorized 2 loops in function. vectBug.cc:35: note: LOOP VECTORIZED. vectBug.cc:48: note: LOOP VECTORIZED. vectBug.cc:45: note: LOOP VECTORIZED. vectBug.cc:40: note: LOOP VECTORIZED. vectBug.cc:35: note: LOOP VECTORIZED. vectBug.cc:48: note: LOOP VECTORIZED. vectBug.cc:45: note: LOOP VECTORIZED. vectBug.cc:40: note: LOOP VECTORIZED. vectBug.cc:16: note: LOOP VECTORIZED. vectBug.cc:28: note: LOOP VECTORIZED. vectBug.cc:25: note: LOOP VECTORIZED. vectBug.cc:20: note: LOOP VECTORIZED. vectBug.cc:16: note: LOOP VECTORIZED. vectBug.cc:28: note: LOOP VECTORIZED. vectBug.cc:25: note: LOOP VECTORIZED. vectBug.cc:20: note: LOOP VECTORIZED. vectBug.cc:94: note: vectorized 16 loops in function. test case cat vectBug.cc const int arraySize=512; struct Bar { int __attribute__ ((aligned(16))) c[arraySize]; int last; Bar() : last(0) { refresh();} void refresh(); void loop0(int N, float * f) { int k=0; int lead = arraySize-last; if (N<=lead) { for (int i=0; i!=N; ++i) f[k++] = c[last++]; return; } for (int i=last; i!=arraySize; ++i) f[k++] = c[i]; int outLoop = (N-lead)/arraySize; last = N -lead - outLoop*arraySize; for (int j=0; j!=outLoop; ++j) { refresh(); for (int i=0; i!=arraySize; ++i) f[k++] = c[i]; } refresh(); for (int i=0; i!=last; ++i) f[k++] = c[i]; } template<typename F> void loop(int N, F f) { int lead = arraySize-last; if (N<=lead) { for (int i=0; i!=N; ++i) f(c[last+i]); last +=N; return; } for (int i=last; i!=arraySize; ++i) f(c[i]); int outLoop = (N-lead)/arraySize; last = N -lead - outLoop*arraySize; for (int j=0; j!=outLoop; ++j) { refresh(); for (int i=0; i!=arraySize; ++i) f(c[i]); } refresh(); for (int i=0; i!=last; ++i) f(c[i]); } }; float __attribute__ ((aligned(16))) z[4096]; void refresh(); int j=0; void fun(float const *, float const *, int); template<typename F> inline void loop(int N, F f) { if (j+N>4096) { j=0; refresh(); } for (int i=0; i!=N; ++i) f(z[j++]); } void foo(int N) { float __attribute__ ((aligned(16))) x[N]; float __attribute__ ((aligned(16))) y[N]; int k=0; auto xs = [&x, &k](float r) { x[k++]= 1.5f*r;}; auto ys = [&y, &k](float r) { y[k++]= r+1.f;}; k=0; loop(N,xs); // for (int i=0; i!=N; ++i) xs(z[j++]); // x[k++] = z[j++]; k=0; loop(N,ys); // for (int i=0; i!=N; ++i) ys(z[j++]); // y[k++] = z[j++]; fun(x,y,N); } void load(int N) { float __attribute__ ((aligned(16))) a[N]; #ifndef FIXED float __attribute__ ((aligned(16))) b[N]; #else float __attribute__ ((aligned(16))) b[1024]; #endif static Bar bar; bar.loop0(N,a); bar.loop0(N,b); fun(a,b,N); int k=0; auto as = [&a, &k](float r) { a[k++]= 1.5f*r;}; auto bs = [&b, &k](float r) { b[k++]= r+1.f;}; k=0; bar.loop(N,as); k=0; bar.loop(N,bs); // <=== this fail (all others ok) fun(a,b,N); }
next reply other threads:[~2011-07-03 10:00 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-07-03 10:00 vincenzo.innocente at cern dot ch [this message] 2011-07-03 11:31 ` [Bug tree-optimization/49616] " dominiq at lps dot ens.fr 2012-05-18 9:46 ` vincenzo.innocente at cern dot ch
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=bug-49616-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).