Skip to content
Snippets Groups Projects

Provide a x86_64_v3 microarchitecture level port

Merged Allan McRae requested to merge (removed):optimisation into master
+ 70
0
=====================================
Use x86-64-v2 microarchitecture level
=====================================
- Date proposed: 2020-03-02
- RFC MR: https://gitlab.archlinux.org/archlinux/rfcs/-/merge_requests/0002
Summary
-------
Adjust our buildflags to build with -march=x86-64-v2.
Motivation
----------
Arch used to pride itself in providing optimised binaries out of the box.
However, the days where i686, and even x86_64, showed improvements over
other distributions are long behind us.
Recently, AMD, Intel, Red Hat, and SUSE collaborated to define three
x86-64 microarchitecture levels on top of the x86-64 baseline. The three
microarchitectures group together CPU features roughly based on hardware
release dates.
The first of these microarchitecture levels, x86-64-v2, assumes the
following on top of base level x86_64 instructions:
``CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3``.
This basically raises the processor feature level requirement to around
Intel Nehalem, and supports any x86_64 processor made in the last decade.
This microarchitecture became available in GCC version 11 and LLVM
version 12, and supported in glibc-2.33 and binutils-2.36.
Assuming SSE4 (and others) while compiling will provide greater
out-of-the-box performance in Arch Linux.
Alternatives Considered
-----------------------
Using x86-64-v3 requires the following instruction sets:
``AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE``.
That is close to a Haswell processor. Unfortunately, some recent low
end Intel CPU do not have AVX support, making this not a viable option
for the distribution baseline level architecture. We can potentially
provide x86_64-v3 as a secondary architecture when automated
database/package signing has been implemented.
Specification
-------------
We will change the distributed makepkg.conf to include the following:
::
CFLAGS="-march=x86-64-v2 -mtune=generic ...
CXXFLAGS="$CFLAGS"
Drawbacks
---------
Some old CPUs will no longer be able to use Arch.
Unresolved Questions
--------------------
None.
Loading