cranelift_fuzzgen/
target_isa_extras.rs

1use cranelift::prelude::isa::TargetIsa;
2use target_lexicon::Architecture;
3
4pub trait TargetIsaExtras {
5    fn supports_simd(&self) -> bool;
6}
7
8impl TargetIsaExtras for &dyn TargetIsa {
9    fn supports_simd(&self) -> bool {
10        match self.triple().architecture {
11            // RISC-V only supports SIMD with the V extension.
12            Architecture::Riscv64(_) => self
13                .isa_flags()
14                .iter()
15                .find(|f| f.name == "has_v")
16                .and_then(|f| f.as_bool())
17                .unwrap_or(false),
18            _ => true,
19        }
20    }
21}