This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[wide-int] Remove SHIFT_COUNT_TRUNCATED uses at tree/gimple level
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: zadeck at naturalbridge dot com, mikestump at comcast dot net, rguenther at suse dot de
- Date: Wed, 06 Nov 2013 22:10:33 +0000
- Subject: [wide-int] Remove SHIFT_COUNT_TRUNCATED uses at tree/gimple level
- Authentication-results: sourceware.org; auth=none
Following the removal of SHIFT_COUNT_TRUNCATED from double-int, this patch
reverts the changed I'd made to mimic the old behaviour on wide-int.
Tested on powerpc64-linux-gnu and by assembly comparison on a range of targets.
OK to install?
Thanks,
Richard
Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c 2013-11-05 13:06:56.985255941 +0000
+++ gcc/fold-const.c 2013-11-05 13:12:28.805655903 +0000
@@ -1007,13 +1007,9 @@ int_const_binop_1 (enum tree_code code,
/* It's unclear from the C standard whether shifts can overflow.
The following code ignores overflow; perhaps a C standard
interpretation ruling is needed. */
- res = wi::rshift (arg1, arg2, sign,
- SHIFT_COUNT_TRUNCATED
- ? GET_MODE_BITSIZE (TYPE_MODE (type)) : 0);
+ res = wi::rshift (arg1, arg2, sign);
else
- res = wi::lshift (arg1, arg2,
- SHIFT_COUNT_TRUNCATED
- ? GET_MODE_BITSIZE (TYPE_MODE (type)) : 0);
+ res = wi::lshift (arg1, arg2);
break;
case RROTATE_EXPR:
Index: gcc/tree-ssa-ccp.c
===================================================================
--- gcc/tree-ssa-ccp.c 2013-11-05 13:07:25.659474362 +0000
+++ gcc/tree-ssa-ccp.c 2013-11-05 13:12:28.806655910 +0000
@@ -1272,20 +1272,15 @@ bit_value_binop_1 (enum tree_code code,
else
code = RSHIFT_EXPR;
}
- int shift_precision = SHIFT_COUNT_TRUNCATED ? width : 0;
if (code == RSHIFT_EXPR)
{
- *mask = wi::rshift (wi::ext (r1mask, width, sgn),
- shift, sgn, shift_precision);
- *val = wi::rshift (wi::ext (r1val, width, sgn),
- shift, sgn, shift_precision);
+ *mask = wi::rshift (wi::ext (r1mask, width, sgn), shift, sgn);
+ *val = wi::rshift (wi::ext (r1val, width, sgn), shift, sgn);
}
else
{
- *mask = wi::ext (wi::lshift (r1mask, shift, shift_precision),
- width, sgn);
- *val = wi::ext (wi::lshift (r1val, shift, shift_precision),
- width, sgn);
+ *mask = wi::ext (wi::lshift (r1mask, shift), width, sgn);
+ *val = wi::ext (wi::lshift (r1val, shift), width, sgn);
}
}
}