public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bart.vanassche at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/102294] memset expansion is sometimes slow for small sizes Date: Mon, 13 Sep 2021 02:57:47 +0000 [thread overview] Message-ID: <bug-102294-4-25P8j9UhP1@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102294-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102294 --- Comment #7 from Bart Van Assche <bart.vanassche at gmail dot com> --- Initializing small data structures via structure assignment is a common approach in the Linux kernel. This is the code gcc generates with the no-sse option applied: (gdb) disas bio_init3 Dump of assembler code for function bio_init3: 0x00000000004011b0 <+0>: mov %rdi,%r8 0x00000000004011b3 <+3>: mov $0xf,%ecx 0x00000000004011b8 <+8>: xor %eax,%eax 0x00000000004011ba <+10>: rep stos %rax,%es:(%rdi) 0x00000000004011bd <+13>: movl $0x1,0x20(%r8) 0x00000000004011c5 <+21>: mov %dx,0x62(%r8) 0x00000000004011ca <+26>: movl $0x1,0x64(%r8) 0x00000000004011d2 <+34>: mov %rsi,0x68(%r8) 0x00000000004011d6 <+38>: ret This is the code clang generates with the no-sse option applied: (gdb) disas bio_init3 Dump of assembler code for function bio_init3: 0x00000000004012c0 <+0>: movq $0x0,0x18(%rdi) 0x00000000004012c8 <+8>: movq $0x0,0x10(%rdi) 0x00000000004012d0 <+16>: movq $0x0,0x8(%rdi) 0x00000000004012d8 <+24>: movq $0x0,(%rdi) 0x00000000004012df <+31>: movl $0x1,0x20(%rdi) 0x00000000004012e6 <+38>: movq $0x0,0x24(%rdi) 0x00000000004012ee <+46>: movq $0x0,0x2c(%rdi) 0x00000000004012f6 <+54>: movq $0x0,0x34(%rdi) 0x00000000004012fe <+62>: movq $0x0,0x3c(%rdi) 0x0000000000401306 <+70>: movq $0x0,0x44(%rdi) 0x000000000040130e <+78>: movq $0x0,0x4c(%rdi) 0x0000000000401316 <+86>: movq $0x0,0x54(%rdi) 0x000000000040131e <+94>: movq $0x0,0x5a(%rdi) 0x0000000000401326 <+102>: mov %dx,0x62(%rdi) 0x000000000040132a <+106>: movl $0x1,0x64(%rdi) 0x0000000000401331 <+113>: mov %rsi,0x68(%rdi) 0x0000000000401335 <+117>: movq $0x0,0x70(%rdi) 0x000000000040133d <+125>: ret Is there any x86_64 CPU on which the latter code runs slower than the former?
next prev parent reply other threads:[~2021-09-13 2:57 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-12 21:59 [Bug c/102294] New: structure assignment slower than memberwise initialization bart.vanassche at gmail dot com 2021-09-12 22:17 ` [Bug middle-end/102294] " pinskia at gcc dot gnu.org 2021-09-13 1:41 ` bart.vanassche at gmail dot com 2021-09-13 1:43 ` bart.vanassche at gmail dot com 2021-09-13 1:59 ` pinskia at gcc dot gnu.org 2021-09-13 2:16 ` bart.vanassche at gmail dot com 2021-09-13 2:25 ` pinskia at gcc dot gnu.org 2021-09-13 2:57 ` bart.vanassche at gmail dot com [this message] 2021-09-13 3:06 ` [Bug middle-end/102294] memset expansion is sometimes slow for small sizes crazylht at gmail dot com 2021-09-13 3:21 ` bart.vanassche at gmail dot com 2021-09-13 3:28 ` crazylht at gmail dot com 2021-09-13 3:40 ` [Bug target/102294] " pinskia at gcc dot gnu.org 2021-09-13 13:37 ` hjl.tools at gmail dot com 2021-09-14 2:04 ` bart.vanassche at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-102294-4-25P8j9UhP1@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).