public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/30778] [4.3 Regression] invalid code generation for memset() with -mtune=k8 Date: Sat, 24 Feb 2007 10:59:00 -0000 [thread overview] Message-ID: <20070224105901.2612.qmail@sourceware.org> (raw) In-Reply-To: <bug-30778-7958@http.gcc.gnu.org/bugzilla/> ------- Comment #3 from ubizjak at gmail dot com 2007-02-24 10:59 ------- I'm currently testing this patch: 2007-02-24 Uros Bizjak <ubizjak@gmail.com> * config/i386/i386.md (expand_set_or_movmem_via_loop): Return if GET_MODE_SIZE (mode) * unroll is less than expected_size. testsuite/ChangeLog: 2007-02-24 Uros Bizjak <ubizjak@gmail.com> * gcc.target/i386/pr30778.c: New test. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 122286) +++ config/i386/i386.c (working copy) @@ -13315,13 +13315,19 @@ { rtx out_label, top_label, iter, tmp; enum machine_mode iter_mode; - rtx piece_size = GEN_INT (GET_MODE_SIZE (mode) * unroll); - rtx piece_size_mask = GEN_INT (~((GET_MODE_SIZE (mode) * unroll) - 1)); + HOST_WIDE_INT min_size = GET_MODE_SIZE (mode) * unroll; + rtx piece_size = GEN_INT (min_size); + rtx piece_size_mask = GEN_INT (~min_size - 1); rtx size; rtx x_addr; rtx y_addr; int i; + /* Bail out if expected size is less than minimum size + that can be emitted. */ + if (expected_size < min_size) + return; + iter_mode = GET_MODE (count); if (iter_mode == VOIDmode) iter_mode = word_mode; There is also an optimization opportunity. When compiling testcase to 32bit code (with -m32 -O2 -mtune=k8), following is generated: init_reg_last: pushl %ebp movl reg_stat, %edx xorl %eax, %eax movl %esp, %ebp .L2: movl $0, (%edx,%eax) movl $0, 4(%edx,%eax) movl $0, 8(%edx,%eax) movl $0, 12(%edx,%eax) addl $16, %eax cmpl $16, %eax <<< not needed jb .L2 <<< not needed addl %eax, %edx movw $0, (%edx) movb $0, 2(%edx) leave ret We don't need to create loop in this case, as this loop will be executed only once. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30778
next prev parent reply other threads:[~2007-02-24 10:59 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-02-12 19:03 [Bug middle-end/30778] New: " belyshev at depni dot sinp dot msu dot ru 2007-02-12 19:22 ` [Bug target/30778] " pinskia at gcc dot gnu dot org 2007-02-13 9:44 ` rguenth at gcc dot gnu dot org 2007-02-16 2:01 ` pinskia at gcc dot gnu dot org 2007-02-24 8:53 ` ubizjak at gmail dot com 2007-02-24 10:59 ` ubizjak at gmail dot com [this message] 2007-02-24 22:55 ` ubizjak at gmail dot com 2007-02-24 23:09 ` hubicka at gcc dot gnu dot org 2007-02-24 23:24 ` ubizjak at gmail dot com 2007-02-24 23:47 ` hubicka at gcc dot gnu dot org 2007-02-25 7:54 ` ubizjak at gmail dot com 2007-02-25 17:37 ` hubicka at gcc dot gnu dot org 2007-02-26 7:04 ` ubizjak 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=20070224105901.2612.qmail@sourceware.org \ --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).