Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Dec 2010 16:27:52 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Alexander Best <arundel@freebsd.org>
Cc:        freebsd-toolchain@freebsd.org
Subject:   Re: clang and -mfpmath=387 on ARCH=amd64
Message-ID:  <4D0B8178.9010609@FreeBSD.org>
In-Reply-To: <20101214204006.GA81772@freebsd.org>
References:  <20101211114707.GA60390@freebsd.org> <4D051FD1.7070100@FreeBSD.org> <20101214204006.GA81772@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2010-12-14 21:40, Alexander Best wrote:
> On Sun Dec 12 10, Dimitry Andric wrote:
...
>> I have compiled two GENERIC kernels on amd64 with and without the
>> -mfpmath=386 option, and those resulted in exactly the same binaries
>> (apart from the compilation timestamp).
>>
>> So I think the whole -mfpmath=387 option is nonsensical anyway.  The
>> comment just above those CFLAGS in sys/conf/kern.mk says:
>
> i think for i386 the case is clear: -mfpmath=387 *is* the default. for amd64 it
> depends.

On amd64 -mfpmath=sse is the default.  However, floating point is not
allowed at all in the kernel, and even if it were used, it would result
in a compile error, because -mno-sse is also used.  You can verify this
by compiling a small program on amd64 that uses floating point, and
passing the -mno-sse option.


> if we can be sure that the -mno-sse[2-3]? options will set
> -mfpmath=387 there is no need to set -mfpmath=387. it seems from your tests and
> also from a logical sense of point that this is the case. however the gcc
> manual doesn't really state this matter. so it could in fact be possible that
> even with -mno-sse[2-3]? set, -mfpmath=sse remains the default setting for
> amd64.

Yes it is the default; but as I said, it makes no difference.  Neither
i387 nor sse hardware FP instructions should ever be generated in the
kernel.

It would be nice if gcc/clang had an option "-mdie-on-any-fp", but they
don't, unfortunately. :)



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