#![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 IclassSmulbbA1;
impl IclassSmulbbA1 {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let M = (data >> 6) & 1;
let M_post = M;
let field_20 = (data >> 20) & 1;
let field_20_post = field_20;
let opc = (data >> 21) & 3;
let opc_post = opc;
let N = (data >> 5) & 1;
let N_post = N;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Ra = (data >> 12) & 15;
let Ra_post = Ra;
let Rd = (data >> 16) & 15;
let Rd_post = Rd;
let field_4 = (data >> 4) & 1;
let field_4_post = field_4;
let field_27 = (data >> 23) & 31;
let field_27_post = field_27;
let cond = (data >> 28) & 15;
let cond_post = cond;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let field_7 = (data >> 7) & 1;
let field_7_post = field_7;
if ((M_post == 0) && (N_post == 0)) {
return SmulbbA1::decode(data as u32, decoder);
}
if ((M_post == 1) && (N_post == 0)) {
return SmulbtA1::decode(data as u32, decoder);
}
if ((M_post == 0) && (N_post == 1)) {
return SmultbA1::decode(data as u32, decoder);
}
if ((M_post == 1) && (N_post == 1)) {
return SmulttA1::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct SmulbbA1;
impl SmulbbA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::SMULBB
}
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 Rd = (data >> 16) & 15;
let Rd_post = Rd;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let cond_post = cond;
let op_0 = MnemonicCondition::decode(cond_post)?;
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::SMULBB_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 = instr.op0().as_mnemonic_condition()?.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 = 0b00000001011000000000000010000000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 16;
instr |= (Rn & 15) << 0;
instr |= (Rm & 15) << 8;
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(r) = 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.smulbb_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.smulbb_a1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.smulbb_a1, &instr, FormatterQualifier::Wide, false, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smulbb_a1, &instr, FormatterTextKind::Space)?;
if !instr.op1().is_none() {
fmt.format_operand(output, &config.global, &config.instructions.smulbb_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smulbb_a1, &instr, FormatterTextKind::Comma)?;
};
fmt.format_operand(output, &config.global, &config.instructions.smulbb_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smulbb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smulbb_a1, &instr, 3)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmulbbA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmulbbA1Encodings {
None
}
pub struct SmulbtA1;
impl SmulbtA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::SMULBT
}
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 Rd = (data >> 16) & 15;
let Rd_post = Rd;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let cond_post = cond;
let op_0 = MnemonicCondition::decode(cond_post)?;
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::SMULBT_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 = instr.op0().as_mnemonic_condition()?.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 = 0b00000001011000000000000011000000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 16;
instr |= (Rn & 15) << 0;
instr |= (Rm & 15) << 8;
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(r) = 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.smulbt_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.smulbt_a1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.smulbt_a1, &instr, FormatterQualifier::Wide, false, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smulbt_a1, &instr, FormatterTextKind::Space)?;
if !instr.op1().is_none() {
fmt.format_operand(output, &config.global, &config.instructions.smulbt_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smulbt_a1, &instr, FormatterTextKind::Comma)?;
};
fmt.format_operand(output, &config.global, &config.instructions.smulbt_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smulbt_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smulbt_a1, &instr, 3)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmulbtA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmulbtA1Encodings {
None
}
pub struct SmultbA1;
impl SmultbA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::SMULTB
}
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 Rd = (data >> 16) & 15;
let Rd_post = Rd;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let cond_post = cond;
let op_0 = MnemonicCondition::decode(cond_post)?;
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::SMULTB_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 = instr.op0().as_mnemonic_condition()?.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 = 0b00000001011000000000000010100000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 16;
instr |= (Rn & 15) << 0;
instr |= (Rm & 15) << 8;
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(r) = 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.smultb_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.smultb_a1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.smultb_a1, &instr, FormatterQualifier::Wide, false, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smultb_a1, &instr, FormatterTextKind::Space)?;
if !instr.op1().is_none() {
fmt.format_operand(output, &config.global, &config.instructions.smultb_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smultb_a1, &instr, FormatterTextKind::Comma)?;
};
fmt.format_operand(output, &config.global, &config.instructions.smultb_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smultb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smultb_a1, &instr, 3)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmultbA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmultbA1Encodings {
None
}
pub struct SmulttA1;
impl SmulttA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::SMULTT
}
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 Rd = (data >> 16) & 15;
let Rd_post = Rd;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let cond_post = cond;
let op_0 = MnemonicCondition::decode(cond_post)?;
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::SMULTT_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 = instr.op0().as_mnemonic_condition()?.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 = 0b00000001011000000000000011100000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 16;
instr |= (Rn & 15) << 0;
instr |= (Rm & 15) << 8;
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(r) = 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.smultt_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.smultt_a1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.smultt_a1, &instr, FormatterQualifier::Wide, false, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smultt_a1, &instr, FormatterTextKind::Space)?;
if !instr.op1().is_none() {
fmt.format_operand(output, &config.global, &config.instructions.smultt_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smultt_a1, &instr, FormatterTextKind::Comma)?;
};
fmt.format_operand(output, &config.global, &config.instructions.smultt_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smultt_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smultt_a1, &instr, 3)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmulttA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmulttA1Encodings {
None
}