cranelift: Native feature detection for RISC-V (#5044)
* cranelift: Native feature detection for RISC-V * cranelift: Typo fix Thanks @cfallin
This commit is contained in:
@@ -47,30 +47,6 @@ fn build_host_isa(
|
||||
builder.finish(flags).unwrap()
|
||||
}
|
||||
|
||||
fn is_riscv64_compatible(
|
||||
host: target_lexicon::Riscv64Architecture,
|
||||
req: target_lexicon::Riscv64Architecture,
|
||||
) -> bool {
|
||||
match host {
|
||||
// Riscv64gc is short for RV64IMAFDCZicsr_Zifencei.
|
||||
// So can run them all.
|
||||
target_lexicon::Riscv64Architecture::Riscv64gc => true,
|
||||
// Riscv64imac can run when req is not Riscv64gc.
|
||||
target_lexicon::Riscv64Architecture::Riscv64imac
|
||||
if req != target_lexicon::Riscv64Architecture::Riscv64gc =>
|
||||
{
|
||||
true
|
||||
}
|
||||
// Riscv64 is just basic extension.
|
||||
target_lexicon::Riscv64Architecture::Riscv64
|
||||
if req == target_lexicon::Riscv64Architecture::Riscv64 =>
|
||||
{
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if the host's ISA is compatible with the one requested by the test.
|
||||
fn is_isa_compatible(
|
||||
file_path: &str,
|
||||
@@ -85,8 +61,7 @@ fn is_isa_compatible(
|
||||
|
||||
match (host_arch, requested_arch) {
|
||||
(host, requested) if host == requested => {}
|
||||
(Architecture::Riscv64(host), Architecture::Riscv64(req))
|
||||
if is_riscv64_compatible(host, req) => {}
|
||||
(Architecture::Riscv64(_), Architecture::Riscv64(_)) => {}
|
||||
_ => {
|
||||
return Err(format!(
|
||||
"skipped {}: host can't run {:?} programs",
|
||||
|
||||
Reference in New Issue
Block a user