Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicitly enable evex512 if avx512 is enabled #121088

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> LLVMFeature<'a> {
("riscv32" | "riscv64", "fast-unaligned-access") if get_version().0 <= 17 => {
LLVMFeature::new("unaligned-scalar-mem")
}
// For LLVM 18, enable the evex512 target feature if a avx512 target feature is enabled.
("x86", s) if get_version().0 >= 18 && s.starts_with("avx512") => {
LLVMFeature::with_dependency(s, TargetFeatureFoldStrength::EnableOnly("evex512"))
}
(_, s) => LLVMFeature::new(s),
}
}
Expand Down
15 changes: 15 additions & 0 deletions tests/ui/asm/x86_64/evex512-implicit-feature.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// build-pass
// only-x86_64
// compile-flags: --crate-type=lib -C target-cpu=skylake

#![feature(avx512_target_feature)]
#![feature(stdarch_x86_avx512)]

use std::arch::x86_64::*;

#[target_feature(enable = "avx512f")]
#[no_mangle]
pub unsafe fn test(res: *mut f64, p: *const f64) {
let arg = _mm512_load_pd(p);
_mm512_store_pd(res, _mm512_fmaddsub_pd(arg, arg, arg));
}
Loading