commit:     ed189588a071f88186a3a9de25abfbd7582b9c69
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 18 01:41:53 2022 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Oct 24 00:21:18 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed189588

profiles/arch/amd64: add "-mfpmath=sse" to CFLAGS_x86

GCC uses x87 floating point instructions when building 32-bit x86
code by default. When building 64-bit code, SSE2 instructions are used
instead.

Using the x87 floating point unit can lead to strange behavior when
calculating intermediate values for single and double precision floats.
It uses 80 bits for all calculations, which is larger than the 32 or 64
bits specified for floats and doubles.

Using the SSE2 instructions available on x86-64 for floating point
arithmetic leads to more consistent behavior, and is usually faster.

Reference: https://gcc.gnu.org/wiki/x87note
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 profiles/arch/amd64/make.defaults | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/profiles/arch/amd64/make.defaults 
b/profiles/arch/amd64/make.defaults
index 0c05dec124e2..e7e18ff6a912 100644
--- a/profiles/arch/amd64/make.defaults
+++ b/profiles/arch/amd64/make.defaults
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 ARCH="amd64"
@@ -28,7 +28,7 @@ LDFLAGS_amd64="-m elf_x86_64"
 CHOST_amd64="x86_64-pc-linux-gnu"
 
 # 32bit specific settings.
-CFLAGS_x86="-m32"
+CFLAGS_x86="-m32 -mfpmath=sse"
 LDFLAGS_x86="-m elf_i386"
 CHOST_x86="i686-pc-linux-gnu"
 

Reply via email to