This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: enable maximum integer type to be 128 bits
- From: Zack Weinberg <zack at codesourcery dot com>
- To: "Jan Beulich" <JBeulich at novell dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 08 Jul 2004 18:42:13 -0700
- Subject: Re: enable maximum integer type to be 128 bits
- References: <s0ecfa9a.049@emea1-mh.id2.novell.com>
"Jan Beulich" <JBeulich@novell.com> writes:
> At present, using __attribute__((__mode__(__TI__))) or
> __int128_t/__uint128_t depends on knowing the compiler and target
> architecture, there is no architecture-independent way I know of to
> identify that these types are usable. Nevertheless the compiler
> supports them, and namely for encryption and scientific stuff they
> may come quite handy.
Okay. Certainly having an 128-bit integer type around is a reasonable
thing to want.
However, there are two things you need to realize. First is that
supporting 128-bit integer types involves nontrivial amounts of
overhead in the compiler, especially on 32-bit archs. This is
something we'd like to fix, but it's a lot of work (we would basically
have to switch all of the constant-handling to use something like GMP
or MPFR - that's not out of the question, but no one has stepped up to
the plate).
Second,
> (and as I previously said I consider it an error of say glibc to not
> make intmax_t 128 bits wide on 64-bit archs in the first place, but
> this is not the only stdint.h shortcoming in glibc).
to say this indicates that you don't understand why intmax_t is 64
bits wide on a 64-bit architecture. The short version is that there
is a huge amount of code out there in the wild written to the
following two assumptions:
1) sizeof(size_t) == sizeof(void *)
2) sizeof(long) >= sizeof(any standard typedef, especially size_t).
(2) in particular was an ironclad guarantee under C90, which guarantee
was silently withdrawn in C99; a lot of people (me included) think
that this is a catastrophic bug in C99. Sensible C implementors do
not take advantage of the bug: 'long' MUST have at least as many
significant bits as any standard typedef. In particular, 'intmax_t'
and 'long' MUST be the same type.
This is why Joseph is telling you not to tie intmax_t to __int128_t.
zw
Note: MUST here used in the sense it is used in Internet RFCs.