This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: wide-int, C++ front end
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Mike Stump <mikestump at comcast dot net>, "gcc-patches\ at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>, Kenneth Zadeck <zadeck at naturalbridge dot com>
- Date: Mon, 25 Nov 2013 20:05:11 +0000
- Subject: Re: wide-int, C++ front end
- Authentication-results: sourceware.org; auth=none
- References: <E2C6331E-1CDC-48FC-ADB5-42623433F232 at comcast dot net> <52915DC7 dot 1000200 at redhat dot com>
Jason Merrill <jason@redhat.com> writes:
> On 11/23/2013 02:20 PM, Mike Stump wrote:
>> @@ -2605,8 +2606,7 @@ cp_tree_equal (tree t1, tree t2)
>> switch (code1)
>> {
>> case INTEGER_CST:
>> - return TREE_INT_CST_LOW (t1) == TREE_INT_CST_LOW (t2)
>> - && TREE_INT_CST_HIGH (t1) == TREE_INT_CST_HIGH (t2);
>> + return wi::to_widest (t1) == wi::to_widest (t2);
>
> Why not use wi::eq_p like you do in the C front end?
Thanks for noticing the difference. I think c_tree_equal should change
to use to_widest too.
wi::eq_p (t1, t2) asserts that t1 and t2 are the same precision and
ignores signedness; it just tests whether they are the same bitstring.
wi::to_widest (t1) == wi::to_widest (t2) compares them as logical numbers,
taking sign into account and allowing different types. I think that's
what the original TREE_INT_CST_LOW and TREE_INT_CST_HIGH tests did too.
Richard