#![allow(non_snake_case)]
#![allow(unused)]
use crate::error::Result;
use crate::utils::*;
use super::super::formatter::*;
use super::super::instruction::*;
use super::super::operand::*;
use super::super::consts::*;
use super::super::config::*;
use super::super::decoder::*;
pub(crate) struct IclassCrc32cbA1;
impl IclassCrc32cbA1 {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rm = (data >> 0) & 15;
let Rm_post = Rm;
let field_20 = (data >> 20) & 1;
let field_20_post = field_20;
let sz = (data >> 21) & 3;
let sz_post = sz;
let Rd = (data >> 12) & 15;
let Rd_post = Rd;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let field_8 = (data >> 4) & 31;
let field_8_post = field_8;
let field_27 = (data >> 23) & 31;
let field_27_post = field_27;
let cond = (data >> 28) & 15;
let cond_post = cond;
let C = (data >> 9) & 1;
let C_post = C;
let field_11 = (data >> 10) & 3;
let field_11_post = field_11;
if (sz_post == 0) {
return Crc32cbA1::decode(data as u32, decoder);
}
if (sz_post == 1) {
return Crc32chA1::decode(data as u32, decoder);
}
if (sz_post == 2) {
return Crc32cwA1::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct Crc32cbA1;
impl Crc32cbA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CRC32CB
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::Condition(0, false, false)
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let cond = (data >> 28) & 15;
let cond_post = cond;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let Rd = (data >> 12) & 15;
let Rd_post = Rd;
let Rm = (data >> 0) & 15;
let Rm_post = Rm;
let op_0 = MnemonicCondition::Al;
let Rd_post = Rd;
let op_1 = Register::decode(Rd_post)?;
let Rn_post = Rn;
let op_2 = Register::decode(Rn_post)?;
let Rm_post = Rm;
let op_3 = Register::decode(Rm_post)?;
let mut instr = Instruction::builder(Code::CRC32CB_A1)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let cond_pre = MnemonicCondition::Al.encode();
let Rd_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rm_pre = instr.op3().as_register()?.encode();
let cond = (cond_pre & 15);
let Rd = (Rd_pre & 15);
let Rn = (Rn_pre & 15);
let Rm = (Rm_pre & 15);
let mut instr: u32 = 0b00000001000000000000001001000000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 12;
instr |= (Rn & 15) << 16;
instr |= (Rm & 15) << 0;
let bytes = instr.to_le_bytes();
let len = bytes.len();
buf.extend(bytes);
Ok(len)
}
pub fn encode_block(instr: &mut Instruction, buf: &mut Vec<u8>, labels: &std::collections::HashMap<u64, u64>) -> Result<usize> {
Self::encode(instr, buf)
}
pub fn check_op0(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::MnemonicCondition(MnemonicCondition::Al) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op6(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn format(instr: &Instruction, fmt: &mut impl Formatter, output: &mut impl FormatterOutput, config: &Config) -> Result<()> {
fmt.format_mnemonic(output, &config.global, &config.instructions.crc32cb_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32cb_a1, &instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.crc32cb_a1, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32cb_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.crc32cb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32cb_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.crc32cb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32cb_a1, &instr, 3)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Crc32cbA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Crc32cbA1Encodings {
None
}
pub struct Crc32chA1;
impl Crc32chA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CRC32CH
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::Condition(0, false, false)
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let cond = (data >> 28) & 15;
let cond_post = cond;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let Rd = (data >> 12) & 15;
let Rd_post = Rd;
let Rm = (data >> 0) & 15;
let Rm_post = Rm;
let op_0 = MnemonicCondition::Al;
let Rd_post = Rd;
let op_1 = Register::decode(Rd_post)?;
let Rn_post = Rn;
let op_2 = Register::decode(Rn_post)?;
let Rm_post = Rm;
let op_3 = Register::decode(Rm_post)?;
let mut instr = Instruction::builder(Code::CRC32CH_A1)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let cond_pre = MnemonicCondition::Al.encode();
let Rd_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rm_pre = instr.op3().as_register()?.encode();
let cond = (cond_pre & 15);
let Rd = (Rd_pre & 15);
let Rn = (Rn_pre & 15);
let Rm = (Rm_pre & 15);
let mut instr: u32 = 0b00000001001000000000001001000000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 12;
instr |= (Rn & 15) << 16;
instr |= (Rm & 15) << 0;
let bytes = instr.to_le_bytes();
let len = bytes.len();
buf.extend(bytes);
Ok(len)
}
pub fn encode_block(instr: &mut Instruction, buf: &mut Vec<u8>, labels: &std::collections::HashMap<u64, u64>) -> Result<usize> {
Self::encode(instr, buf)
}
pub fn check_op0(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::MnemonicCondition(MnemonicCondition::Al) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op6(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn format(instr: &Instruction, fmt: &mut impl Formatter, output: &mut impl FormatterOutput, config: &Config) -> Result<()> {
fmt.format_mnemonic(output, &config.global, &config.instructions.crc32ch_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32ch_a1, &instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.crc32ch_a1, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32ch_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.crc32ch_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32ch_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.crc32ch_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32ch_a1, &instr, 3)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Crc32chA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Crc32chA1Encodings {
None
}
pub struct Crc32cwA1;
impl Crc32cwA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CRC32CW
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::Condition(0, false, false)
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let cond = (data >> 28) & 15;
let cond_post = cond;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let Rd = (data >> 12) & 15;
let Rd_post = Rd;
let Rm = (data >> 0) & 15;
let Rm_post = Rm;
let op_0 = MnemonicCondition::Al;
let Rd_post = Rd;
let op_1 = Register::decode(Rd_post)?;
let Rn_post = Rn;
let op_2 = Register::decode(Rn_post)?;
let Rm_post = Rm;
let op_3 = Register::decode(Rm_post)?;
let mut instr = Instruction::builder(Code::CRC32CW_A1)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let cond_pre = MnemonicCondition::Al.encode();
let Rd_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rm_pre = instr.op3().as_register()?.encode();
let cond = (cond_pre & 15);
let Rd = (Rd_pre & 15);
let Rn = (Rn_pre & 15);
let Rm = (Rm_pre & 15);
let mut instr: u32 = 0b00000001010000000000001001000000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 12;
instr |= (Rn & 15) << 16;
instr |= (Rm & 15) << 0;
let bytes = instr.to_le_bytes();
let len = bytes.len();
buf.extend(bytes);
Ok(len)
}
pub fn encode_block(instr: &mut Instruction, buf: &mut Vec<u8>, labels: &std::collections::HashMap<u64, u64>) -> Result<usize> {
Self::encode(instr, buf)
}
pub fn check_op0(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::MnemonicCondition(MnemonicCondition::Al) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op6(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn format(instr: &Instruction, fmt: &mut impl Formatter, output: &mut impl FormatterOutput, config: &Config) -> Result<()> {
fmt.format_mnemonic(output, &config.global, &config.instructions.crc32cw_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32cw_a1, &instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.crc32cw_a1, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32cw_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.crc32cw_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32cw_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.crc32cw_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.crc32cw_a1, &instr, 3)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Crc32cwA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Crc32cwA1Encodings {
None
}