Date: Thu, 14 Mar 2019 09:46:03 -0700 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: John Baldwin <jhb@freebsd.org> Cc: freebsd-toolchain@freebsd.org, freebsd-current@freebsd.org Subject: Re: Optimization bug with floating-point? Message-ID: <20190314164603.GA45044@troutmask.apl.washington.edu> In-Reply-To: <20190314063007.GA41995@troutmask.apl.washington.edu> References: <20190313024506.GA31746@troutmask.apl.washington.edu> <20190313151635.GA34757@troutmask.apl.washington.edu> <e290b68f-7a1d-2456-4a0c-9f7dfd303f55@FreeBSD.org> <20190313164039.GA35340@troutmask.apl.washington.edu> <e638e0bf-b8d0-9bd1-d034-8acc6eef872c@FreeBSD.org> <20190313212455.GA37717@troutmask.apl.washington.edu> <20190314063007.GA41995@troutmask.apl.washington.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 13, 2019 at 11:30:07PM -0700, Steve Kargl wrote: > > Spent a couple hours wandering in contrib/llvm. Have no idea > how to fix clang to actually work on i386/387. Any ideas > would be welcomed. > > AFAICT, all libm float routines need to be modified to conditional > include ieeefp.h and call fpsetprec(FP_PD). This will work around > issues is FP and libm. FreeBSD needs to issue an erratum about > the numerical issues with clang. > Probably beating a dead horse, but I'll continue as someone might actually be able to me fix clang. clang has the ability to determine the default precision that the FPU on i386 is using. #include <err.h> #include <ieeefp.h> #include <stdio.h> #include <stdlib.h> int main(void) { fp_prec_t p; p = fpgetprec(); switch(p) { case FP_PS: printf("24 bit (single-precision)\n"); break; case FP_PRS: printf("reserved\n"); break; case FP_PD: printf("53 bit (double-precision)\n"); break; case FP_PE: printf("64 bit (extended-precision)\n"); break; default: errx(1,"unable to determine precision"); }; return 0; } % cc -o z -O2 d.c && ./z 53 bit (double-precision) It is likely that one (or more files) in contrib/llvm/Target/X86 to be fixed. Unfortunately, there are 116 files, which are written in languages I do not know. Any pointers of which file(s) to poke? -- Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190314164603.GA45044>