summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-15 11:13:04 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-15 11:13:04 +0000
commit9e527b97e3bf28ac48240500fc078b4f1d4c8af7 (patch)
tree5c3d481d792fb5e4774cbae90ba4d86701a9ca24 /gcc/expmed.c
parent3024e9f8b3c2dc22bbbab8133a7cbf290a7c411c (diff)
downloadgcc-9e527b97e3bf28ac48240500fc078b4f1d4c8af7.tar.gz
* expmed.c (store_bit_field): Consider naturally aligned
memory for direct reference. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36431 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 606333fdbe3..e2ca70a13ab 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -297,19 +297,22 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size)
if (flag_force_mem)
value = force_not_mem (value);
- if ((GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
- || (GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode)
- && GET_MODE_SIZE (fieldmode) != 0))
- && (GET_CODE (op0) != MEM
- || ! SLOW_UNALIGNED_ACCESS (fieldmode, align)
- || (offset * BITS_PER_UNIT % bitsize == 0
- && align % GET_MODE_BITSIZE (fieldmode) == 0))
- && (BYTES_BIG_ENDIAN ? bitpos + bitsize == unit : bitpos == 0)
- && bitsize == GET_MODE_BITSIZE (fieldmode))
+ /* If the target is a register, overwriting the entire object, or storing
+ a full-word or multi-word field can be done with just a SUBREG.
+
+ If the target is memory, storing any naturally aligned field can be
+ done with a simple store. For targets that support fast unaligned
+ memory, any naturally sized, unit aligned field can be done directly. */
+
+ if (bitsize == GET_MODE_BITSIZE (fieldmode)
+ && (GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
+ || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode)
+ || (GET_CODE (op0) == MEM
+ && (! SLOW_UNALIGNED_ACCESS (fieldmode, align)
+ || (offset * BITS_PER_UNIT % bitsize == 0
+ && align % GET_MODE_BITSIZE (fieldmode) == 0))))
+ && (BYTES_BIG_ENDIAN ? bitpos + bitsize == unit : bitpos == 0))
{
- /* Storing in a full-word or multi-word field in a register
- can be done with just SUBREG. Also, storing in the entire object
- can be done with just SUBREG. */
if (GET_MODE (op0) != fieldmode)
{
if (GET_CODE (op0) == SUBREG)