#![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 IclassPldIT1;
impl IclassPldIT1 {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rt = (data >> 12) & 15;
let Rt_post = Rt;
let imm12 = (data >> 0) & 4095;
let imm12_post = imm12;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let L = (data >> 20) & 1;
let L_post = L;
let field_31 = (data >> 22) & 1023;
let field_31_post = field_31;
let W = (data >> 21) & 1;
let W_post = W;
if (W_post == 0) {
return PldIT1::decode(data as u32, decoder);
}
if (W_post == 1) {
return PldwIT1::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct PldIT1;
impl PldIT1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::PLD
}
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 Rn = (data >> 16) & 15;
let Rn_post = Rn;
let imm12 = (data >> 0) & 4095;
let imm12_post = imm12;
let Rn_post = Rn;
let imm12_post = imm12;
let op_0 = MnemonicCondition::Al;
let op_1 = Register::decode(Rn_post)?;
let op_2 = imm12_post as u32;
let mut instr = Instruction::builder(Code::PLD_i_T1)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let Rn_pre = instr.op1().as_register()?.encode();
let imm12_pre = instr.op2().as_unsigned_immediate()? as u32;
let Rn = (Rn_pre & 15);
let imm12_pre = imm12_pre;
let imm12 = (imm12_pre & 4095);
let mut instr: u32 = 0b11111000100100001111000000000000;
instr |= (Rn & 15) << 16;
instr |= (imm12 & 4095) << 0;
let instr_1 = (instr & 0xffff) as u16;
let instr_2 = ((instr >> 16) & 0xffff) as u16;
buf.extend(instr_2.to_le_bytes());
buf.extend(instr_1.to_le_bytes());
Ok(4)
}
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::SignedImmediate(i) = op {
if *i < 0 || *i > 4095 {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=4095).contains(i) {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
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.pld_i_t1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.pld_i_t1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.pld_i_t1, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t1, &instr, FormatterTextKind::Space)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t1, &instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.pld_i_t1, &instr, 1)?;
if instr.op2().as_unsigned_immediate()? != 0 {
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t1, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t1, &instr, FormatterTextKind::NumSign)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t1, &instr, FormatterTextKind::Plus)?;
;
fmt.format_operand(output, &config.global, &config.instructions.pld_i_t1, &instr, 2)?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t1, &instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum PldIT1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum PldIT1Encodings {
None
}
pub struct PldwIT1;
impl PldwIT1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::PLDW
}
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 Rn = (data >> 16) & 15;
let Rn_post = Rn;
let imm12 = (data >> 0) & 4095;
let imm12_post = imm12;
let Rn_post = Rn;
let imm12_post = imm12;
let op_0 = MnemonicCondition::Al;
let op_1 = Register::decode(Rn_post)?;
let op_2 = imm12_post as u32;
let mut instr = Instruction::builder(Code::PLDW_i_T1)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let Rn_pre = instr.op1().as_register()?.encode();
let imm12_pre = instr.op2().as_unsigned_immediate()? as u32;
let Rn = (Rn_pre & 15);
let imm12_pre = imm12_pre;
let imm12 = (imm12_pre & 4095);
let mut instr: u32 = 0b11111000101100001111000000000000;
instr |= (Rn & 15) << 16;
instr |= (imm12 & 4095) << 0;
let instr_1 = (instr & 0xffff) as u16;
let instr_2 = ((instr >> 16) & 0xffff) as u16;
buf.extend(instr_2.to_le_bytes());
buf.extend(instr_1.to_le_bytes());
Ok(4)
}
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::SignedImmediate(i) = op {
if *i < 0 || *i > 4095 {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=4095).contains(i) {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
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.pldw_i_t1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.pldw_i_t1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.pldw_i_t1, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t1, &instr, FormatterTextKind::Space)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t1, &instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.pldw_i_t1, &instr, 1)?;
if instr.op2().as_unsigned_immediate()? != 0 {
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t1, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t1, &instr, FormatterTextKind::NumSign)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t1, &instr, FormatterTextKind::Plus)?;
;
fmt.format_operand(output, &config.global, &config.instructions.pldw_i_t1, &instr, 2)?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t1, &instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum PldwIT1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum PldwIT1Encodings {
None
}
pub(crate) struct IclassPldIT2;
impl IclassPldIT2 {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rt = (data >> 12) & 15;
let Rt_post = Rt;
let field_11 = (data >> 11) & 1;
let field_11_post = field_11;
let imm8 = (data >> 0) & 255;
let imm8_post = imm8;
let U = (data >> 9) & 1;
let U_post = U;
let field_8 = (data >> 8) & 1;
let field_8_post = field_8;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let L = (data >> 20) & 1;
let L_post = L;
let P = (data >> 10) & 1;
let P_post = P;
let field_31 = (data >> 22) & 1023;
let field_31_post = field_31;
let W = (data >> 21) & 1;
let W_post = W;
if (W_post == 0) {
return PldIT2::decode(data as u32, decoder);
}
if (W_post == 1) {
return PldwIT2::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct PldIT2;
impl PldIT2 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::PLD
}
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 Rn = (data >> 16) & 15;
let Rn_post = Rn;
let imm8 = (data >> 0) & 255;
let imm8_post = imm8;
let imm8_post = imm8;
let Rn_post = Rn;
let op_0 = MnemonicCondition::Al;
let op_1 = Register::decode(Rn_post)?;
let op_2 = imm8_post as u32;
let mut instr = Instruction::builder(Code::PLD_i_T2)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let Rn_pre = instr.op1().as_register()?.encode();
let imm8_pre = instr.op2().as_unsigned_immediate()? as u32;
let Rn = (Rn_pre & 15);
let imm8_pre = imm8_pre;
let imm8 = (imm8_pre & 255);
let mut instr: u32 = 0b11111000000100001111110000000000;
instr |= (Rn & 15) << 16;
instr |= (imm8 & 255) << 0;
let instr_1 = (instr & 0xffff) as u16;
let instr_2 = ((instr >> 16) & 0xffff) as u16;
buf.extend(instr_2.to_le_bytes());
buf.extend(instr_1.to_le_bytes());
Ok(4)
}
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::SignedImmediate(i) = op {
if *i < 0 || *i > 255 {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=255).contains(i) {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
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.pld_i_t2, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.pld_i_t2, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.pld_i_t2, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t2, &instr, FormatterTextKind::Space)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t2, &instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.pld_i_t2, &instr, 1)?;
if true || instr.op2().as_unsigned_immediate()? != 0 {
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t2, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t2, &instr, FormatterTextKind::NumSign)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t2, &instr, FormatterTextKind::Minus)?;
fmt.format_operand(output, &config.global, &config.instructions.pld_i_t2, &instr, 2)?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.pld_i_t2, &instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum PldIT2Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum PldIT2Encodings {
None
}
pub struct PldwIT2;
impl PldwIT2 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::PLDW
}
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 Rn = (data >> 16) & 15;
let Rn_post = Rn;
let imm8 = (data >> 0) & 255;
let imm8_post = imm8;
let imm8_post = imm8;
let Rn_post = Rn;
let op_0 = MnemonicCondition::Al;
let op_1 = Register::decode(Rn_post)?;
let op_2 = imm8_post as u32;
let mut instr = Instruction::builder(Code::PLDW_i_T2)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let Rn_pre = instr.op1().as_register()?.encode();
let imm8_pre = instr.op2().as_unsigned_immediate()? as u32;
let Rn = (Rn_pre & 15);
let imm8_pre = imm8_pre;
let imm8 = (imm8_pre & 255);
let mut instr: u32 = 0b11111000001100001111110000000000;
instr |= (Rn & 15) << 16;
instr |= (imm8 & 255) << 0;
let instr_1 = (instr & 0xffff) as u16;
let instr_2 = ((instr >> 16) & 0xffff) as u16;
buf.extend(instr_2.to_le_bytes());
buf.extend(instr_1.to_le_bytes());
Ok(4)
}
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::SignedImmediate(i) = op {
if *i < 0 || *i > 255 {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=255).contains(i) {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
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.pldw_i_t2, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.pldw_i_t2, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.pldw_i_t2, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t2, &instr, FormatterTextKind::Space)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t2, &instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.pldw_i_t2, &instr, 1)?;
if true || instr.op2().as_unsigned_immediate()? != 0 {
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t2, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t2, &instr, FormatterTextKind::NumSign)?;
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t2, &instr, FormatterTextKind::Minus)?;
fmt.format_operand(output, &config.global, &config.instructions.pldw_i_t2, &instr, 2)?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.pldw_i_t2, &instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum PldwIT2Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum PldwIT2Encodings {
None
}