Gentoo Archives: gentoo-user

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

Replies

Subject Author
[gentoo-user] Re: CFLAGs for kernel compilation Nikos Chantziaras <realnc@×××××.com>