public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: nathan@codesourcery.com, gcc-patches@gcc.gnu.org
Subject: Re: __intN patch 3/5: main __int128 -> __intN conversion.
Date: Thu, 02 Oct 2014 03:52:00 -0000	[thread overview]
Message-ID: <201410020352.s923qLlm002274@greed.delorie.com> (raw)
In-Reply-To: <542CC4FA.70609@redhat.com> (message from Jason Merrill on Wed,	01 Oct 2014 23:22:34 -0400)


> It seems like the int128 code here was broken and this is continuing 
> that brokenness.  Extended integer types have integer conversion rank 
> corresponding to their bitsize, so int128 should have higher rank than 
> long long, but here it was being checked after long long, and your code 
> also follows the long long code.  Also, we should be checking for both 
> signed and unsigned variants.

In this case, we know that the two types are the same bitsize.  We
also know that no __intN type has the same size as a standard type
(__int128 being an exception).  So in any case where other __intN
types match, they won't match any of the other tests in this area
anyway.  Aside from choosing unsigned vs sighed (which the code does),
there are no other conversions within those bitsizes.

So if you think the __int128 case should be elsewhere in that logic
(and it seems to me that "long long" *should* be preferred over
__int128 if they're ths same bitsize) I can move it, but I don't think
there's any need to worry about other __intN types here.

> If you plan to allow __intN with sizes between those of int and long 
> long, they need to have the appropriate intermediate conversion rank for 
> their size.

But... we don't know the bit sizes at the gcc source level, we only
know them by iterating the array.  We'd have to iterate the array at
evey step to see if it's between bitsize N and M, or add the standard
types to some array, or add the __intN variants to integer_types[] and
re-sort i_t[].  However, doing that introduces the __intN types to
*everything* that uses integer_types[].  I was hesitant to add
nonstandard types to the standard promotion rules.

> Basically I think the integral conversion code in cp_common_type ought 
> to be rewritten to work on integer_types rather than naming specific types.

That would be the "re-sort it" option.

> > -  'n',  /* itk_int128 */
> > -  'o',  /* itk_unsigned_int128  */
> > +  /* __intN types are handled separately */
> 
> Where are they mangled now?  I also don't see any mangling tests.

They mangle as Inn like I20 or I128 (that might be the wrong letter,
but the syntax is like that).  It surprised me that there was a case
for "other unknown types", but there's a case for it :-)

The NULs are there just to ensure the array access works, and to tell
the code that there isn't a special case for those types.

  reply	other threads:[~2014-10-02  3:52 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 22:11 DJ Delorie
2014-08-13 22:22 ` Oleg Endo
2014-08-13 22:49   ` DJ Delorie
2014-08-21 20:53 ` Joseph S. Myers
2014-08-21 21:23   ` DJ Delorie
2014-08-21 21:38     ` Joseph S. Myers
2014-08-21 22:16       ` DJ Delorie
2014-08-21 22:25         ` Joseph S. Myers
2014-08-22  5:15       ` DJ Delorie
2014-08-22 10:53         ` Joseph S. Myers
2014-08-22 19:24           ` DJ Delorie
2014-08-22 20:16             ` Joseph S. Myers
2014-08-22 20:24               ` DJ Delorie
2014-08-26  3:04               ` DJ Delorie
2014-09-01 21:47                 ` Joseph S. Myers
2014-09-30 23:14                   ` DJ Delorie
2014-10-02  3:22                     ` Jason Merrill
2014-10-02  3:52                       ` DJ Delorie [this message]
2014-10-02 14:22                         ` Jason Merrill
2014-10-02 14:48                           ` Jason Merrill
2014-10-02 16:41                           ` DJ Delorie
2014-10-02 17:44                             ` Jason Merrill
2014-10-02 18:00                               ` DJ Delorie
2014-10-03 14:06                                 ` Jason Merrill
2014-10-03 20:11                                   ` DJ Delorie
2014-10-04 18:10                                     ` Jason Merrill
2014-10-04 18:36                                       ` DJ Delorie
2014-10-08 21:27                                       ` DJ Delorie
2014-10-09 13:49                                         ` Jason Merrill
2014-10-13 20:58                                           ` DJ Delorie
2014-10-14 13:56                                             ` Jason Merrill
2014-10-14 20:17                                               ` DJ Delorie
2014-10-15  8:49                                                 ` Paolo Carlini
2014-10-15 11:43                                                   ` Marc Glisse
2014-10-02 19:14                               ` DJ Delorie
2014-09-23 19:03                 ` Jonathan Wakely
2014-09-29 18:06                   ` DJ Delorie
2014-09-29 18:37                     ` Jonathan Wakely
2014-09-30 19:37                   ` DJ Delorie
2014-09-30 22:54                     ` Jonathan Wakely
2014-10-14 20:18                 ` Markus Trippelsdorf
2014-10-14 21:35                   ` DJ Delorie
2014-10-15  8:18                     ` Markus Trippelsdorf
2014-10-15 21:01                       ` DJ Delorie
2014-10-16  6:25                         ` Markus Trippelsdorf
2014-10-16 15:01                           ` David Edelsohn
2014-10-16 20:52                             ` DJ Delorie
2014-10-16 11:04                 ` Andreas Schwab
2014-10-16 22:39                   ` DJ Delorie
2014-10-20  8:19                     ` Andreas Schwab

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=201410020352.s923qLlm002274@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=nathan@codesourcery.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).