expr.c (optimize_bitfield_assignment_op): Use str_mode and str_bitsize instead of...
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 24 Mar 2012 18:58:16 +0000 (18:58 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 24 Mar 2012 18:58:16 +0000 (18:58 +0000)
* expr.c (optimize_bitfield_assignment_op) <BIT_IOR_EXPR>: Use str_mode
and str_bitsize instead of more convoluted expressions.

From-SVN: r185767

gcc/ChangeLog
gcc/expr.c

index 24f316e..9981622 100644 (file)
@@ -1,5 +1,10 @@
 2012-03-24  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * expr.c (optimize_bitfield_assignment_op) <BIT_IOR_EXPR>: Use str_mode
+       and str_bitsize instead of more convoluted expressions.
+
+2012-03-24  Eric Botcazou  <ebotcazou@adacore.com>
+
        PR target/52610
        * config/sparc/sparc.h (ASM_CPU_SPEC): Pass -Av8 if -mcpu=leon.
 
index f9de908..f509bf0 100644 (file)
@@ -4387,8 +4387,7 @@ optimize_bitfield_assignment_op (unsigned HOST_WIDE_INT bitsize,
          value = expand_and (str_mode, value, const1_rtx, NULL);
          binop = xor_optab;
        }
-      value = expand_shift (LSHIFT_EXPR, str_mode, value,
-                           bitpos, NULL_RTX, 1);
+      value = expand_shift (LSHIFT_EXPR, str_mode, value, bitpos, NULL_RTX, 1);
       result = expand_binop (str_mode, binop, str_rtx,
                             value, str_rtx, 1, OPTAB_WIDEN);
       if (result != str_rtx)
@@ -4399,8 +4398,8 @@ optimize_bitfield_assignment_op (unsigned HOST_WIDE_INT bitsize,
     case BIT_XOR_EXPR:
       if (TREE_CODE (op1) != INTEGER_CST)
        break;
-      value = expand_expr (op1, NULL_RTX, GET_MODE (str_rtx), EXPAND_NORMAL);
-      value = convert_modes (GET_MODE (str_rtx),
+      value = expand_expr (op1, NULL_RTX, str_mode, EXPAND_NORMAL);
+      value = convert_modes (str_mode,
                             TYPE_MODE (TREE_TYPE (op1)), value,
                             TYPE_UNSIGNED (TREE_TYPE (op1)));
 
@@ -4414,16 +4413,13 @@ optimize_bitfield_assignment_op (unsigned HOST_WIDE_INT bitsize,
        }
 
       binop = code == BIT_IOR_EXPR ? ior_optab : xor_optab;
-      if (bitpos + bitsize != GET_MODE_BITSIZE (GET_MODE (str_rtx)))
+      if (bitpos + bitsize != str_bitsize)
        {
-         rtx mask = GEN_INT (((unsigned HOST_WIDE_INT) 1 << bitsize)
-                             - 1);
-         value = expand_and (GET_MODE (str_rtx), value, mask,
-                             NULL_RTX);
+         rtx mask = GEN_INT (((unsigned HOST_WIDE_INT) 1 << bitsize) - 1);
+         value = expand_and (str_mode, value, mask, NULL_RTX);
        }
-      value = expand_shift (LSHIFT_EXPR, GET_MODE (str_rtx), value,
-                           bitpos, NULL_RTX, 1);
-      result = expand_binop (GET_MODE (str_rtx), binop, str_rtx,
+      value = expand_shift (LSHIFT_EXPR, str_mode, value, bitpos, NULL_RTX, 1);
+      result = expand_binop (str_mode, binop, str_rtx,
                             value, str_rtx, 1, OPTAB_WIDEN);
       if (result != str_rtx)
        emit_move_insn (str_rtx, result);
@@ -6348,8 +6344,7 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
                             GET_MODE_BITSIZE (GET_MODE (temp)) - bitsize,
                             NULL_RTX, 1);
 
-      /* Unless MODE is VOIDmode or BLKmode, convert TEMP to
-        MODE.  */
+      /* Unless MODE is VOIDmode or BLKmode, convert TEMP to MODE.  */
       if (mode != VOIDmode && mode != BLKmode
          && mode != TYPE_MODE (TREE_TYPE (exp)))
        temp = convert_modes (mode, TYPE_MODE (TREE_TYPE (exp)), temp, 1);