This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Support << and >> for offset_int and widest_int
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Sandiford <richard dot sandiford at arm dot com>
- Date: Fri, 29 Apr 2016 05:37:28 -0700
- Subject: Re: Support << and >> for offset_int and widest_int
- Authentication-results: sourceware.org; auth=none
- References: <87lh3wfvhk dot fsf at e105548-lin dot cambridge dot arm dot com>
On Fri, Apr 29, 2016 at 5:30 AM, Richard Sandiford
<richard.sandiford@arm.com> wrote:
> 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. OK to install?
>
> Thanks,
> Richard
>
>
> 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.
Can you also update change_zero_ext in combine.c:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70687
It should use wide_int << instead of HOST_WIDE_INT <<< to
support __int128.
--
H.J.