]> gcc.gnu.org Git - gcc.git/commitdiff
(store_field): If signed bitfield and want value, sign extend.
authorRichard Stallman <rms@gnu.org>
Sun, 18 Oct 1992 05:09:47 +0000 (05:09 +0000)
committerRichard Stallman <rms@gnu.org>
Sun, 18 Oct 1992 05:09:47 +0000 (05:09 +0000)
From-SVN: r2504

gcc/expr.c

index a9c6ff1c711ab4da2d4a3242832beb991e8abfc3..db911c87acb6c27cb4193b8208141a31c8a4b191 100644 (file)
@@ -2702,7 +2702,16 @@ store_field (target, bitsize, bitpos, mode, exp, value_mode,
          /* If possible, avoid refetching from the bitfield itself.  */
          if (width_mask != 0
              && ! (GET_CODE (target) == MEM && MEM_VOLATILE_P (target)))
-           return expand_and (temp, GEN_INT (width_mask), NULL_RTX);
+           {
+             rtx count;
+             enum machine_mode tmode;
+             if (unsignedp)
+               return expand_and (temp, GEN_INT (width_mask), NULL_RTX);
+             tmode = GET_MODE (temp);
+             count = build_int_2 (GET_MODE_BITSIZE (tmode) - bitsize, 0);
+             temp = expand_shift (LSHIFT_EXPR, tmode, temp, count, 0, 0);
+             return expand_shift (RSHIFT_EXPR, tmode, temp, count, 0, 0);
+           }
          return extract_bit_field (target, bitsize, bitpos, unsignedp,
                                    NULL_RTX, value_mode, 0, align,
                                    total_size);
This page took 0.081095 seconds and 5 git commands to generate.