From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1549 invoked by alias); 27 Aug 2014 09:58:32 -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 1256 invoked by uid 48); 27 Aug 2014 09:58:25 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/62080] Suboptimal code generation with eigen library Date: Wed, 27 Aug 2014 09:58:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: 2014-08/txt/msg01833.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62080 --- Comment #6 from Richard Biener --- (In reply to Marc Glisse from comment #5) > With the intrinsics patch, I notice that we don't simplify in gimple either: > > _40 = VIEW_CONVERT_EXPR<__m128i>(_39); > MEM[(__m128i * {ref-all})vec_4(D)] = _40; > _60 = MEM[(const double *)vec_4(D)]; > _61 = MEM[(const double *)vec_4(D) + 8B]; > _62 = {_60, _61}; > _63 = VIEW_CONVERT_EXPR<__v4si>(_62); > > (_39 and _63 have the same type) value-numbering has difficulties in seeing through so much stmts (read: not implemented) and it doesn't have a way of expressing "partial" values. That is, it knows that at MEM[(__m128i * {ref-all})vec_4(D)] we stored _39 but when value-numbering the partial reads it can't assign the value _39 to them (as said, "partial" values are not supported). So one way to optimize this is to special-case the composition operations and try looking up a proper memory operation. Another possibility is to value-number compound operations also as piecewise operations, introducing fake value-numbers (that is, "lower" everything to component-wise operations internally). I suppose pattern-matching > _60 = MEM[(const double *)vec_4(D)]; > _61 = MEM[(const double *)vec_4(D) + 8B]; > _62 = {_60, _61}; and generating a single read (with eventually a permute?) would be more profitable and easier to implement.