From: Nick Clifton <nickc@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: RX: Do not use SMOVF insn to move blocks of volatile memory.
Date: Wed, 13 Apr 2011 11:30:00 -0000 [thread overview]
Message-ID: <m3sjtme6co.fsf@redhat.com> (raw)
Hi Guys,
I am checking in the patch below to the 4.5 branch and mainline
sources to fix a problem with the RX's SMOVF instruction. This
instruction copies blocks of memory, but it always loads and stores
aligned 32-bit values. If necessary it will load extra bytes from the
beginning or end of the destination block in order to be able to write
back a whole word. This can be a problem if the destination block is
in the I/O address space and those extra bytes do not exist or must
not be read.
The patch fixes the problem by disabling the use of the SMOVF
instruction when volatile pointers are involved. In this case gcc
will be forced to use another method to copy the data, most likely a
loop of byte loads and stores.
Cheers
Nick
PS. I am not applying the patch to the 4.6 branch since it is already
present there.
gcc/ChangeLog
2011-04-13 Nick Clifton <nickc@redhat.com>
* config/rx/rx.md (movmemsi): Do not use this pattern when
volatile pointers are involved.
Index: gcc/config/rx/rx.md
===================================================================
--- gcc/config/rx/rx.md (revision 170734)
+++ gcc/config/rx/rx.md (working copy)
@@ -1897,6 +1897,14 @@
rtx addr2 = gen_rtx_REG (SImode, 2);
rtx len = gen_rtx_REG (SImode, 3);
+ /* Do not use when the source or destination are volatile - the SMOVF
+ instruction will read and write in word sized blocks, which may be
+ outside of the valid address range. */
+ if (MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0]))
+ FAIL;
+ if (MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))
+ FAIL;
+
if (REG_P (operands[0]) && (REGNO (operands[0]) == 2
|| REGNO (operands[0]) == 3))
FAIL;
reply other threads:[~2011-04-13 11:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=m3sjtme6co.fsf@redhat.com \
--to=nickc@redhat.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).