Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-dev@l.g.o
Cc: Mike Gilbert <floppym@g.o>
Subject: [gentoo-dev] [PATCH] profiles/arch/amd64: add "-mfpmath=sse" to CFLAGS_x86
Date: Tue, 18 Oct 2022 01:58:19
Message-Id: 20221018015755.332526-1-floppym@gentoo.org
1 GCC uses x87 floating point instructions when building 32-bit x86
2 code by default. This is true even for x86-64 multilib.
3
4 Using the x87 floating point unit can lead to strange behavior when
5 calculating intermediate values for single and double precision floats.
6 It uses 80 bits for all calculations, which is larger than the 32 or 64
7 bits specified for floats and doubles.
8
9 Using the SSE2 instructions available on x86-64 for floating point
10 arithmetic leads to more consistent behavior, and is usually faster.
11
12 Reference: https://gcc.gnu.org/wiki/x87note
13 Signed-off-by: Mike Gilbert <floppym@g.o>
14 ---
15 profiles/arch/amd64/make.defaults | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18 diff --git a/profiles/arch/amd64/make.defaults b/profiles/arch/amd64/make.defaults
19 index 0c05dec124e..e7e18ff6a91 100644
20 --- a/profiles/arch/amd64/make.defaults
21 +++ b/profiles/arch/amd64/make.defaults
22 @@ -1,4 +1,4 @@
23 -# Copyright 1999-2021 Gentoo Authors
24 +# Copyright 1999-2022 Gentoo Authors
25 # Distributed under the terms of the GNU General Public License v2
26
27 ARCH="amd64"
28 @@ -28,7 +28,7 @@ LDFLAGS_amd64="-m elf_x86_64"
29 CHOST_amd64="x86_64-pc-linux-gnu"
30
31 # 32bit specific settings.
32 -CFLAGS_x86="-m32"
33 +CFLAGS_x86="-m32 -mfpmath=sse"
34 LDFLAGS_x86="-m elf_i386"
35 CHOST_x86="i686-pc-linux-gnu"
36
37 --
38 2.37.3

Replies