Gentoo Archives: gentoo-user

From: Nikos Chantziaras <realnc@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: CFLAGs for kernel compilation
Date: Sat, 02 May 2015 11:25:44
Message-Id: mi2c75$72m$1@ger.gmane.org
In Reply to: Re: [gentoo-user] Re: CFLAGs for kernel compilation by Volker Armin Hemmann
1 On 02/05/15 14:19, Volker Armin Hemmann wrote:
2 > Am 02.05.2015 um 07:04 schrieb Nikos Chantziaras:
3 >> On 01/05/15 10:44, Andrew Savchenko wrote:
4 >>> On Fri, 1 May 2015 05:09:51 +0000 (UTC) Martin Vaeth wrote:
5 >>>> Andrew Savchenko <bircoph@g.o> wrote:
6 >>>>>
7 >>>>> That's why kernel makes sure that no floating point instructions
8 >>>>> sneaks in using CFLAGS, you may see a lot of -mno-${intrucion_set}
9 >>>>> flags when running make -V.
10 >>>>
11 >>>> So it should be sufficient that the kernel does not use "float"
12 >>>> or "double", shouldn't it?
13 >>>
14 >>> No. Optimizer paths may be very unobvious, i.e. I'll not be
15 >>> surprised if under some conditions vectorizer may use float
16 >>> instructions for int code.
17 >>
18 >> The kernel uses -O2 and several -march variants (e.g. -march=core2).
19 >> Several other options are used to prevent GCC from generating
20 >> unsuitable code.
21 >>
22 >> Specifying another -march variant does not affect the optimizer
23 >> though. It only affects the code generator. If you don't modify the
24 >> other CFLAGS and only change -march, you will not get FP instructions
25 >> unless you use FP in the code.
26 >>
27 >> Also, I'd be very interested to see *any* optimization that would
28 >> somehow transform integer code to FP code (note that SIMD is not FP
29 >> and is perfectly fine in the kernel.) In fact, optimizers tend to
30 >> transform FP into SIMD, at least on x86 (and other architectures that
31 >> have fast SIMD instructions.) If I inspect the generated assembly from
32 >> GCC or Clang, I cannot find FP anywhere, even for code using "float"
33 >> and "double" operations. They get converted to SIMD on modern CPUs
34 >> (unless you specify a compiler flag that tells it to use the FPU, for
35 >> example if you need 80-bit extended precision, which is supported by
36 >> the x86 FPU.)
37 >>
38 >>
39 >>
40 >
41 > http://www.agner.org/optimize/calling_conventions.pdf
42
43 Not sure what you're trying to say.

Replies

Subject Author
Re: [gentoo-user] Re: CFLAGs for kernel compilation Volker Armin Hemmann <volkerarmin@××××××××××.com>