aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtlhooks.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rtlhooks.c')
-rw-r--r--gcc/rtlhooks.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/gcc/rtlhooks.c b/gcc/rtlhooks.c
index 4d04ebd..d20815e 100644
--- a/gcc/rtlhooks.c
+++ b/gcc/rtlhooks.c
@@ -59,8 +59,6 @@ gen_lowpart_general (machine_mode mode, rtx x)
}
else
{
- int offset = 0;
-
/* The only additional case we can do is MEM. */
gcc_assert (MEM_P (x));
@@ -72,16 +70,7 @@ gen_lowpart_general (machine_mode mode, rtx x)
&& !reload_completed)
return gen_lowpart_general (mode, force_reg (xmode, x));
- if (WORDS_BIG_ENDIAN)
- offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
-
- if (BYTES_BIG_ENDIAN)
- /* Adjust the address so that the address-after-the-data
- is unchanged. */
- offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
-
+ HOST_WIDE_INT offset = byte_lowpart_offset (mode, GET_MODE (x));
return adjust_address (x, mode, offset);
}
}
@@ -126,19 +115,8 @@ gen_lowpart_if_possible (machine_mode mode, rtx x)
else if (MEM_P (x))
{
/* This is the only other case we handle. */
- int offset = 0;
- rtx new_rtx;
-
- if (WORDS_BIG_ENDIAN)
- offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
- if (BYTES_BIG_ENDIAN)
- /* Adjust the address so that the address-after-the-data is
- unchanged. */
- offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
-
- new_rtx = adjust_address_nv (x, mode, offset);
+ HOST_WIDE_INT offset = byte_lowpart_offset (mode, GET_MODE (x));
+ rtx new_rtx = adjust_address_nv (x, mode, offset);
if (! memory_address_addr_space_p (mode, XEXP (new_rtx, 0),
MEM_ADDR_SPACE (x)))
return 0;