1 /* Common definition for ifunc selections optimized wide-character
4 All versions must be listed in ifunc-impl-list.c.
5 Copyright (C) 2022-2024 Free Software Foundation, Inc.
6 This file is part of the GNU C Library.
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library; if not, see
20 <https://www.gnu.org/licenses/>. */
22 #include <init-arch.h>
25 # define GENERIC generic
28 extern __typeof (REDIRECT_NAME
) OPTIMIZE (evex
) attribute_hidden
;
30 extern __typeof (REDIRECT_NAME
) OPTIMIZE (avx2
) attribute_hidden
;
32 extern __typeof (REDIRECT_NAME
) OPTIMIZE (GENERIC
) attribute_hidden
;
37 const struct cpu_features
*cpu_features
= __get_cpu_features ();
39 if (X86_ISA_CPU_FEATURE_USABLE_P (cpu_features
, AVX2
)
40 && X86_ISA_CPU_FEATURE_USABLE_P (cpu_features
, BMI2
)
41 && X86_ISA_CPU_FEATURES_ARCH_P (cpu_features
,
42 AVX_Fast_Unaligned_Load
, ))
44 if (X86_ISA_CPU_FEATURE_USABLE_P (cpu_features
, AVX512VL
)
45 && X86_ISA_CPU_FEATURE_USABLE_P (cpu_features
, AVX512BW
))
46 return OPTIMIZE (evex
);
48 if (X86_ISA_CPU_FEATURES_ARCH_P (cpu_features
,
49 Prefer_No_VZEROUPPER
, !))
50 return OPTIMIZE (avx2
);
54 return OPTIMIZE (GENERIC
);