From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BADDE389041A; Thu, 4 Mar 2021 15:36:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BADDE389041A From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/98856] [11 Regression] botan AES-128/XTS is slower by ~17% since r11-6649-g285fa338b06b804e72997c4d876ecf08a9c083af Date: Thu, 04 Mar 2021 15:36:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 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: Thu, 04 Mar 2021 15:36:01 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98856 --- Comment #18 from Richard Biener --- There's another thing - we end up with vmovq %rax, %xmm3 vpinsrq $1, %rdx, %xmm3, %xmm0 but that has way worse latency than the alternative you'd get w/o SSE 4.1: vmovq %rax, %xmm3 vmovq %rdx, %xmm7 punpcklqdq %xmm7, %xmm3 for example on Zen3 vmovq and vpisnrq have latencies of 3 while punpck has a latency of only one. So the second variant should have 2 cycles less latency. Testcase: typedef long v2di __attribute__((vector_size(16))); v2di foo (long a, long b) { return (v2di){a, b}; } Even on Skylake it's 2 (movq) + 3 (vpinsr), so there it's 6 vs. 3. Not sure if we should somehow do this late somehow (peephole or splitter) since it requires one more %xmm register.=