diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-08-07 20:28:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-07 20:28:16 +0200 |
| commit | 904f5795a0ffd4393ea0810d5e6efedd4b00e42c (patch) | |
| tree | 3b1f6ab81b3b6882c84e3a973e2866f4941c8e5a /compiler/rustc_codegen_gcc | |
| parent | 8d0066922b14cee3175e8c141e5e909fa6d9a6eb (diff) | |
| parent | 8818c9552821721e4be5c19832b4e3ac64090feb (diff) | |
| download | rust-904f5795a0ffd4393ea0810d5e6efedd4b00e42c.tar.gz rust-904f5795a0ffd4393ea0810d5e6efedd4b00e42c.zip | |
Rollup merge of #128221 - calebzulawski:implied-target-features, r=Amanieu
Add implied target features to target_feature attribute See [zulip](https://rust-lang.zulipchat.com/#narrow/stream/208962-t-libs.2Fstdarch/topic/Why.20would.20target-feature.20include.20implied.20features.3F) for some context. Adds implied target features, e.g. `#[target_feature(enable = "avx2")]` acts like `#[target_feature(enable = "avx2,avx,sse4.2,sse4.1...")]`. Fixes #128125, fixes #128426 The implied feature sets are taken from [the rust reference](https://doc.rust-lang.org/reference/attributes/codegen.html?highlight=target-fea#x86-or-x86_64), there are certainly more features and targets to add. Please feel free to reassign this to whoever should review it. r? ``@Amanieu``
Diffstat (limited to 'compiler/rustc_codegen_gcc')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/attributes.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/gcc_util.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/lib.rs | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_gcc/src/attributes.rs b/compiler/rustc_codegen_gcc/src/attributes.rs index e521551304e..5fdf2680aac 100644 --- a/compiler/rustc_codegen_gcc/src/attributes.rs +++ b/compiler/rustc_codegen_gcc/src/attributes.rs @@ -75,7 +75,7 @@ pub fn from_fn_attrs<'gcc, 'tcx>( let function_features = codegen_fn_attrs .target_features .iter() - .map(|features| features.as_str()) + .map(|features| features.name.as_str()) .collect::<Vec<&str>>(); if let Some(features) = check_tied_features( diff --git a/compiler/rustc_codegen_gcc/src/gcc_util.rs b/compiler/rustc_codegen_gcc/src/gcc_util.rs index 8bb90efe6fb..5308ccdb614 100644 --- a/compiler/rustc_codegen_gcc/src/gcc_util.rs +++ b/compiler/rustc_codegen_gcc/src/gcc_util.rs @@ -65,8 +65,8 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri let feature = backend_feature_name(s)?; // Warn against use of GCC specific feature names on the CLI. - if diagnostics && !supported_features.iter().any(|&(v, _)| v == feature) { - let rust_feature = supported_features.iter().find_map(|&(rust_feature, _)| { + if diagnostics && !supported_features.iter().any(|&(v, _, _)| v == feature) { + let rust_feature = supported_features.iter().find_map(|&(rust_feature, _, _)| { let gcc_features = to_gcc_features(sess, rust_feature); if gcc_features.contains(&feature) && !gcc_features.contains(&rust_feature) { Some(rust_feature) diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index cd63a405b67..94f016234f9 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -486,7 +486,7 @@ pub fn target_features( sess.target .supported_target_features() .iter() - .filter_map(|&(feature, gate)| { + .filter_map(|&(feature, gate, _)| { if sess.is_nightly_build() || allow_unstable || gate.is_stable() { Some(feature) } else { |
