From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 366B0385EC54; Tue, 23 Mar 2021 14:28:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 366B0385EC54 From: "martin@mpa-garching.mpg.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99728] code pessimization when using wrapper classes around SIMD types Date: Tue, 23 Mar 2021 14:28:29 +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: 10.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: martin@mpa-garching.mpg.de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Mar 2021 14:28:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99728 --- Comment #5 from Martin Reinecke --- (In reply to Matthias Kretz (Vir) from comment #4) > FWIW, using std::experimental::native_simd also does not hoist the > stores out of the loop. However, if you pass d by value and return d, the > issue goes away. So I guess this is an aliasing pessimization. This is an interesting data point ... In my first test case (attached to https://gcc.gnu.org/pipermail/gcc-help/2021-March/139976.html), I explicitly make a local copy of d and copy back at the end of the function, and this didn't help. Strange. > Even though > you added __restrict__. In any case __m256 has the problem that it is > declared with the may_alias attribute. I recommend to just never use __m2= 56 > unless you have no other choice. I guess I need it for unaligned loads/stores, correct? Otherwise __v4df sho= uld work everywhere.=