#![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 IclassStrdIT1Off;
impl IclassStrdIT1Off {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let field_22 = (data >> 22) & 1;
let field_22_post = field_22;
let U = (data >> 23) & 1;
let U_post = U;
let Rt = (data >> 12) & 15;
let Rt_post = Rt;
let field_31 = (data >> 25) & 127;
let field_31_post = field_31;
let imm8 = (data >> 0) & 255;
let imm8_post = imm8;
let P = (data >> 24) & 1;
let P_post = P;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let L = (data >> 20) & 1;
let L_post = L;
let W = (data >> 21) & 1;
let W_post = W;
let Rt2 = (data >> 8) & 15;
let Rt2_post = Rt2;
if ((P_post == 1) && (W_post == 0)) {
return StrdIT1Off::decode(data as u32, decoder);
}
if ((P_post == 0) && (W_post == 1)) {
return StrdIT1Post::decode(data as u32, decoder);
}
if ((P_post == 1) && (W_post == 1)) {
return StrdIT1Pre::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct StrdIT1Off;
impl StrdIT1Off {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::STRD
}
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 U = (data >> 23) & 1;
let U_post = U;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let Rt = (data >> 12) & 15;
let Rt_post = Rt;
let Rt2 = (data >> 8) & 15;
let Rt2_post = Rt2;
let imm8 = (data >> 0) & 255;
let imm8_post = imm8;
let Rn_post = Rn;
let Rt2_post = Rt2;
let U_post = U;
let Rt_post = Rt;
let imm8_post = (imm8) * 4;
let op_0 = MnemonicCondition::Al;
let op_1 = Register::decode(Rt_post)?;
let op_2 = Register::decode(Rt2_post)?;
let op_3 = Register::decode(Rn_post)?;
let op_4 = PlusMinus::decode(U_post);
let op_5 = imm8_post as u32;
let mut instr = Instruction::builder(Code::STRD_i_T1_off)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.operand(4, op_4)?
.operand(5, op_5)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let Rt_pre = instr.op1().as_register()?.encode();
let Rt2_pre = instr.op2().as_register()?.encode();
let Rn_pre = instr.op3().as_register()?.encode();
let U_pre = instr.op4().as_plus_minus()?.encode();
let imm8_pre = instr.op5().as_unsigned_immediate()? as u32;
let Rt = (Rt_pre & 15);
let Rt2 = (Rt2_pre & 15);
let Rn = (Rn_pre & 15);
let U = (U_pre & 1);
let imm8_pre = (imm8_pre) / 4;
let imm8 = (imm8_pre & 255);
let mut instr: u32 = 0b11101001010000000000000000000000;
instr |= (Rt & 15) << 12;
instr |= (Rt2 & 15) << 8;
instr |= (Rn & 15) << 16;
instr |= (U & 1) << 23;
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::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<()> {
if let Operand::PlusMinus(_) = op {
return Ok(())
}
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if *i < 0 || *i > 1020 {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=1020).contains(i) {
todo!()
}
return Ok(())
}
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.strd_i_t1_off, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_off, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.strd_i_t1_off, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_off, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_off, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_off, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_off, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_off, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_off, &instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_off, &instr, 3)?;
if *instr.op4().as_plus_minus()? == PlusMinus::Minus || instr.op5().as_unsigned_immediate()? != 0 {
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_off, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_off, &instr, FormatterTextKind::NumSign)?;
if *instr.op4().as_plus_minus()? == PlusMinus::Minus {
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_off, &instr, 4)?;
};
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_off, &instr, 5)?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_off, &instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum StrdIT1OffAliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum StrdIT1OffEncodings {
None
}
pub struct StrdIT1Post;
impl StrdIT1Post {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::STRD
}
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 U = (data >> 23) & 1;
let U_post = U;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let Rt = (data >> 12) & 15;
let Rt_post = Rt;
let Rt2 = (data >> 8) & 15;
let Rt2_post = Rt2;
let imm8 = (data >> 0) & 255;
let imm8_post = imm8;
let Rn_post = Rn;
let Rt2_post = Rt2;
let U_post = U;
let Rt_post = Rt;
let imm8_post = (imm8) * 4;
let op_0 = MnemonicCondition::Al;
let op_1 = Register::decode(Rt_post)?;
let op_2 = Register::decode(Rt2_post)?;
let op_3 = Register::decode(Rn_post)?;
let op_4 = PlusMinus::decode(U_post);
let op_5 = imm8_post as u32;
let mut instr = Instruction::builder(Code::STRD_i_T1_post)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.operand(4, op_4)?
.operand(5, op_5)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let Rt_pre = instr.op1().as_register()?.encode();
let Rt2_pre = instr.op2().as_register()?.encode();
let Rn_pre = instr.op3().as_register()?.encode();
let U_pre = instr.op4().as_plus_minus()?.encode();
let imm8_pre = instr.op5().as_unsigned_immediate()? as u32;
let Rt = (Rt_pre & 15);
let Rt2 = (Rt2_pre & 15);
let Rn = (Rn_pre & 15);
let U = (U_pre & 1);
let imm8_pre = (imm8_pre) / 4;
let imm8 = (imm8_pre & 255);
let mut instr: u32 = 0b11101000011000000000000000000000;
instr |= (Rt & 15) << 12;
instr |= (Rt2 & 15) << 8;
instr |= (Rn & 15) << 16;
instr |= (U & 1) << 23;
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::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<()> {
if let Operand::PlusMinus(_) = op {
return Ok(())
}
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if *i < 0 || *i > 1020 {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=1020).contains(i) {
todo!()
}
return Ok(())
}
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.strd_i_t1_post, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_post, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.strd_i_t1_post, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_post, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_post, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_post, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_post, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_post, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_post, &instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_post, &instr, 3)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_post, &instr, FormatterTextKind::BracketRight)?;;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_post, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_post, &instr, FormatterTextKind::NumSign)?;
if *instr.op4().as_plus_minus()? == PlusMinus::Minus {
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_post, &instr, 4)?;
};
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_post, &instr, 5)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum StrdIT1PostAliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum StrdIT1PostEncodings {
None
}
pub struct StrdIT1Pre;
impl StrdIT1Pre {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::STRD
}
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 U = (data >> 23) & 1;
let U_post = U;
let Rn = (data >> 16) & 15;
let Rn_post = Rn;
let Rt = (data >> 12) & 15;
let Rt_post = Rt;
let Rt2 = (data >> 8) & 15;
let Rt2_post = Rt2;
let imm8 = (data >> 0) & 255;
let imm8_post = imm8;
let Rn_post = Rn;
let Rt2_post = Rt2;
let U_post = U;
let Rt_post = Rt;
let imm8_post = (imm8) * 4;
let op_0 = MnemonicCondition::Al;
let op_1 = Register::decode(Rt_post)?;
let op_2 = Register::decode(Rt2_post)?;
let op_3 = Register::decode(Rn_post)?;
let op_4 = PlusMinus::decode(U_post);
let op_5 = imm8_post as u32;
let mut instr = Instruction::builder(Code::STRD_i_T1_pre)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.operand(4, op_4)?
.operand(5, op_5)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let Rt_pre = instr.op1().as_register()?.encode();
let Rt2_pre = instr.op2().as_register()?.encode();
let Rn_pre = instr.op3().as_register()?.encode();
let U_pre = instr.op4().as_plus_minus()?.encode();
let imm8_pre = instr.op5().as_unsigned_immediate()? as u32;
let Rt = (Rt_pre & 15);
let Rt2 = (Rt2_pre & 15);
let Rn = (Rn_pre & 15);
let U = (U_pre & 1);
let imm8_pre = (imm8_pre) / 4;
let imm8 = (imm8_pre & 255);
let mut instr: u32 = 0b11101001011000000000000000000000;
instr |= (Rt & 15) << 12;
instr |= (Rt2 & 15) << 8;
instr |= (Rn & 15) << 16;
instr |= (U & 1) << 23;
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::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<()> {
if let Operand::PlusMinus(_) = op {
return Ok(())
}
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if *i < 0 || *i > 1020 {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=1020).contains(i) {
todo!()
}
return Ok(())
}
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.strd_i_t1_pre, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, 3)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, FormatterTextKind::NumSign)?;
if *instr.op4().as_plus_minus()? == PlusMinus::Minus {
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, 4)?;
};
fmt.format_operand(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, 5)?;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, FormatterTextKind::BracketRight)?;;
fmt.format_punctuation(output, &config.global, &config.instructions.strd_i_t1_pre, &instr, FormatterTextKind::ExclamationMark)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum StrdIT1PreAliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum StrdIT1PreEncodings {
None
}