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

next in thread | previous in thread | raw e-mail | index | archive | help

--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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

--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="kern.mk.diff3"

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

--/04w6evG8XlLl3ft--



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