gcc/libstdc++-v3/include/experimental
Matthias Kretz 52d2821038 libstdc++: Fix ODR issues with different -m flags
Explicitly support use of the stdx::simd implementation in situations
where the user links TUs that were compiled with different -m flags. In
general, this is always a (quasi) ODR violation for inline functions
because at least codegen may differ in important ways. However, in the
resulting executable only one (unspecified which one) of them might be
used. For simd we want to support users to compile code multiple times,
with different -m flags and have a runtime dispatch to the TU matching
the target CPU. But if internal functions are not inlined this may lead
to unexpected performance loss or execution of illegal instructions.
Therefore, inline functions that are not marked as always_inline must
use an additional template parameter somewhere in their name, to
disambiguate between the different -m translations.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd.h: Move feature detection bools
	and add __have_avx512bitalg, __have_avx512vbmi2,
	__have_avx512vbmi, __have_avx512ifma, __have_avx512cd,
	__have_avx512vnni, __have_avx512vpopcntdq.
	(__detail::__machine_flags): New function which returns a unique
	uint64 depending on relevant -m and -f flags.
	(__detail::__odr_helper): New type alias for either an anonymous
	type or a type specialized with the __machine_flags number.
	(_SimdIntOperators): Change template parameters from _Impl to
	_Tp, _Abi because _Impl now has an __odr_helper parameter which
	may be _OdrEnforcer from the anonymous namespace, which makes
	for a bad base class.
	(many): Either add __odr_helper template parameter or mark as
	always_inline.
	* include/experimental/bits/simd_detail.h: Add defines for
	AVX512BITALG, AVX512VBMI2, AVX512VBMI, AVX512IFMA, AVX512CD,
	AVX512VNNI, AVX512VPOPCNTDQ, and AVX512VP2INTERSECT.
	* include/experimental/bits/simd_builtin.h: Add __odr_helper
	template parameter or mark as always_inline.
	* include/experimental/bits/simd_fixed_size.h: Ditto.
	* include/experimental/bits/simd_math.h: Ditto.
	* include/experimental/bits/simd_scalar.h: Ditto.
	* include/experimental/bits/simd_neon.h: Add __odr_helper
	template parameter.
	* include/experimental/bits/simd_ppc.h: Ditto.
	* include/experimental/bits/simd_x86.h: Ditto.
2022-01-15 21:05:17 +01:00
..
bits libstdc++: Fix ODR issues with different -m flags 2022-01-15 21:05:17 +01:00
algorithm Update copyright years. 2022-01-03 10:42:10 +01:00
any Update copyright years. 2022-01-03 10:42:10 +01:00
array Update copyright years. 2022-01-03 10:42:10 +01:00
buffer Update copyright years. 2022-01-03 10:42:10 +01:00
chrono Update copyright years. 2022-01-03 10:42:10 +01:00
deque Update copyright years. 2022-01-03 10:42:10 +01:00
executor Update copyright years. 2022-01-03 10:42:10 +01:00
filesystem Update copyright years. 2022-01-03 10:42:10 +01:00
forward_list Update copyright years. 2022-01-03 10:42:10 +01:00
functional Update copyright years. 2022-01-03 10:42:10 +01:00
internet Update copyright years. 2022-01-03 10:42:10 +01:00
io_context Update copyright years. 2022-01-03 10:42:10 +01:00
iterator Update copyright years. 2022-01-03 10:42:10 +01:00
list Update copyright years. 2022-01-03 10:42:10 +01:00
map Update copyright years. 2022-01-03 10:42:10 +01:00
memory Update copyright years. 2022-01-03 10:42:10 +01:00
memory_resource Update copyright years. 2022-01-03 10:42:10 +01:00
net Update copyright years. 2022-01-03 10:42:10 +01:00
netfwd Update copyright years. 2022-01-03 10:42:10 +01:00
numeric Update copyright years. 2022-01-03 10:42:10 +01:00
optional Update copyright years. 2022-01-03 10:42:10 +01:00
propagate_const Update copyright years. 2022-01-03 10:42:10 +01:00
random Update copyright years. 2022-01-03 10:42:10 +01:00
ratio Update copyright years. 2022-01-03 10:42:10 +01:00
regex Update copyright years. 2022-01-03 10:42:10 +01:00
set Update copyright years. 2022-01-03 10:42:10 +01:00
simd Update copyright years. 2022-01-03 10:42:10 +01:00
socket Update copyright years. 2022-01-03 10:42:10 +01:00
source_location Update copyright years. 2022-01-03 10:42:10 +01:00
string Update copyright years. 2022-01-03 10:42:10 +01:00
string_view Update copyright years. 2022-01-03 10:42:10 +01:00
system_error Update copyright years. 2022-01-03 10:42:10 +01:00
timer Update copyright years. 2022-01-03 10:42:10 +01:00
tuple Update copyright years. 2022-01-03 10:42:10 +01:00
type_traits Update copyright years. 2022-01-03 10:42:10 +01:00
unordered_map Update copyright years. 2022-01-03 10:42:10 +01:00
unordered_set Update copyright years. 2022-01-03 10:42:10 +01:00
utility Update copyright years. 2022-01-03 10:42:10 +01:00
vector Update copyright years. 2022-01-03 10:42:10 +01:00