x64: Migrate trapif and trapff to ISLE (#4545)
https://github.com/bytecodealliance/wasmtime/pull/4545
This commit is contained in:
@@ -1476,6 +1476,44 @@ pub(crate) fn emit(
|
||||
sink.bind_label(else_label);
|
||||
}
|
||||
|
||||
Inst::TrapIfAnd {
|
||||
cc1,
|
||||
cc2,
|
||||
trap_code,
|
||||
} => {
|
||||
let else_label = sink.get_label();
|
||||
|
||||
// Jump over if either condition code is not set.
|
||||
one_way_jmp(sink, cc1.invert(), else_label);
|
||||
one_way_jmp(sink, cc2.invert(), else_label);
|
||||
|
||||
// Trap!
|
||||
let inst = Inst::trap(*trap_code);
|
||||
inst.emit(&[], sink, info, state);
|
||||
|
||||
sink.bind_label(else_label);
|
||||
}
|
||||
|
||||
Inst::TrapIfOr {
|
||||
cc1,
|
||||
cc2,
|
||||
trap_code,
|
||||
} => {
|
||||
let trap_label = sink.get_label();
|
||||
let else_label = sink.get_label();
|
||||
|
||||
// trap immediately if cc1 is set, otherwise jump over the trap if cc2 is not.
|
||||
one_way_jmp(sink, *cc1, trap_label);
|
||||
one_way_jmp(sink, cc2.invert(), else_label);
|
||||
|
||||
// Trap!
|
||||
sink.bind_label(trap_label);
|
||||
let inst = Inst::trap(*trap_code);
|
||||
inst.emit(&[], sink, info, state);
|
||||
|
||||
sink.bind_label(else_label);
|
||||
}
|
||||
|
||||
Inst::XmmUnaryRmR {
|
||||
op,
|
||||
src: src_e,
|
||||
|
||||
@@ -105,6 +105,8 @@ impl Inst {
|
||||
| Inst::ShiftR { .. }
|
||||
| Inst::SignExtendData { .. }
|
||||
| Inst::TrapIf { .. }
|
||||
| Inst::TrapIfAnd { .. }
|
||||
| Inst::TrapIfOr { .. }
|
||||
| Inst::Ud2 { .. }
|
||||
| Inst::VirtualSPOffsetAdj { .. }
|
||||
| Inst::XmmCmove { .. }
|
||||
@@ -1664,6 +1666,34 @@ impl PrettyPrint for Inst {
|
||||
format!("j{} ; ud2 {} ;", cc.invert().to_string(), trap_code)
|
||||
}
|
||||
|
||||
Inst::TrapIfAnd {
|
||||
cc1,
|
||||
cc2,
|
||||
trap_code,
|
||||
..
|
||||
} => {
|
||||
format!(
|
||||
"trap_if_and {}, {}, {}",
|
||||
cc1.invert().to_string(),
|
||||
cc2.invert().to_string(),
|
||||
trap_code
|
||||
)
|
||||
}
|
||||
|
||||
Inst::TrapIfOr {
|
||||
cc1,
|
||||
cc2,
|
||||
trap_code,
|
||||
..
|
||||
} => {
|
||||
format!(
|
||||
"trap_if_or {}, {}, {}",
|
||||
cc1.to_string(),
|
||||
cc2.invert().to_string(),
|
||||
trap_code
|
||||
)
|
||||
}
|
||||
|
||||
Inst::LoadExtName {
|
||||
dst, name, offset, ..
|
||||
} => {
|
||||
@@ -2146,6 +2176,8 @@ fn x64_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut OperandCol
|
||||
| Inst::JmpCond { .. }
|
||||
| Inst::Nop { .. }
|
||||
| Inst::TrapIf { .. }
|
||||
| Inst::TrapIfAnd { .. }
|
||||
| Inst::TrapIfOr { .. }
|
||||
| Inst::VirtualSPOffsetAdj { .. }
|
||||
| Inst::Hlt
|
||||
| Inst::Ud2 { .. }
|
||||
|
||||
Reference in New Issue
Block a user