diff options
author | Martin Liska <mliska@suse.cz> | 2022-10-26 12:59:00 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-10-26 12:59:00 +0200 |
commit | 62e475bad0d668c432bb97113cbf73fa281b8b55 (patch) | |
tree | 1c8993afe363ddbf4ae80795e47042df1e33d181 /gcc/common | |
parent | 5776a5ffab3b92d6ccac87ccf32c580ee2742d5a (diff) | |
parent | d80b7744c6ae6f6d8ca1f56982a50d1888b8279f (diff) | |
download | gcc-62e475bad0d668c432bb97113cbf73fa281b8b55.zip gcc-62e475bad0d668c432bb97113cbf73fa281b8b55.tar.gz gcc-62e475bad0d668c432bb97113cbf73fa281b8b55.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/common')
-rw-r--r-- | gcc/common/config/i386/cpuinfo.h | 38 | ||||
-rw-r--r-- | gcc/common/config/i386/i386-common.cc | 2 | ||||
-rw-r--r-- | gcc/common/config/i386/i386-cpuinfo.h | 6 | ||||
-rw-r--r-- | gcc/common/config/riscv/riscv-common.cc | 75 |
4 files changed, 98 insertions, 23 deletions
diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index d45451c..19ea713 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -76,6 +76,8 @@ has_cpu_feature (struct __processor_model *cpu_model, } } +/* Save FEATURE to either CPU_MODEL or CPU_FEATURES2. */ + static inline void set_cpu_feature (struct __processor_model *cpu_model, unsigned int *cpu_features2, @@ -100,6 +102,32 @@ set_cpu_feature (struct __processor_model *cpu_model, } } +/* Drop FEATURE from either CPU_MODEL or CPU_FEATURES2. */ + +static inline void +reset_cpu_feature (struct __processor_model *cpu_model, + unsigned int *cpu_features2, + enum processor_features feature) +{ + unsigned index, offset; + unsigned f = feature; + + if (f < 32) + { + /* The first 32 features. */ + cpu_model->__cpu_features[0] &= ~(1U << f); + } + else + { + /* The rest of features. cpu_features2[i] contains features from + (32 + i * 32) to (31 + 32 + i * 32), inclusively. */ + f -= 32; + index = f / 32; + offset = f % 32; + cpu_features2[index] &= ~(1U << offset); + } +} + /* Get the specific type of AMD CPU and return AMD CPU name. Return NULL for unknown AMD CPU. */ @@ -565,11 +593,11 @@ get_zhaoxin_cpu (struct __processor_model *cpu_model, cpu_model->__cpu_type = ZHAOXIN_FAM7H; if (model == 0x3b) { - cpu = "lujiazui"; - CHECK___builtin_cpu_is ("lujiazui"); - cpu_model->__cpu_features[0] &= ~(1U <<(FEATURE_AVX & 31)); - cpu_features2[0] &= ~(1U <<((FEATURE_F16C - 32) & 31)); - cpu_model->__cpu_subtype = ZHAOXIN_FAM7H_LUJIAZUI; + cpu = "lujiazui"; + CHECK___builtin_cpu_is ("lujiazui"); + reset_cpu_feature (cpu_model, cpu_features2, FEATURE_AVX); + reset_cpu_feature (cpu_model, cpu_features2, FEATURE_F16C); + cpu_model->__cpu_subtype = ZHAOXIN_FAM7H_LUJIAZUI; } break; default: diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc index 4b01c35..f66bdd5 100644 --- a/gcc/common/config/i386/i386-common.cc +++ b/gcc/common/config/i386/i386-common.cc @@ -2113,7 +2113,7 @@ const pta processor_alias_table[] = {"znver3", PROCESSOR_ZNVER3, CPU_ZNVER3, PTA_ZNVER3, M_CPU_SUBTYPE (AMDFAM19H_ZNVER3), P_PROC_AVX2}, - {"znver4", PROCESSOR_ZNVER4, CPU_ZNVER4, + {"znver4", PROCESSOR_ZNVER4, CPU_ZNVER3, PTA_ZNVER4, M_CPU_SUBTYPE (AMDFAM19H_ZNVER4), P_PROC_AVX512F}, {"btver1", PROCESSOR_BTVER1, CPU_GENERIC, diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h index 9893fc4..761af27 100644 --- a/gcc/common/config/i386/i386-cpuinfo.h +++ b/gcc/common/config/i386/i386-cpuinfo.h @@ -34,8 +34,10 @@ enum processor_vendor VENDOR_CENTAUR, VENDOR_CYRIX, VENDOR_NSC, - BUILTIN_VENDOR_MAX = VENDOR_OTHER, - VENDOR_MAX + + /* Maximum values must be at the end of this enum. */ + VENDOR_MAX, + BUILTIN_VENDOR_MAX = VENDOR_OTHER }; /* Any new types or subtypes have to be inserted at the end. */ diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index c39ed2e..bd356ce 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -145,6 +145,8 @@ static const struct riscv_ext_version riscv_ext_version_table[] = {"c", ISA_SPEC_CLASS_20190608, 2, 0}, {"c", ISA_SPEC_CLASS_2P2, 2, 0}, + {"h", ISA_SPEC_CLASS_NONE, 1, 0}, + {"v", ISA_SPEC_CLASS_NONE, 1, 0}, {"zicsr", ISA_SPEC_CLASS_20191213, 2, 0}, @@ -202,6 +204,9 @@ static const struct riscv_ext_version riscv_ext_version_table[] = {"zmmul", ISA_SPEC_CLASS_NONE, 1, 0}, + {"svinval", ISA_SPEC_CLASS_NONE, 1, 0}, + {"svnapot", ISA_SPEC_CLASS_NONE, 1, 0}, + /* Terminate the list. */ {NULL, ISA_SPEC_CLASS_NONE, 0, 0} }; @@ -224,6 +229,14 @@ static const riscv_cpu_info riscv_cpu_tables[] = {NULL, NULL, NULL} }; +static const char *riscv_tunes[] = +{ +#define RISCV_TUNE(TUNE_NAME, PIPELINE_MODEL, TUNE_INFO) \ + TUNE_NAME, +#include "../../../config/riscv/riscv-cores.def" + NULL +}; + static const char *riscv_supported_std_ext (void); static riscv_subset_list *current_subset_list = NULL; @@ -353,21 +366,18 @@ multi_letter_subset_rank (const std::string &subset) gcc_assert (subset.length () >= 2); int high_order = -1; int low_order = 0; - /* The order between multi-char extensions: s -> h -> z -> x. */ + /* The order between multi-char extensions: s -> z -> x. */ char multiletter_class = subset[0]; switch (multiletter_class) { case 's': high_order = 0; break; - case 'h': - high_order = 1; - break; case 'z': - high_order = 2; + high_order = 1; break; case 'x': - high_order = 3; + high_order = 2; break; default: gcc_unreachable (); @@ -663,7 +673,7 @@ riscv_subset_list::lookup (const char *subset, int major_version, static const char * riscv_supported_std_ext (void) { - return "mafdqlcbkjtpvn"; + return "mafdqlcbkjtpvnh"; } /* Parsing subset version. @@ -822,7 +832,7 @@ riscv_subset_list::parse_std_ext (const char *p) { char subset[2] = {0, 0}; - if (*p == 'x' || *p == 's' || *p == 'h' || *p == 'z') + if (*p == 'x' || *p == 's' || *p == 'z') break; if (*p == '_') @@ -947,7 +957,7 @@ riscv_subset_list::handle_combine_ext () Arguments: `p`: Current parsing position. - `ext_type`: What kind of extensions, 's', 'h', 'z' or 'x'. + `ext_type`: What kind of extensions, 's', 'z' or 'x'. `ext_type_str`: Full name for kind of extension. */ const char * @@ -1089,12 +1099,6 @@ riscv_subset_list::parse (const char *arch, location_t loc) if (p == NULL) goto fail; - /* Parsing hypervisor extension. */ - p = subset_list->parse_multiletter_ext (p, "h", "hypervisor extension"); - - if (p == NULL) - goto fail; - /* Parsing sub-extensions. */ p = subset_list->parse_multiletter_ext (p, "z", "sub-extension"); @@ -1218,6 +1222,9 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] = {"zmmul", &gcc_options::x_riscv_zm_subext, MASK_ZMMUL}, + {"svinval", &gcc_options::x_riscv_sv_subext, MASK_SVINVAL}, + {"svnapot", &gcc_options::x_riscv_sv_subext, MASK_SVNAPOT}, + {NULL, NULL, 0} }; @@ -1687,6 +1694,41 @@ riscv_compute_multilib ( #define TARGET_COMPUTE_MULTILIB riscv_compute_multilib #endif +vec<const char *> +riscv_get_valid_option_values (int option_code, + const char *prefix ATTRIBUTE_UNUSED) +{ + vec<const char *> v; + v.create (0); + opt_code opt = (opt_code) option_code; + + switch (opt) + { + case OPT_mtune_: + { + const char **tune = &riscv_tunes[0]; + for (;*tune; ++tune) + v.safe_push (*tune); + + const riscv_cpu_info *cpu_info = &riscv_cpu_tables[0]; + for (;cpu_info->name; ++cpu_info) + v.safe_push (cpu_info->name); + } + break; + case OPT_mcpu_: + { + const riscv_cpu_info *cpu_info = &riscv_cpu_tables[0]; + for (;cpu_info->name; ++cpu_info) + v.safe_push (cpu_info->name); + } + break; + default: + break; + } + + return v; +} + /* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ static const struct default_options riscv_option_optimization_table[] = { @@ -1701,4 +1743,7 @@ static const struct default_options riscv_option_optimization_table[] = #undef TARGET_HANDLE_OPTION #define TARGET_HANDLE_OPTION riscv_handle_option +#undef TARGET_GET_VALID_OPTION_VALUES +#define TARGET_GET_VALID_OPTION_VALUES riscv_get_valid_option_values + struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; |