From: Richard Sandiford <richard.sandiford@arm.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: Support << and >> for offset_int and widest_int
Date: Mon, 02 May 2016 09:38:00 -0000 [thread overview]
Message-ID: <878tzsg5qp.fsf@e105548-lin.cambridge.arm.com> (raw)
In-Reply-To: <CAMe9rOq1B1MgaWSb+z9CCZ6=PPPGqEjmjH6RfeykTp80X7hZiw@mail.gmail.com> (H. J. Lu's message of "Fri, 29 Apr 2016 05:37:28 -0700")
"H.J. Lu" <hjl.tools@gmail.com> writes:
> 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.
The patch doesn't add wide_int shift operators since wide_ints have no
sign. You need to use wi:: shift routines for them instead. However,
there's already a wi::mask function for creating this kind of value
directly.
Like you say, the PR is about converting other code to use wi::, which
is very different from what this patch is doing. I'll take the PR
anyway though. Hope to post a patch on Wednesday.
It also looks like the code is missing a check that the ZERO_EXTEND mode
is scalar, since the transformation would be incorrect for vectors.
Thanks,
Richard
next prev parent reply other threads:[~2016-05-02 9:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 12:30 Richard Sandiford
2016-04-29 12:37 ` H.J. Lu
2016-05-02 9:38 ` Richard Sandiford [this message]
2016-05-02 8:53 ` Richard Biener
-- strict thread matches above, loose matches on Subject: below --
2016-04-29 12:26 Support <, <=, > and >= " Richard Sandiford
2016-05-02 8:50 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878tzsg5qp.fsf@e105548-lin.cambridge.arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).