Gcc46 and 128 Bit Floating Point
Thomas D. Dean
tomdean at speakeasy.org
Wed Feb 29 04:03:38 UTC 2012
On 02/17/12 13:03, Thomas D. Dean wrote:
I have been reading the Core-i7 developers manual and looking at libm.
I have been trying to shoe horn some calculations between the sizes of
fpu instructions and libgmp.
I think there is little support for 128-bit floating point in the
Core-i7 3930K CPU.
The code which uses __float128 implements functions in software and use
the 80-bit fpu instructions to assist.
I believe there is some speed improvement with the 128-bit registers.
But, I can find no floating point instructions that operate on 128-bit
floating point, like there is for 80-bit.
The bottom line seems to be little gain in floating point operations
with the core-i7 CPU.
Or, am I missing something?
#include <quadmath.h>
#include <stdio.h>
int main() {
char buf[128];
__float128 x = sqrtq(2.0Q);
quadmath_snprintf(buf, sizeof buf, "%.45Qf",x);
printf("sin(%s) = ",buf);
quadmath_snprintf(buf, sizeof buf, "%.45Qf",sinq(x));
printf("%s\n",buf);
return 0;
}
gcc46 math.c -o math /usr/local/lib/gcc46/libquadmath.a /usr/lib/libm.a
Looking at the output of objdump -d math shows software implementation
of sqrtq() and sinq(). gcc46 does use the fsqrt instruction but not fsin.
Tom Dean
More information about the freebsd-amd64
mailing list