From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1A7753858429; Mon, 13 Sep 2021 03:06:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A7753858429 From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/102294] memset expansion is sometimes slow for small sizes Date: Mon, 13 Sep 2021 03:06:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com 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: cc 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: Mon, 13 Sep 2021 03:06:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102294 Hongtao.liu changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |crazylht at gmail dot com --- Comment #8 from Hongtao.liu --- (In reply to Andrew Pinski from comment #6) > This is literally just measuring memset times of a small structure. >=20 > -mtune=3Dintel changes the timings too. > Doing -mstringop-strategy=3Dlibcall also changes the timing to the point = where > they are about the same as clang. >=20 > So this is a target issue and not a middle-end. >=20 > You need to do timings on many more processors to have the -mtune=3Dgener= ic > changed. Yes, it's related to strongop strategy, w/ -mtune=3Dskylake gcc -O2 -march=3Dx86-64 test.c -mtune=3Dskylake Elapsed time: 0.353267 s Elapsed time: 0.515796 s Elapsed time: 0.352953 s gcc -O2 -march=3Dx86-64 test.c Elapsed time: 0.892582 s Elapsed time: 0.515735 s Elapsed time: 0.843342 s w/ -mtune=3Dskylake, xmm mov is used. bio_init3: .LFB30: .cfi_startproc pxor %xmm15, %xmm15 movups %xmm15, 96(%rdi) movups %xmm15, 32(%rdi) movw %dx, 98(%rdi) movl $1, 32(%rdi) movl $1, 100(%rdi) movq %rsi, 104(%rdi) movups %xmm15, (%rdi) movups %xmm15, 16(%rdi) movups %xmm15, 48(%rdi) movups %xmm15, 64(%rdi) movups %xmm15, 80(%rdi) movq %xmm15, 112(%rdi) ret .cfi_endproc w/ -mtune=3Dgeneric, res stosq is used. bio_init3: .LFB30: .cfi_startproc movq %rdi, %r8 movl $15, %ecx xorl %eax, %eax rep stosq movl $1, 32(%r8) movw %dx, 98(%r8) movl $1, 100(%r8) movq %rsi, 104(%r8) ret=