Port Fence, IsNull/IsInvalid & Debugtrap to ISLE (AArch64) (#4548)
Ported the existing implementation of the following Opcodes for AArch64 to ISLE: - `Fence` - `IsNull` - `IsInvalid` - `Debugtrap` Copyright (c) 2022 Arm Limited
This commit is contained in:
@@ -254,9 +254,7 @@ pub(crate) fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
|
||||
|
||||
Opcode::AtomicStore => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::Fence => {
|
||||
ctx.emit(Inst::Fence {});
|
||||
}
|
||||
Opcode::Fence => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::StackLoad
|
||||
| Opcode::StackStore
|
||||
@@ -399,34 +397,7 @@ pub(crate) fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
|
||||
materialize_bool_result(ctx, insn, rd, cond);
|
||||
}
|
||||
|
||||
Opcode::IsNull | Opcode::IsInvalid => {
|
||||
// Null references are represented by the constant value 0; invalid references are
|
||||
// represented by the constant value -1. See `define_reftypes()` in
|
||||
// `meta/src/isa/x86/encodings.rs` to confirm.
|
||||
let rd = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
|
||||
let rn = put_input_in_reg(ctx, inputs[0], NarrowValueMode::None);
|
||||
let ty = ctx.input_ty(insn, 0);
|
||||
let (alu_op, const_value) = match op {
|
||||
Opcode::IsNull => {
|
||||
// cmp rn, #0
|
||||
(ALUOp::SubS, 0)
|
||||
}
|
||||
Opcode::IsInvalid => {
|
||||
// cmn rn, #1
|
||||
(ALUOp::AddS, 1)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let const_value = ResultRSEImm12::Imm12(Imm12::maybe_from_u64(const_value).unwrap());
|
||||
ctx.emit(alu_inst_imm12(
|
||||
alu_op,
|
||||
ty,
|
||||
writable_zero_reg(),
|
||||
rn,
|
||||
const_value,
|
||||
));
|
||||
materialize_bool_result(ctx, insn, rd, Cond::Eq);
|
||||
}
|
||||
Opcode::IsNull | Opcode::IsInvalid => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::Copy => {
|
||||
let rd = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
|
||||
@@ -546,9 +517,7 @@ pub(crate) fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
|
||||
}
|
||||
}
|
||||
|
||||
Opcode::Debugtrap => {
|
||||
ctx.emit(Inst::Brk);
|
||||
}
|
||||
Opcode::Debugtrap => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::Trap | Opcode::ResumableTrap => implemented_in_isle(ctx),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user