[PATCH v4] libstdc++: Implement [simd] for C++26
Matthias Kretz
MatthiasKretz@gmx.net
Thu Feb 12 11:47:15 GMT 2026
Matthias Kretz [Wednesday, 11 February 2026 16:07:29 CET]:
> Design notes:
I should add one more item:
<simd> is meant to be usable without ODR violations in applications that mix
TUs compiled with different -m flags (different ISA extensions). Example
scenario where this is relevant: an application dispatches on CPUID to an
implementation that doesn't use AVX512, but some TUs were also compiled with
AVX512 enabled (and not called).
There are two mechanisms for this:
1. Most functions are declared always_inline, thus never emitting a weak
symbol.
2. Functions that could "get large" should not be always_inline (for
performance and code size). These are then tagged via an _ArchTraits or
combined _ArchTraits & _OptTraits template parameter. Thus, the weak symbol
has a different name depending on compiler flags, avoiding ODR violations. A
secondary goal here is to be prepared for a future where we can reflect on the
target / target_clones attribute and dispatch accordingly. Making <simd>
usable in FMV is also the topic of PR83875.
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://mattkretz.github.io
GSI Helmholtz Center for Heavy Ion Research https://gsi.de
std::simd
──────────────────────────────────────────────────────────────────────────
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20260212/130d3373/attachment.sig>
More information about the Libstdc++
mailing list