#![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 IclassLdp32LdstpairPost;
impl IclassLdp32LdstpairPost {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let imm7 = (data >> 15) & 127;
let imm7_post = imm7;
let VR = (data >> 26) & 1;
let VR_post = VR;
let field_25 = (data >> 23) & 7;
let field_25_post = field_25;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let opc = (data >> 30) & 3;
let opc_post = opc;
let L = (data >> 22) & 1;
let L_post = L;
let field_29 = (data >> 27) & 7;
let field_29_post = field_29;
if (opc_post == 0) {
return Ldp32LdstpairPost::decode(data as u32, decoder);
}
if (opc_post == 2) {
return Ldp64LdstpairPost::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct Ldp32LdstpairPost;
impl Ldp32LdstpairPost {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::LDP
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let imm7 = (data >> 15) & 127;
let imm7_post = imm7;
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rt_post = Rt;
let op_0 = Register::aarch32(Rt_post, false)?;
let Rt2_post = Rt2;
let op_1 = Register::aarch32(Rt2_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let imm7_post = ((((imm7) as i32) * 4) << 23) >> 23;
let op_3 = imm7_post as i32;
let mut instr = Instruction::builder(Code::LDP_32_ldstpair_post)
.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 Rt_pre = instr.op0().as_register()?.encode();
let Rt2_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let imm7_pre = instr.op3().as_signed_immediate()? as u32;
let Rt = (Rt_pre & 31);
let Rt2 = (Rt2_pre & 31);
let Rn = (Rn_pre & 31);
let imm7_pre = ((imm7_pre) / 4) as u32;
let imm7 = (imm7_pre & 127);
let mut instr: u32 = 0b00101000110000000000000000000000;
instr |= (Rt & 31) << 0;
instr |= (Rt2 & 31) << 10;
instr |= (Rn & 31) << 5;
instr |= (imm7 & 127) << 15;
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::Register(r) = op {
if !r.is_aarch32() {
todo!()
}
if *r == Register::WSP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch32() {
todo!()
}
if *r == Register::WSP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::XZR {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if !(-256..=252).contains(i) {
todo!()
}
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.ldp_32_ldstpair_post, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, FormatterTextKind::BracketRight)?;;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, FormatterTextKind::NumSign)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_post, instr, 3)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Ldp32LdstpairPostAliases {
None,
}
pub struct Ldp64LdstpairPost;
impl Ldp64LdstpairPost {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::LDP
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let imm7 = (data >> 15) & 127;
let imm7_post = imm7;
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rt_post = Rt;
let op_0 = Register::aarch64(Rt_post, false)?;
let Rt2_post = Rt2;
let op_1 = Register::aarch64(Rt2_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let imm7_post = ((((imm7) as i32) * 8) << 22) >> 22;
let op_3 = imm7_post as i32;
let mut instr = Instruction::builder(Code::LDP_64_ldstpair_post)
.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 Rt_pre = instr.op0().as_register()?.encode();
let Rt2_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let imm7_pre = instr.op3().as_signed_immediate()? as u32;
let Rt = (Rt_pre & 31);
let Rt2 = (Rt2_pre & 31);
let Rn = (Rn_pre & 31);
let imm7_pre = ((imm7_pre) / 8) as u32;
let imm7 = (imm7_pre & 127);
let mut instr: u32 = 0b10101000110000000000000000000000;
instr |= (Rt & 31) << 0;
instr |= (Rt2 & 31) << 10;
instr |= (Rn & 31) << 5;
instr |= (imm7 & 127) << 15;
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::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::SP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::SP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::XZR {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if !(-512..=504).contains(i) {
todo!()
}
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.ldp_64_ldstpair_post, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, FormatterTextKind::BracketRight)?;;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, FormatterTextKind::NumSign)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_post, instr, 3)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Ldp64LdstpairPostAliases {
None,
}
pub(crate) struct IclassLdp32LdstpairPre;
impl IclassLdp32LdstpairPre {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let imm7 = (data >> 15) & 127;
let imm7_post = imm7;
let VR = (data >> 26) & 1;
let VR_post = VR;
let field_25 = (data >> 23) & 7;
let field_25_post = field_25;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let opc = (data >> 30) & 3;
let opc_post = opc;
let L = (data >> 22) & 1;
let L_post = L;
let field_29 = (data >> 27) & 7;
let field_29_post = field_29;
if (opc_post == 0) {
return Ldp32LdstpairPre::decode(data as u32, decoder);
}
if (opc_post == 2) {
return Ldp64LdstpairPre::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct Ldp32LdstpairPre;
impl Ldp32LdstpairPre {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::LDP
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let imm7 = (data >> 15) & 127;
let imm7_post = imm7;
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rt_post = Rt;
let op_0 = Register::aarch32(Rt_post, false)?;
let Rt2_post = Rt2;
let op_1 = Register::aarch32(Rt2_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let imm7_post = ((((imm7) as i32) * 4) << 23) >> 23;
let op_3 = imm7_post as i32;
let mut instr = Instruction::builder(Code::LDP_32_ldstpair_pre)
.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 Rt_pre = instr.op0().as_register()?.encode();
let Rt2_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let imm7_pre = instr.op3().as_signed_immediate()? as u32;
let Rt = (Rt_pre & 31);
let Rt2 = (Rt2_pre & 31);
let Rn = (Rn_pre & 31);
let imm7_pre = ((imm7_pre) / 4) as u32;
let imm7 = (imm7_pre & 127);
let mut instr: u32 = 0b00101001110000000000000000000000;
instr |= (Rt & 31) << 0;
instr |= (Rt2 & 31) << 10;
instr |= (Rn & 31) << 5;
instr |= (imm7 & 127) << 15;
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::Register(r) = op {
if !r.is_aarch32() {
todo!()
}
if *r == Register::WSP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch32() {
todo!()
}
if *r == Register::WSP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::XZR {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if !(-256..=252).contains(i) {
todo!()
}
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.ldp_32_ldstpair_pre, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, FormatterTextKind::NumSign)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, 3)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, FormatterTextKind::BracketRight)?;;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_pre, instr, FormatterTextKind::ExclamationMark)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Ldp32LdstpairPreAliases {
None,
}
pub struct Ldp64LdstpairPre;
impl Ldp64LdstpairPre {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::LDP
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let imm7 = (data >> 15) & 127;
let imm7_post = imm7;
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rt_post = Rt;
let op_0 = Register::aarch64(Rt_post, false)?;
let Rt2_post = Rt2;
let op_1 = Register::aarch64(Rt2_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let imm7_post = ((((imm7) as i32) * 8) << 22) >> 22;
let op_3 = imm7_post as i32;
let mut instr = Instruction::builder(Code::LDP_64_ldstpair_pre)
.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 Rt_pre = instr.op0().as_register()?.encode();
let Rt2_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let imm7_pre = instr.op3().as_signed_immediate()? as u32;
let Rt = (Rt_pre & 31);
let Rt2 = (Rt2_pre & 31);
let Rn = (Rn_pre & 31);
let imm7_pre = ((imm7_pre) / 8) as u32;
let imm7 = (imm7_pre & 127);
let mut instr: u32 = 0b10101001110000000000000000000000;
instr |= (Rt & 31) << 0;
instr |= (Rt2 & 31) << 10;
instr |= (Rn & 31) << 5;
instr |= (imm7 & 127) << 15;
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::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::SP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::SP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::XZR {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if !(-512..=504).contains(i) {
todo!()
}
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.ldp_64_ldstpair_pre, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, FormatterTextKind::NumSign)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, 3)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, FormatterTextKind::BracketRight)?;;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_pre, instr, FormatterTextKind::ExclamationMark)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Ldp64LdstpairPreAliases {
None,
}
pub(crate) struct IclassLdp32LdstpairOff;
impl IclassLdp32LdstpairOff {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let imm7 = (data >> 15) & 127;
let imm7_post = imm7;
let VR = (data >> 26) & 1;
let VR_post = VR;
let field_25 = (data >> 23) & 7;
let field_25_post = field_25;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let opc = (data >> 30) & 3;
let opc_post = opc;
let L = (data >> 22) & 1;
let L_post = L;
let field_29 = (data >> 27) & 7;
let field_29_post = field_29;
if (opc_post == 0) {
return Ldp32LdstpairOff::decode(data as u32, decoder);
}
if (opc_post == 2) {
return Ldp64LdstpairOff::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct Ldp32LdstpairOff;
impl Ldp32LdstpairOff {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::LDP
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let imm7 = (data >> 15) & 127;
let imm7_post = imm7;
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rt_post = Rt;
let op_0 = Register::aarch32(Rt_post, false)?;
let Rt2_post = Rt2;
let op_1 = Register::aarch32(Rt2_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let imm7_post = ((((imm7) as i32) * 4) << 23) >> 23;
let op_3 = imm7_post as i32;
let mut instr = Instruction::builder(Code::LDP_32_ldstpair_off)
.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 Rt_pre = instr.op0().as_register()?.encode();
let Rt2_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let imm7_pre = instr.op3().as_signed_immediate()? as u32;
let Rt = (Rt_pre & 31);
let Rt2 = (Rt2_pre & 31);
let Rn = (Rn_pre & 31);
let imm7_pre = ((imm7_pre) / 4) as u32;
let imm7 = (imm7_pre & 127);
let mut instr: u32 = 0b00101001010000000000000000000000;
instr |= (Rt & 31) << 0;
instr |= (Rt2 & 31) << 10;
instr |= (Rn & 31) << 5;
instr |= (imm7 & 127) << 15;
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::Register(r) = op {
if !r.is_aarch32() {
todo!()
}
if *r == Register::WSP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch32() {
todo!()
}
if *r == Register::WSP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::XZR {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if !(-256..=252).contains(i) {
todo!()
}
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.ldp_32_ldstpair_off, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, 2)?;
if instr.op3().as_unsigned_immediate()? != 0 {
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, FormatterTextKind::NumSign)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, 3)?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_32_ldstpair_off, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Ldp32LdstpairOffAliases {
None,
}
pub struct Ldp64LdstpairOff;
impl Ldp64LdstpairOff {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::LDP
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let imm7 = (data >> 15) & 127;
let imm7_post = imm7;
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rt_post = Rt;
let op_0 = Register::aarch64(Rt_post, false)?;
let Rt2_post = Rt2;
let op_1 = Register::aarch64(Rt2_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let imm7_post = ((((imm7) as i32) * 8) << 22) >> 22;
let op_3 = imm7_post as i32;
let mut instr = Instruction::builder(Code::LDP_64_ldstpair_off)
.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 Rt_pre = instr.op0().as_register()?.encode();
let Rt2_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let imm7_pre = instr.op3().as_signed_immediate()? as u32;
let Rt = (Rt_pre & 31);
let Rt2 = (Rt2_pre & 31);
let Rn = (Rn_pre & 31);
let imm7_pre = ((imm7_pre) / 8) as u32;
let imm7 = (imm7_pre & 127);
let mut instr: u32 = 0b10101001010000000000000000000000;
instr |= (Rt & 31) << 0;
instr |= (Rt2 & 31) << 10;
instr |= (Rn & 31) << 5;
instr |= (imm7 & 127) << 15;
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::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::SP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::SP {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
if !r.is_aarch64() {
todo!()
}
if *r == Register::XZR {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if !(-512..=504).contains(i) {
todo!()
}
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.ldp_64_ldstpair_off, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, 2)?;
if instr.op3().as_unsigned_immediate()? != 0 {
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, FormatterTextKind::NumSign)?;
fmt.format_operand(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, 3)?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.ldp_64_ldstpair_off, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum Ldp64LdstpairOffAliases {
None,
}