1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield

Use a .def file to define the bitfield layout, so that it is possible
to iterate over field members using the preprocessor.
This commit is contained in:
Florian Weimer
2021-03-02 14:58:05 +01:00
parent 851f32cf7b
commit e4933c8a92
2 changed files with 51 additions and 34 deletions

View File

@@ -0,0 +1,34 @@
/* Bits in the PREFERRED_FEATURE_INDEX_1 bitfield of <cpu-features.h>.
Copyright (C) 2020-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
BIT (Fast_Rep_String)
BIT (Fast_Copy_Backward)
BIT (Slow_BSF)
BIT (Fast_Unaligned_Load)
BIT (Prefer_PMINUB_for_stringop)
BIT (Fast_Unaligned_Copy)
BIT (I586)
BIT (I686)
BIT (Slow_SSE4_2)
BIT (AVX_Fast_Unaligned_Load)
BIT (Prefer_MAP_32BIT_EXEC)
BIT (Prefer_No_VZEROUPPER)
BIT (Prefer_ERMS)
BIT (Prefer_No_AVX512)
BIT (MathVec_Prefer_No_AVX512)
BIT (Prefer_FSRM)

View File

@@ -772,40 +772,23 @@ enum
/* EBX. */ /* EBX. */
#define reg_PTWRITE ebx #define reg_PTWRITE ebx
/* PREFERRED_FEATURE_INDEX_1. */ /* PREFERRED_FEATURE_INDEX_1. First define the bitindex values
#define bit_arch_I586 (1u << 0) sequentially, then define the bit_arch* and index_arch_* lookup
#define bit_arch_I686 (1u << 1) constants. */
#define bit_arch_Fast_Rep_String (1u << 2) enum
#define bit_arch_Fast_Copy_Backward (1u << 3) {
#define bit_arch_Fast_Unaligned_Load (1u << 4) #define BIT(x) _bitindex_arch_##x ,
#define bit_arch_Fast_Unaligned_Copy (1u << 5) #include "cpu-features-preferred_feature_index_1.def"
#define bit_arch_Slow_BSF (1u << 6) #undef BIT
#define bit_arch_Slow_SSE4_2 (1u << 7) };
#define bit_arch_AVX_Fast_Unaligned_Load (1u << 8) enum
#define bit_arch_Prefer_MAP_32BIT_EXEC (1u << 9) {
#define bit_arch_Prefer_PMINUB_for_stringop (1u << 10) #define BIT(x) \
#define bit_arch_Prefer_No_VZEROUPPER (1u << 11) bit_arch_##x = 1u << _bitindex_arch_##x , \
#define bit_arch_Prefer_ERMS (1u << 12) index_arch_##x = PREFERRED_FEATURE_INDEX_1,
#define bit_arch_Prefer_FSRM (1u << 13) #include "cpu-features-preferred_feature_index_1.def"
#define bit_arch_Prefer_No_AVX512 (1u << 14) #undef BIT
#define bit_arch_MathVec_Prefer_No_AVX512 (1u << 15) };
#define index_arch_Fast_Rep_String PREFERRED_FEATURE_INDEX_1
#define index_arch_Fast_Copy_Backward PREFERRED_FEATURE_INDEX_1
#define index_arch_Slow_BSF PREFERRED_FEATURE_INDEX_1
#define index_arch_Fast_Unaligned_Load PREFERRED_FEATURE_INDEX_1
#define index_arch_Prefer_PMINUB_for_stringop PREFERRED_FEATURE_INDEX_1
#define index_arch_Fast_Unaligned_Copy PREFERRED_FEATURE_INDEX_1
#define index_arch_I586 PREFERRED_FEATURE_INDEX_1
#define index_arch_I686 PREFERRED_FEATURE_INDEX_1
#define index_arch_Slow_SSE4_2 PREFERRED_FEATURE_INDEX_1
#define index_arch_AVX_Fast_Unaligned_Load PREFERRED_FEATURE_INDEX_1
#define index_arch_Prefer_MAP_32BIT_EXEC PREFERRED_FEATURE_INDEX_1
#define index_arch_Prefer_No_VZEROUPPER PREFERRED_FEATURE_INDEX_1
#define index_arch_Prefer_ERMS PREFERRED_FEATURE_INDEX_1
#define index_arch_Prefer_No_AVX512 PREFERRED_FEATURE_INDEX_1
#define index_arch_MathVec_Prefer_No_AVX512 PREFERRED_FEATURE_INDEX_1
#define index_arch_Prefer_FSRM PREFERRED_FEATURE_INDEX_1
/* XCR0 Feature flags. */ /* XCR0 Feature flags. */
#define bit_XMM_state (1u << 1) #define bit_XMM_state (1u << 1)