Skip to content

Commit df88c11

Browse files
committed
Use the target cpu from the target spec on x86_64 when -Ctarget-cpu isn't used
Fixes rust-lang/rustc_codegen_cranelift#1148
1 parent cba05a7 commit df88c11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,9 @@ fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Arc<dyn TargetIs
331331
sess.dcx().fatal(format!("can't compile for {}: {}", target_triple, err));
332332
});
333333
if target_triple.architecture == target_lexicon::Architecture::X86_64 {
334-
// Don't use "haswell" as the default, as it implies `has_lzcnt`.
335-
// macOS CI is still at Ivy Bridge EP, so `lzcnt` is interpreted as `bsr`.
336-
builder.enable("nehalem").unwrap();
334+
// Only set the target cpu on x86_64 as Cranelift is missing
335+
// the target cpu list for most other targets.
336+
builder.enable(sess.target.cpu.as_ref()).unwrap();
337337
}
338338
builder
339339
}

0 commit comments

Comments
 (0)