Make more use of subreg_offset_from_lsb
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 24 Aug 2017 07:47:13 +0000 (07:47 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 24 Aug 2017 07:47:13 +0000 (07:47 +0000)
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.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251326

gcc/ChangeLog
gcc/combine.c

index 96aa15157822b0d469824e807795ebfb65b0ec10..d448aae131281c6f79bd22efe7aae29ac46697cd 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-24  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * combine.c (make_extraction): Use subreg_offset_from_lsb.
+
 2017-08-23  Daniel Santos  <daniel.santos@pobox.com>
 
        * config/i386/i386.h (ix86_frame::stack_realign_allocate_offset):
index 7aa0a359f489bc8d9ccb6227b852cfe90f20e98c..b34fb81c97a830f8598e84c8d677af9fefe3a290 100644 (file)
@@ -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);