From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21602 invoked by alias); 17 Jun 2013 08:58:10 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 21580 invoked by uid 48); 17 Jun 2013 08:58:06 -0000 From: "vincenzo.innocente at cern dot ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/57634] New: Missed vectorization for a "fixed point multiplication" reduction Date: Mon, 17 Jun 2013 08:58:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vincenzo.innocente at cern dot ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00898.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D57634 Bug ID: 57634 Summary: Missed vectorization for a "fixed point multiplication" reduction Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vincenzo.innocente at cern dot ch I the following code the loop in "red" does not vectorize "because"of note: reduction: not commutative/associative: s_12 =3D (unsigned int) _11; if I use "unsigned long long" everywhere as in redl the reason becomes reduction: not commutative/associative: s_10 =3D temp_9 >> 23; the multiplication in itself vectorize=E2=80=A6 (for unsigned!) compiled as c++ -std=3Dc++11 -march=3Dcorei7-avx -mavx2 -Ofast -S FixedF.cc -ftree-vectorizer-verbose=3D2 -Wall with gcc version 4.9.0 20130607 (experimental) [trunk revision 199812] (GCC= )=20 inline unsigned int mult(unsigned int a, unsigned int b) { typedef unsigned long long ull; // (to support >>) // a and b are of the form 1.m with m of Q bits as int is therefore max 2^(Q+2)-1. a*b is therefore < 2^(2*(Q+2))=20 constexpr int Q =3D 23; constexpr unsigned long long K =3D (1 << (Q-1)); ull temp =3D (ull)(a) * (ull)(b); // result type is operand's type // Rounding; mid values are rounded up temp +=3D K; // Correct by dividing by base=20=20=20 return (temp >> Q);=20=20 } inline unsigned long long multL(unsigned long long a, unsigned long long b) { typedef unsigned long long ull; // (to support >>) // a and b are of the form 1.m with m of Q bits. As int is therefore max 2^(Q+2)-1. a*b is therefore < 2^(2*(Q+2))=20 constexpr int Q =3D 23; constexpr unsigned long long K =3D (1 << (Q-1)); ull temp =3D (ull)(a) * (ull)(b);=20 // Rounding; mid values are rounded up temp +=3D K; // Correct by dividing by base=20=20=20 return (temp >> Q);=20=20 } unsigned int a[1024]; unsigned int b[1024]; unsigned int c[1024]; unsigned long long al[1024]; unsigned long long bl[1024]; unsigned long long cl[1024]; void foo() { for (int i=3D0;i!=3D1204;++i) c[i] =3D mult(a[i],b[i]); } unsigned int red() { unsigned int s=3D1; for (int i=3D0;i!=3D1204;++i) s =3D mult(s,b[i]); return s; } unsigned long long redL() { unsigned long long s=3D1; for (int i=3D0;i!=3D1204;++i) s =3D multL(s,b[i]); return s; } unsigned int prod() { unsigned int s=3D1; for (int i=3D0;i!=3D1204;++i) s =3D s*b[i]; return s; } >>From gcc-bugs-return-424520-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jun 17 09:01:12 2013 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 24392 invoked by alias); 17 Jun 2013 09:01:12 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 23842 invoked by uid 48); 17 Jun 2013 09:01:07 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/57633] I/O: Problem with formatted read: reading CR-LF files (\r\n) Date: Mon, 17 Jun 2013 09:01:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00899.txt.bz2 Content-length: 265 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57633 --- Comment #2 from Tobias Burnus --- Another comment, which I missed to pass on from the original report: It is crucial that the first line ends with a comma; without comma it works.