Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Feb 2012 10:59:11 -0800
From:      "Thomas D. Dean" <tomdean@speakeasy.org>
To:        freebsd-amd64@freebsd.org
Subject:   Gcc46 and 128 Bit Floating Point
Message-ID:  <4F3EA37F.9010207@speakeasy.org>

next in thread | raw e-mail | index | archive | help
 > uname -a
FreeBSD P9X79.tddhome 9.0-STABLE FreeBSD 9.0-STABLE #0: Sat Jan 28
10:11:39 PST 2012     tomdean@P9X79.tddhome:/usr/src/sys/GENERIC  amd64

 From dmesg:
CPU: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz (4160.12-MHz K8-class CPU)
   Origin = "GenuineIntel"  Id = 0x206d6  Family = 6  Model = 2d 
Stepping = 6
 
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
 
Features2=0x17bee3bf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,XSAVE,AVX>
   AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
   AMD Features2=0x1<LAHF>
   TSC: P-state invariant, performance statistics

I have gcc46 from the ports tree:

 > which gcc46
/usr/local/bin/gcc46
 > gcc46 --version
gcc46 (FreeBSD Ports Collection) 4.6.3 20120106 (prerelease)
 > env | grep LD
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/gcc46:/lib

I am trying to get gcc46 to issue floating point instructions using the 
xmm registers and long double's.  Looking in include directories, it 
appears the gcc46 port uses the FreeBSD system include files, which are 
from the patched gcc 4.2.1.

 > cat epsilon.c
#include <stdio.h>
#define LD1 (long double)1.0
#define LD2 (long double)2.0
int main() {
   long double machEps;
   machEps=LD1;
   while(1) {
	machEps /= LD2;
	if ((LD1 + (machEps/LD2)) == LD1) break;
   }
   printf( "\nCalculated Machine epsilon: %LG\n", machEps );
   return 0;
}

 > gcc46 -march=corei7 -msse2 epsilon.c -o epsilon
 > /usr/local/bin/objdump epsilon | grep xmm
 > /usr/local/bin/objdump -d epsilon | more
...
   400667:  db 6d f0             fldt   -0x10(%rbp)
   40066a:  db 2d 20 01 00 00    fldt   0x120(%rip)
   400670:  de f9                fdivrp %st,%st(1)
   400672:  db 7d f0             fstpt  -0x10(%rbp)
...

gcc46 is generating 80-bit floating point instructions.

The gcc docs state gcc46 will generate 128-bit instructions.

I can get gfortran46 to generate 128-bit instructions.

How do I get gcc46 to generate 128-bit floating point instructions?

Tom Dean



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F3EA37F.9010207>