This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Add check back to expmed.c
> I'd prefer that you at least attempt to simplify first. I.e.
Ok. How about this then...
-eric
--
I will not use abbrev.
2002-02-21 Eric Christopher <echristo@redhat.com>
* expmed.c (store_bit_field): Try to simplify the subreg
before generating a new one when when the mode size of
value is less than maxmode.
Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.106
diff -u -p -w -r1.106 expmed.c
--- expmed.c 2002/02/20 13:53:13 1.106
+++ expmed.c 2002/02/21 23:51:21
@@ -630,8 +630,17 @@ store_bit_field (str_rtx, bitsize, bitnu
if we must narrow it, be sure we do it correctly. */
if (GET_MODE_SIZE (GET_MODE (value)) < GET_MODE_SIZE (maxmode))
- value1 = simplify_gen_subreg (maxmode, value1,
- GET_MODE (value1), 0);
+ {
+ rtx tmp;
+
+ tmp = simplify_subreg (maxmode, value1, GET_MODE (value), 0);
+ if (! tmp)
+ tmp = simplify_gen_subreg (maxmode,
+ force_reg (GET_MODE (value),
+ value1),
+ GET_MODE (value), 0);
+ value1 = tmp;
+ }
else
value1 = gen_lowpart (maxmode, value1);
}