aboutsummaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-10-13 09:23:54 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-10-13 09:23:54 +0000
commit610c45fcbfff43176beefefcea74c6137a432220 (patch)
treefc56c08135f71cfb00cb65322910c3e569682d8e /gcc/calls.c
parent5752d1f7943db65667edeaf8481dc10b60a23197 (diff)
downloadgcc-610c45fcbfff43176beefefcea74c6137a432220.zip
gcc-610c45fcbfff43176beefefcea74c6137a432220.tar.gz
gcc-610c45fcbfff43176beefefcea74c6137a432220.tar.bz2
Make more use of subreg_lowpart_offset
This patch uses subreg_lowpart_offset in places that open-coded the calculation. It also uses it in regcprop.c to test whether, after a mode change, the first register in a multi-register group is still the right one. 2017-10-13 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * calls.c (expand_call): Use subreg_lowpart_offset. * cse.c (cse_insn): Likewise. * regcprop.c (copy_value): Likewise. (copyprop_hardreg_forward_1): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r253713
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index 4d54fc6..7ed05d4 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -4117,7 +4117,6 @@ expand_call (tree exp, rtx target, int ignore)
{
tree type = rettype;
int unsignedp = TYPE_UNSIGNED (type);
- int offset = 0;
machine_mode pmode;
/* Ensure we promote as expected, and get the new unsignedness. */
@@ -4125,18 +4124,8 @@ expand_call (tree exp, rtx target, int ignore)
funtype, 1);
gcc_assert (GET_MODE (target) == pmode);
- if ((WORDS_BIG_ENDIAN || BYTES_BIG_ENDIAN)
- && (GET_MODE_SIZE (GET_MODE (target))
- > GET_MODE_SIZE (TYPE_MODE (type))))
- {
- offset = GET_MODE_SIZE (GET_MODE (target))
- - GET_MODE_SIZE (TYPE_MODE (type));
- if (! BYTES_BIG_ENDIAN)
- offset = (offset / UNITS_PER_WORD) * UNITS_PER_WORD;
- else if (! WORDS_BIG_ENDIAN)
- offset %= UNITS_PER_WORD;
- }
-
+ unsigned int offset = subreg_lowpart_offset (TYPE_MODE (type),
+ GET_MODE (target));
target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset);
SUBREG_PROMOTED_VAR_P (target) = 1;
SUBREG_PROMOTED_SET (target, unsignedp);