diff options
author | bde <bde@FreeBSD.org> | 2008-01-17 16:39:07 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2008-01-17 16:39:07 +0000 |
commit | c553ad248f2b357789e1fdfb79d3efea1497c193 (patch) | |
tree | 41bf3b2fe1dad4b2008269aafa19f504b3e2bc77 /lib/libc/i386/_fpmath.h | |
parent | 691f99e98f534b08876da278935889a3d2624e22 (diff) | |
download | FreeBSD-src-c553ad248f2b357789e1fdfb79d3efea1497c193.zip FreeBSD-src-c553ad248f2b357789e1fdfb79d3efea1497c193.tar.gz |
Add an alternative view of the bits in an 80-bit long double (64+16
instead of 32+32+15+1) on all arches that have such long doubles (amd64,
ia64 and i386). Large objects should be be accessed in large units,
and the 32+32+15+1[+padding] decomposition asks for almost the opposite
of that, sometimes resulting in very slow accesses depending on how
well the compiler ignores what we ask for and converts to the best
units for the given machine. E.g., on Athlons, there is a 10-20 cycle
penalty for accessing the middle 32-bit word immediately after an
80-bit store.
Whether actually using the alternative view is better is very machine-
dependent. A 32+32+16 view is probably best with old 32-bit systems
and gcc through 4.2.1. The compiler should mostly avoid the view and
generate best accesses, but gcc-4.2.1 is far from doing that. I think
64+16 is best for now. Similarly for doubles -- they should be using
64+0 especially on 64-bit machines, but fdlibm uses 32+32 extensively
for them. Fortunately, in 64-bit mode for doubles, gcc already ignores
the 32+32-bit view and generates best accesses in many cases.
Diffstat (limited to 'lib/libc/i386/_fpmath.h')
-rw-r--r-- | lib/libc/i386/_fpmath.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/i386/_fpmath.h b/lib/libc/i386/_fpmath.h index 80e764f..4f1f5f4 100644 --- a/lib/libc/i386/_fpmath.h +++ b/lib/libc/i386/_fpmath.h @@ -35,6 +35,11 @@ union IEEEl2bits { unsigned int sign :1; unsigned int junk :16; } bits; + struct { + unsigned long long man :64; + unsigned int expsign :16; + unsigned int junk :16; + } xbits; }; #define LDBL_NBIT 0x80000000 @@ -46,4 +51,4 @@ union IEEEl2bits { #define LDBL_TO_ARRAY32(u, a) do { \ (a)[0] = (uint32_t)(u).bits.manl; \ (a)[1] = (uint32_t)(u).bits.manh; \ -} while(0) +} while (0) |