diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-02-15 14:33:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-15 14:33:01 +0100 |
| commit | 7d6c99dd066f3c84f694fc00c4865758d6ecd772 (patch) | |
| tree | 867b999891b0339a9f83479dd1442adbd4368014 /compiler/rustc_codegen_llvm/src | |
| parent | bf323ba3ac28bf22fed5213695b63d58d1022361 (diff) | |
| parent | 369fff6c0640fe89be9b915adaa83e66a022e00d (diff) | |
| download | rust-7d6c99dd066f3c84f694fc00c4865758d6ecd772.tar.gz rust-7d6c99dd066f3c84f694fc00c4865758d6ecd772.zip | |
Rollup merge of #121088 - nikic:evex512, r=Amanieu
Implicitly enable evex512 if avx512 is enabled LLVM 18 requires the evex512 feature to allow use of zmm registers. LLVM automatically sets it when using a generic CPU, but not when `-C target-cpu` is specified. This will result either in backend legalization crashes, or code unexpectedly using ymm instead of zmm registers. For now, make sure that `avx512*` features imply `evex512`. Long term we'll probably have to deal with the AVX10 mess somehow. Fixes https://github.com/rust-lang/rust/issues/121081. r? `@Amanieu`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index e48479c8da2..54e8ed85e32 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -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), } } |
