diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-05-12 18:57:24 +0200 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-05-12 18:57:24 +0200 |
| commit | df88c118673c430fadefd98f7a29f436e63f14a2 (patch) | |
| tree | 24abab032f2d6734784fecd37a11e8a62e884e5b /src | |
| parent | cba05a7a14b307d31b226a11c2104e53c2ae1291 (diff) | |
Use the target cpu from the target spec on x86_64 when -Ctarget-cpu isn't used
Fixes rust-lang/rustc_codegen_cranelift#1148
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs index e72951b6f34..39bbad16b0c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -331,9 +331,9 @@ fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Arc<dyn TargetIs sess.dcx().fatal(format!("can't compile for {}: {}", target_triple, err)); }); if target_triple.architecture == target_lexicon::Architecture::X86_64 { - // Don't use "haswell" as the default, as it implies `has_lzcnt`. - // macOS CI is still at Ivy Bridge EP, so `lzcnt` is interpreted as `bsr`. - builder.enable("nehalem").unwrap(); + // Only set the target cpu on x86_64 as Cranelift is missing + // the target cpu list for most other targets. + builder.enable(sess.target.cpu.as_ref()).unwrap(); } builder } |
