This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix handling of REDUCE_BIT_FIELD in NOP_EXPR
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: rth at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 24 Nov 04 17:54:28 EST
- Subject: Fix handling of REDUCE_BIT_FIELD in NOP_EXPR
Again, I can't read which ACATS test this fixes, but we discussed it
a while ago. Do you agree this is the correct fix?
Tested on x86_64-linux-gnu.
2004-11-24 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expr.c (expand_expr_real_1, case NOP_EXPR): Properly handle
REDUCE_BIT_FIELD by applying it to result, not input, to conversion.
*** expr.c 24 Nov 2004 11:41:29 -0000 1.743
--- expr.c 24 Nov 2004 14:54:53 -0000
*************** expand_expr_real_1 (tree exp, rtx target
*** 7254,7263 ****
op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, modifier);
- op0 = REDUCE_BIT_FIELD (op0);
if (GET_MODE (op0) == mode)
! return op0;
/* If OP0 is a constant, just convert it into the proper mode. */
! if (CONSTANT_P (op0))
{
tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
--- 7242,7250 ----
op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, modifier);
if (GET_MODE (op0) == mode)
! ;
/* If OP0 is a constant, just convert it into the proper mode. */
! else if (CONSTANT_P (op0))
{
tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
*************** expand_expr_real_1 (tree exp, rtx target
*** 7265,7287 ****
if (modifier == EXPAND_INITIALIZER)
! return simplify_gen_subreg (mode, op0, inner_mode,
! subreg_lowpart_offset (mode,
! inner_mode));
else
! return convert_modes (mode, inner_mode, op0,
! TYPE_UNSIGNED (inner_type));
}
! if (modifier == EXPAND_INITIALIZER)
! return gen_rtx_fmt_e (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, mode, op0);
! if (target == 0)
! return
! convert_to_mode (mode, op0,
! TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
else
! convert_move (target, op0,
! TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
! return target;
case VIEW_CONVERT_EXPR:
--- 7252,7278 ----
if (modifier == EXPAND_INITIALIZER)
! op0 = simplify_gen_subreg (mode, op0, inner_mode,
! subreg_lowpart_offset (mode,
! inner_mode));
else
! op0= convert_modes (mode, inner_mode, op0,
! TYPE_UNSIGNED (inner_type));
}
! else if (modifier == EXPAND_INITIALIZER)
! op0 = gen_rtx_fmt_e (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, mode, op0);
! else if (target == 0)
! op0 = convert_to_mode (mode, op0,
! TYPE_UNSIGNED (TREE_TYPE
! (TREE_OPERAND (exp, 0))));
else
! {
! convert_move (target, op0,
! TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
! op0 = target;
! }
!
! return REDUCE_BIT_FIELD (op0);
case VIEW_CONVERT_EXPR: