[Bug 274927] Toolchain fails on the __sync_val_compare_and_swap function without -march=native (port biology/seqwish)

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 06 Nov 2023 01:31:32 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274927

--- Comment #7 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
https://clang.llvm.org/docs/UsersManual.html reports:

QUOTE
Several micro-architecture levels as specified by the x86-64 psABI are defined.
They are cumulative in the sense that features from previous levels are
implicitly included in later levels.

-march=x86-64: CMOV, CMPXCHG8B, FPU, FXSR, MMX, FXSR, SCE, SSE, SSE2
-march=x86-64-v2: (close to Nehalem) CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3,
SSE4.1, SSE4.2, SSSE3
-march=x86-64-v3: (close to Haswell) AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT,
MOVBE, XSAVE
-march=x86-64-v4: AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL
END QUOTE

CMPXCHG16B is the 128 bit (16 Byte) instruction for the lock-free
operation in question, something -march=x86-64 does not have.

So it looks like the Makefile should use: -march=x86-64-v2
if nothing newer than x86-64-v2 is needed. This would be better
than -march-native as far as indicating the widest range of
cpu micro-architectures possible.

However, in general, consideration vs. -march=x86-64-v3 vs.
-march=x86-64-v4 is appropriate since more may be needed. Some
ports might need to add OPTION control over which to use of:

-march=x86-64-v2
-march=x86-64-v3
-march=x86-64-v4

-- 
You are receiving this mail because:
You are the assignee for the bug.