From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C1C2F3858D33; Sun, 24 Apr 2022 07:37:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1C2F3858D33 From: "lili.cui at intel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/104723] [12 regression] Redundant usage of stack Date: Sun, 24 Apr 2022 07:37:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: lili.cui at intel dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.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: Sun, 24 Apr 2022 07:37:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104723 --- Comment #11 from cuilili --- (In reply to Jakub Jelinek from comment #10) > And for the backend, the question is how big the penalty for the overlapp= ing > store is compared to doing multiple non-overlapping stores. Say for those > 49 bytes one could do one OI, one TI/V1TI and one QI load/store as oppose= d to > one aligned and one misaligned OI load/store. >=20 > For say: > void > foo (void *p, void *q) > { > __builtin_memcpy (p, q, 49); > } > we emit the 2 overlapping loads/stores for -mavx512f and 4 non-overlapping > loads/stores with say -mavx2. I execute both code sequence 100000 times on ICX and znver3 machines. For ICX: 2 overlapping loads/stores are 3.5x faster than 4 non-overlapping loads/stores. For Znver3: 2 overlapping loads/stores are 1.39x faster than 4 non-overlapp= ing loads/stores. ------------------------------------ vmovdqu ymm0, YMMWORD PTR [rsi] vmovdqu YMMWORD PTR [rdi], ymm0 vmovdqu ymm1, YMMWORD PTR [rsi+17] vmovdqu YMMWORD PTR [rdi+17], ymm1 ------------------------------------ vmovdqu xmm0, XMMWORD PTR [rsi] vmovdqu XMMWORD PTR [rdi], xmm0 vmovdqu xmm1, XMMWORD PTR [rsi+16] vmovdqu XMMWORD PTR [rdi+16], xmm1 vmovdqu xmm2, XMMWORD PTR [rsi+32] vmovdqu XMMWORD PTR [rdi+32], xmm2 movzx eax, BYTE PTR [rsi+48] mov BYTE PTR [rdi+48], al -----------------------------------=