Connection

Dimitry Andric dim at FreeBSD.org
Sat Feb 28 15:03:45 UTC 2015


On 28 Feb 2015, at 03:59, R0B_ROD <witchdoctor.mdf at gmail.com> wrote:
> The optimization level -O3
> in "CFLAGS and COPTFLAGS -O3 -pipe -funroll-loops"
> options in /etc/make.conf, have any relation to the
> CPU having SSE3 and SSE4A features??

This depends on which architecture you are using (e.g. amd64 or i386),
and on the specific CPU type you are compiling for.  The CPU type, set
by CPUTYPE in make.conf, determines the features the compiler can use,
such as different levels of SSE.

The 'optimization level' selected by -O1, -O2 and -O3 is only a shortcut
notation for selecting more and more specific optimization passes, in
the hope that the resulting executable will run faster.  The tradeoff
is slower compilation, and in some cases unexpected side effects.

The -pipe option is traditionally added to avoid writing temporary
files, but it is mostly ineffective when using clang, since it produces
object files directly from source, via internal transformations, instead
of the classic model of having a separate preprocessor, compiler and
assembler.

Lastly, the -funroll-loops option is usually unnecessary with clang, as
it is already automatically enabled for -O2 and higher.  When it is able
to use SSE, it will automatically try to vectorize loops and other parts
of the code [1].


> I have built over a dozen kernels for my laptop
> with 10.1-STABLE.

In case of the kernel, you will not gain anything from SSE, as it is
explicitly disabled for building the kernel code.  In kernel context,
no floating point or SSE instructions are allowed.

-Dimitry

[1] http://llvm.org/docs/Vectorizers.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20150228/67be6e5a/attachment.sig>


More information about the freebsd-hackers mailing list