From: "Uros Bizjak" <ubizjak@gmail.com>
To: "GCC Patches" <gcc-patches@gcc.gnu.org>
Cc: "Nathan Froyd" <froydnj@codesourcery.com>
Subject: Re: [PATCH,i386] fix PR 11001
Date: Thu, 04 Oct 2007 06:34:00 -0000 [thread overview]
Message-ID: <5787cf470710032334y2aefe839x8981f4c84b9a2662@mail.gmail.com> (raw)
Hello!
> The fix is to ensure that the registers are available before generating
> the instructions. Note that the code is not optimal: in the memset
> case, for instance, if we choose an inlining strategy requiring 'rep
> stosl' and then discover that the necessary registers are not available,
> we generate a full call to 'memset' rather than generating an inline
> copy loop. I don't see this as a serious defect; if you are using
> register globals on the x86, you deserve a performance penalty.
> Index: gcc/config/i386/i386.c
> ===================================================================
> --- gcc/config/i386/i386.c (revision 128981)
> +++ gcc/config/i386/i386.c (working copy)
> @@ -15286,6 +15286,13 @@ ix86_expand_movmem (rtx dst, rtx src, rt
> break;
> }
>
> + /* Can't use this if the user has appropriated ecx, esi, or edi. */
> + if ((alg == rep_prefix_1_byte
> + || alg == rep_prefix_4_byte
> + || alg == rep_prefix_8_byte)
> + && (global_regs[2] || global_regs[4] || global_regs[5]))
> + return 0;
> +
I think that you should put this check into decide_alg(). There you
can decide between copy loop and libcall, also taking into account
optimize_size flag, as well as TARGET_INLINE_ALL_STRINGOPS and
TARGET_INLINE_ALL_STRINGOPS_DYNAMICALLY.
Please note, that rep_prefix_* algorithms are used for larger blocks.
Perhaps in your case, we should scan algorithms table backwards until
we hit other non-rep_prefix algorithm. If we found none, we should
default to a loop algorithm for optimize_size or to a libcall for
other cases.
Uros.
next reply other threads:[~2007-10-04 6:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-04 6:34 Uros Bizjak [this message]
2007-10-04 20:55 ` Nathan Froyd
2007-10-05 5:59 ` Uros Bizjak
2007-10-12 16:13 ` Nathan Froyd
2007-10-12 16:40 ` H.J. Lu
2007-10-12 17:13 ` Nathan Froyd
2007-10-12 17:28 ` Uros Bizjak
2007-10-12 19:34 ` H.J. Lu
2007-10-12 19:40 ` Nathan Froyd
-- strict thread matches above, loose matches on Subject: below --
2007-10-12 17:26 Uros Bizjak
2007-10-03 15:01 Nathan Froyd
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=5787cf470710032334y2aefe839x8981f4c84b9a2662@mail.gmail.com \
--to=ubizjak@gmail.com \
--cc=froydnj@codesourcery.com \
--cc=gcc-patches@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: link
Be 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).