aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-dfa.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2016-05-02 09:39:38 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2016-05-02 09:39:38 +0000
commit8de73453a42758af02bb23ed58f4b1e78ad11bc7 (patch)
treeea2f8d60c73117cebcd97dfbc56bb80d7c4ee632 /gcc/tree-dfa.c
parent032c80e999eac4288ff1b0f752e15c8e7c5cdf51 (diff)
downloadgcc-8de73453a42758af02bb23ed58f4b1e78ad11bc7.zip
gcc-8de73453a42758af02bb23ed58f4b1e78ad11bc7.tar.gz
gcc-8de73453a42758af02bb23ed58f4b1e78ad11bc7.tar.bz2
Support << and >> for offset_int and widest_int
Following on from the comparison patch, I think it makes sense to support << and >> for offset_int (int128_t) and widest_int (intNNN_t), with >> being arithmetic shift. It doesn't make sense to use logical right shift on a potentially negative offset_int, since the precision of 128 bits has no meaning on the target. Tested on x86_64-linux-gnu and aarch64-linux-gnu. gcc/ * wide-int.h: Update offset_int and widest_int documentation. (WI_SIGNED_SHIFT_RESULT): New macro. (wi::binary_shift): Define signed_shift_result_type for shifts on offset_int- and widest_int-like types. (generic_wide_int): Support <<= and >>= if << and >> are supported. * tree.h (int_bit_position): Use shift operators instead of wi:: shifts. * alias.c (adjust_offset_for_component_ref): Likewise. * expr.c (get_inner_reference): Likewise. * fold-const.c (fold_comparison): Likewise. * gimple-fold.c (fold_nonarray_ctor_reference): Likewise. * gimple-ssa-strength-reduction.c (restructure_reference): Likewise. * tree-dfa.c (get_ref_base_and_extent): Likewise. * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Likewise. (stmt_kills_ref_p): Likewise. * tree-ssa-ccp.c (bit_value_binop_1): Likewise. * tree-ssa-math-opts.c (find_bswap_or_nop_load): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Likewise. (ao_ref_init_from_vn_reference): Likewise. gcc/cp/ * init.c (build_new_1): Use shift operators instead of wi:: shifts. From-SVN: r235720
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r--gcc/tree-dfa.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index f133abc..f6986c1 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -424,8 +424,8 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (this_offset && TREE_CODE (this_offset) == INTEGER_CST)
{
- offset_int woffset = wi::lshift (wi::to_offset (this_offset),
- LOG2_BITS_PER_UNIT);
+ offset_int woffset = (wi::to_offset (this_offset)
+ << LOG2_BITS_PER_UNIT);
woffset += wi::to_offset (DECL_FIELD_BIT_OFFSET (field));
bit_offset += woffset;
@@ -453,7 +453,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
{
offset_int tem = (wi::to_offset (ssize)
- wi::to_offset (fsize));
- tem = wi::lshift (tem, LOG2_BITS_PER_UNIT);
+ tem <<= LOG2_BITS_PER_UNIT;
tem -= woffset;
maxsize += tem;
}
@@ -493,7 +493,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
= wi::sext (wi::to_offset (index) - wi::to_offset (low_bound),
TYPE_PRECISION (TREE_TYPE (index)));
woffset *= wi::to_offset (unit_size);
- woffset = wi::lshift (woffset, LOG2_BITS_PER_UNIT);
+ woffset <<= LOG2_BITS_PER_UNIT;
bit_offset += woffset;
/* An array ref with a constant index up in the structure
@@ -570,7 +570,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
else
{
offset_int off = mem_ref_offset (exp);
- off = wi::lshift (off, LOG2_BITS_PER_UNIT);
+ off <<= LOG2_BITS_PER_UNIT;
off += bit_offset;
if (wi::fits_shwi_p (off))
{