summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2017-08-24 07:47:13 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2017-08-24 07:47:13 +0000
commit451feb44909370bd13adf4628d2c8301ae1c22ea (patch)
tree6f855d2a1086c19ac74a86f0dfd87f1b2704e4b5 /gcc/combine.c
parentd57391ef86276d81044bd64437289ab92bb887c6 (diff)
downloadgcc-451feb44909370bd13adf4628d2c8301ae1c22ea.tar.gz
Make more use of subreg_offset_from_lsb
This patch makes use of the subreg_offset_from_lsb function added by an earlier patch in the SVE series. 2017-08-24 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * combine.c (make_extraction): Use subreg_offset_from_lsb. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251326 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 7aa0a359f48..b34fb81c97a 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -7488,26 +7488,15 @@ make_extraction (machine_mode mode, rtx inner, HOST_WIDE_INT pos,
return a new hard register. */
if (pos || in_dest)
{
- HOST_WIDE_INT final_word = pos / BITS_PER_WORD;
-
- if (WORDS_BIG_ENDIAN
- && GET_MODE_SIZE (inner_mode) > UNITS_PER_WORD)
- final_word = ((GET_MODE_SIZE (inner_mode)
- - GET_MODE_SIZE (tmode))
- / UNITS_PER_WORD) - final_word;
-
- final_word *= UNITS_PER_WORD;
- if (BYTES_BIG_ENDIAN &&
- GET_MODE_SIZE (inner_mode) > GET_MODE_SIZE (tmode))
- final_word += (GET_MODE_SIZE (inner_mode)
- - GET_MODE_SIZE (tmode)) % UNITS_PER_WORD;
+ unsigned int offset
+ = subreg_offset_from_lsb (tmode, inner_mode, pos);
/* Avoid creating invalid subregs, for example when
simplifying (x>>32)&255. */
- if (!validate_subreg (tmode, inner_mode, inner, final_word))
+ if (!validate_subreg (tmode, inner_mode, inner, offset))
return NULL_RTX;
- new_rtx = gen_rtx_SUBREG (tmode, inner, final_word);
+ new_rtx = gen_rtx_SUBREG (tmode, inner, offset);
}
else
new_rtx = gen_lowpart (tmode, inner);