Merge pull request #2364 from fitzgen/peepmatic-rebuild-test
peepmatic: Make the test-we-can-get-and-rebuild peephole optimizers test work on arm64
This commit is contained in:
@@ -1312,19 +1312,31 @@ unsafe impl<'a, 'b> InstructionSet<'b> for &'a dyn TargetIsa {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[cfg(feature = "x86")]
|
#[cfg(any(feature = "x64", feature = "x86", feature = "arm64"))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::isa::lookup;
|
use crate::isa::{lookup, TargetIsa};
|
||||||
use crate::settings::{builder, Flags};
|
use crate::settings::{builder, Flags};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use target_lexicon::triple;
|
use target_lexicon::triple;
|
||||||
|
|
||||||
|
fn isa() -> Box<dyn TargetIsa> {
|
||||||
|
// We need a triple to instantiate and run the peephole optimizer, but we
|
||||||
|
// don't care which one when we're just trying to trigger a rebuild of the
|
||||||
|
// peephole optimizer (it doesn't affect the serialized bytes at all).
|
||||||
|
let triple = if cfg!(any(feature = "x64", feature = "x86")) {
|
||||||
|
triple!("x86_64")
|
||||||
|
} else if cfg!(feature = "arm64") {
|
||||||
|
triple!("aarch64")
|
||||||
|
} else {
|
||||||
|
panic!("unknown arch")
|
||||||
|
};
|
||||||
|
lookup(triple).unwrap().finish(Flags::new(builder()))
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn get_peepmatic_preopt() {
|
fn get_peepmatic_preopt() {
|
||||||
let isa = lookup(triple!("x86_64"))
|
let isa = isa();
|
||||||
.expect("expect x86 ISA")
|
|
||||||
.finish(Flags::new(builder()));
|
|
||||||
let _ = preopt(&*isa);
|
let _ = preopt(&*isa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user