On Fri, Sep 14, 2012 at 03:23:19PM -0500, Brooks Davis wrote: > On Thu, Sep 13, 2012 at 09:10:24AM -0700, Steve Kargl wrote: > > ok 1 - cexp zero > > Abort trap (core dumped) > > *** [tests] Error code 134 > > > > Stop in /usr/src/tools/regression/lib/msun. > > Prompted by this post, I did a bit of testing and it looks like we have > two classes of failures that need to be investigated. First, some tests > are failing with a gcc compiled world and clang compiled test code. > They seem to mostly be unexpected fp exception state when testing with > NaNs. I suspect that someone more knowledgeable in this area could come > up with a reduced test case and explication of what clang is doing wrong > pretty quickly. > > The second class is tests that fail when libm is compiled using clang. > I've not investigate those at all. I'd tend to guess that we have a > wider range of issues there. > A third class of failure appears to be that clang emits i387 fpu instructions for at least sinf and cosf instead of calls to the library routines. AFAIK, the library routines are faster and more accurate. % cat a.c #include <math.h> float foo(float x) { float a; a = sinf(x) * cosf(x); return (a); } % clang -S -O a.c foo: # _at_foo # BB#0: # %entry flds 4(%esp) fld %st(0) fcos fxch fsin fmulp ret % cc -S -O a.c foo: pushl %ebp movl %esp, %ebp pushl %ebx subl $20, %esp movl 8(%ebp), %ebx movl %ebx, (%esp) call sinf fstps -8(%ebp) movl %ebx, (%esp) call cosf fmuls -8(%ebp) addl $20, %esp popl %ebx popl %ebp ret % clang -S -O -fno-builtin a.c foo: # _at_foo # BB#0: # %entry pushl %ebp movl %esp, %ebp subl $24, %esp flds 8(%ebp) fsts -16(%ebp) # 4-byte Folded Spill fstps (%esp) calll sinf fstpt -12(%ebp) # 10-byte Folded Spill flds -16(%ebp) # 4-byte Folded Reload fstps (%esp) calll cosf fldt -12(%ebp) # 10-byte Folded Reload fmulp addl $24, %esp popl %ebp ret Using -fno-builtin would seem to be a non-starter in that it disables all builtin functions. -- SteveReceived on Fri Sep 14 2012 - 22:18:18 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:30 UTC