128-bit long long?

Jim Wilson wilson@specifixinc.com
Tue Mar 30 02:10:00 GMT 2004


Scott Robert Ladd wrote:
> On a 64-bit AMD64 architecture, GCC defines long long as 64 bits, the 
> same as a long.
> Given that certain 64-bit instructions (multiply) produce 128-bit 
> results, doesn't it seem logical the long long be defined as 128 bits?

Part of the reason here is historical accident.  Early 64-bit targets 
had to be supported via cross compilation from 32-bit hosts.  Gcc 
internally represents tree and rtl values as 2 HOST_WIDE_INT values. 
This was before most compilers had long long support, so HOST_WIDE_INT 
had to be long.  Thus a 32-bit host could support at most a 64-bit 
integer type.  So all early 64-bit ports had to limit long long to 
64-bits.  This restriction was removed relatively recently, between 3.3 
and 3.4.  So it wasn't until 3.4 that we can have a 128-bit long long 
type and still support cross compilation from a 32-bit host.  However, 
by now, 64-bit long long assumptions have been written into so much 
software that changing it would be too painful.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list