]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Revert one of the force_subreg changes
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 25 Jun 2024 08:41:21 +0000 (09:41 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 25 Jun 2024 08:41:21 +0000 (09:41 +0100)
One of the changes in g:d4047da6a070175aae7121c739d1cad6b08ff4b2
caused a regression in ft32-elf; see:

    https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655418.html

for details.  This change was different from the others in that the
original call was to simplify_subreg rather than simplify_lowpart_subreg.
The old code would therefore go on to do the force_reg for more cases
than the new code would.

gcc/
* expmed.cc (store_bit_field_using_insv): Revert earlier change
to use force_subreg instead of simplify_gen_subreg.

gcc/expmed.cc

index 3b9475f5aa0beee1da94119af0e63f56a334ce01..8bbbc94a98cb81a34950dfed53eef0f0ca2133bd 100644 (file)
@@ -695,7 +695,13 @@ store_bit_field_using_insv (const extraction_insn *insv, rtx op0,
             if we must narrow it, be sure we do it correctly.  */
 
          if (GET_MODE_SIZE (value_mode) < GET_MODE_SIZE (op_mode))
-           tmp = force_subreg (op_mode, value1, value_mode, 0);
+           {
+             tmp = simplify_subreg (op_mode, value1, value_mode, 0);
+             if (! tmp)
+               tmp = simplify_gen_subreg (op_mode,
+                                          force_reg (value_mode, value1),
+                                          value_mode, 0);
+           }
          else
            {
              if (targetm.mode_rep_extended (op_mode, value_mode) != UNKNOWN)