clang and -mfpmath=387 on ARCH=amd64
Dimitry Andric
dim at FreeBSD.org
Fri Dec 17 15:27:47 UTC 2010
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. :)
More information about the freebsd-toolchain
mailing list