clang and -mfpmath=387 on ARCH=amd64
Alexander Best
arundel at freebsd.org
Sat Dec 18 17:21:30 UTC 2010
On Sat Dec 18 10, Alexander Best wrote:
> On Fri Dec 17 10, Dimitry Andric wrote:
> > 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.
>
> so this patch should keep clang from complaing while compiling the kernel and
> in addition to that won't have any impact on gcc.
maybe sorting the options just like in the i386 section is a better to have
more consistency.
cheers.
alex
>
> cheers.
> alex
>
> >
> > It would be nice if gcc/clang had an option "-mdie-on-any-fp", but they
> > don't, unfortunately. :)
>
> --
> a13x
> diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
> index 4d8636c..e277b74 100644
> --- a/sys/conf/kern.mk
> +++ b/sys/conf/kern.mk
> @@ -66,7 +66,7 @@ INLINE_LIMIT?= 15000
> #
> .if ${MACHINE_CPUARCH} == "amd64"
> CFLAGS+= -mcmodel=kernel -mno-red-zone \
> - -mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow \
> + -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow \
> -msoft-float -fno-asynchronous-unwind-tables
> INLINE_LIMIT?= 8000
> .endif
--
a13x
-------------- next part --------------
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index 4d8636c..baed1b2 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -66,7 +66,7 @@ INLINE_LIMIT?= 15000
#
.if ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -mcmodel=kernel -mno-red-zone \
- -mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow \
+ -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
-msoft-float -fno-asynchronous-unwind-tables
INLINE_LIMIT?= 8000
.endif
More information about the freebsd-toolchain
mailing list