[patch]: Add support of new __int128 type for targets having 128-bit integer scalar support

Joseph S. Myers joseph@codesourcery.com
Tue May 25 16:09:00 GMT 2010


On Tue, 25 May 2010, Jason Merrill wrote:

> On 05/25/2010 11:06 AM, Kai Tietz wrote:
> > PS: I see that this patch shows an new failure in g++.dg/init/enum1.C.
> > This test needs some modification, so that it won't run if int128.c is
> > supported, as for this a wide-enough integer scalar type is present to
> > hold the LL value.
> 
> So, how do you write the largest unsigned __int128 as a literal?

There is no way of writing it directly; we don't have a full API 
specification for this extension, but the AMD64 ABI describes types called 
__int128, signed __int128 (same type as __int128), unsigned __int128 (and 
some others such as __float128 which is presently implemented as a 
built-in typedef rather than a keyword).  The ABI does not say anything 
about writing such constants.  But you can build up such a constant using 
an expression from two 64-bit parts.  ((unsigned __int128)-1 or ~(unsigned 
__int128)0 would be the simplest way of expressing that particular value.)

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list