#![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 IclassCasC32Comswap;
impl IclassCasC32Comswap {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let size = (data >> 30) & 3;
let size_post = size;
let Rt2 = (data >> 10) & 31;
let Rt2_post = Rt2;
let field_29 = (data >> 23) & 127;
let field_29_post = field_29;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let field_21 = (data >> 21) & 1;
let field_21_post = field_21;
let Rs = (data >> 16) & 31;
let Rs_post = Rs;
let L = (data >> 22) & 1;
let L_post = L;
let o0 = (data >> 15) & 1;
let o0_post = o0;
if ((size_post == 2) && ((L_post == 0) && (o0_post == 0))) {
return CasC32Comswap::decode(data as u32, decoder);
}
if ((size_post == 2) && ((L_post == 1) && (o0_post == 0))) {
return CasaC32Comswap::decode(data as u32, decoder);
}
if ((size_post == 2) && ((L_post == 1) && (o0_post == 1))) {
return CasalC32Comswap::decode(data as u32, decoder);
}
if ((size_post == 2) && ((L_post == 0) && (o0_post == 1))) {
return CaslC32Comswap::decode(data as u32, decoder);
}
if ((size_post == 3) && ((L_post == 0) && (o0_post == 0))) {
return CasC64Comswap::decode(data as u32, decoder);
}
if ((size_post == 3) && ((L_post == 1) && (o0_post == 0))) {
return CasaC64Comswap::decode(data as u32, decoder);
}
if ((size_post == 3) && ((L_post == 1) && (o0_post == 1))) {
return CasalC64Comswap::decode(data as u32, decoder);
}
if ((size_post == 3) && ((L_post == 0) && (o0_post == 1))) {
return CaslC64Comswap::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct CasC32Comswap;
impl CasC32Comswap {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CAS
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rs = (data >> 16) & 31;
let Rs_post = Rs;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rs_post = Rs;
let op_0 = Register::aarch32(Rs_post, false)?;
let Rt_post = Rt;
let op_1 = Register::aarch32(Rt_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let mut instr = Instruction::builder(Code::CAS_C32_comswap)
.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 Rs_pre = instr.op0().as_register()?.encode();
let Rt_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rs = (Rs_pre & 31);
let Rt = (Rt_pre & 31);
let Rn = (Rn_pre & 31);
let mut instr: u32 = 0b10001000101000000111110000000000;
instr |= (Rs & 31) << 16;
instr |= (Rt & 31) << 0;
instr |= (Rn & 31) << 5;
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<()> {
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.cas_c32_comswap, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c32_comswap, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.cas_c32_comswap, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.cas_c32_comswap, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c32_comswap, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.cas_c32_comswap, instr, 2)?;
if !config.global.syntax.omit_deref_null_const {
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c32_comswap, instr, FormatterTextKind::NumSign)?;
fmt.format_text(output, &config.global, &config.instructions.cas_c32_comswap, instr, "0")?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c32_comswap, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CasC32ComswapAliases {
None,
}
pub struct CasaC32Comswap;
impl CasaC32Comswap {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CASA
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rs = (data >> 16) & 31;
let Rs_post = Rs;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rs_post = Rs;
let op_0 = Register::aarch32(Rs_post, false)?;
let Rt_post = Rt;
let op_1 = Register::aarch32(Rt_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let mut instr = Instruction::builder(Code::CASA_C32_comswap)
.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 Rs_pre = instr.op0().as_register()?.encode();
let Rt_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rs = (Rs_pre & 31);
let Rt = (Rt_pre & 31);
let Rn = (Rn_pre & 31);
let mut instr: u32 = 0b10001000111000000111110000000000;
instr |= (Rs & 31) << 16;
instr |= (Rt & 31) << 0;
instr |= (Rn & 31) << 5;
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<()> {
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.casa_c32_comswap, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c32_comswap, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.casa_c32_comswap, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.casa_c32_comswap, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c32_comswap, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.casa_c32_comswap, instr, 2)?;
if !config.global.syntax.omit_deref_null_const {
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c32_comswap, instr, FormatterTextKind::NumSign)?;
fmt.format_text(output, &config.global, &config.instructions.casa_c32_comswap, instr, "0")?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c32_comswap, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CasaC32ComswapAliases {
None,
}
pub struct CasalC32Comswap;
impl CasalC32Comswap {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CASAL
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rs = (data >> 16) & 31;
let Rs_post = Rs;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rs_post = Rs;
let op_0 = Register::aarch32(Rs_post, false)?;
let Rt_post = Rt;
let op_1 = Register::aarch32(Rt_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let mut instr = Instruction::builder(Code::CASAL_C32_comswap)
.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 Rs_pre = instr.op0().as_register()?.encode();
let Rt_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rs = (Rs_pre & 31);
let Rt = (Rt_pre & 31);
let Rn = (Rn_pre & 31);
let mut instr: u32 = 0b10001000111000001111110000000000;
instr |= (Rs & 31) << 16;
instr |= (Rt & 31) << 0;
instr |= (Rn & 31) << 5;
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<()> {
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.casal_c32_comswap, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c32_comswap, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.casal_c32_comswap, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.casal_c32_comswap, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c32_comswap, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.casal_c32_comswap, instr, 2)?;
if !config.global.syntax.omit_deref_null_const {
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c32_comswap, instr, FormatterTextKind::NumSign)?;
fmt.format_text(output, &config.global, &config.instructions.casal_c32_comswap, instr, "0")?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c32_comswap, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CasalC32ComswapAliases {
None,
}
pub struct CaslC32Comswap;
impl CaslC32Comswap {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CASL
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rs = (data >> 16) & 31;
let Rs_post = Rs;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rs_post = Rs;
let op_0 = Register::aarch32(Rs_post, false)?;
let Rt_post = Rt;
let op_1 = Register::aarch32(Rt_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let mut instr = Instruction::builder(Code::CASL_C32_comswap)
.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 Rs_pre = instr.op0().as_register()?.encode();
let Rt_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rs = (Rs_pre & 31);
let Rt = (Rt_pre & 31);
let Rn = (Rn_pre & 31);
let mut instr: u32 = 0b10001000101000001111110000000000;
instr |= (Rs & 31) << 16;
instr |= (Rt & 31) << 0;
instr |= (Rn & 31) << 5;
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<()> {
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.casl_c32_comswap, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c32_comswap, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.casl_c32_comswap, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.casl_c32_comswap, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c32_comswap, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.casl_c32_comswap, instr, 2)?;
if !config.global.syntax.omit_deref_null_const {
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c32_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c32_comswap, instr, FormatterTextKind::NumSign)?;
fmt.format_text(output, &config.global, &config.instructions.casl_c32_comswap, instr, "0")?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c32_comswap, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CaslC32ComswapAliases {
None,
}
pub struct CasC64Comswap;
impl CasC64Comswap {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CAS
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rs = (data >> 16) & 31;
let Rs_post = Rs;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rs_post = Rs;
let op_0 = Register::aarch64(Rs_post, false)?;
let Rt_post = Rt;
let op_1 = Register::aarch64(Rt_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let mut instr = Instruction::builder(Code::CAS_C64_comswap)
.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 Rs_pre = instr.op0().as_register()?.encode();
let Rt_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rs = (Rs_pre & 31);
let Rt = (Rt_pre & 31);
let Rn = (Rn_pre & 31);
let mut instr: u32 = 0b11001000101000000111110000000000;
instr |= (Rs & 31) << 16;
instr |= (Rt & 31) << 0;
instr |= (Rn & 31) << 5;
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<()> {
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.cas_c64_comswap, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c64_comswap, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.cas_c64_comswap, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.cas_c64_comswap, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c64_comswap, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.cas_c64_comswap, instr, 2)?;
if !config.global.syntax.omit_deref_null_const {
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c64_comswap, instr, FormatterTextKind::NumSign)?;
fmt.format_text(output, &config.global, &config.instructions.cas_c64_comswap, instr, "0")?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.cas_c64_comswap, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CasC64ComswapAliases {
None,
}
pub struct CasaC64Comswap;
impl CasaC64Comswap {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CASA
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rs = (data >> 16) & 31;
let Rs_post = Rs;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rs_post = Rs;
let op_0 = Register::aarch64(Rs_post, false)?;
let Rt_post = Rt;
let op_1 = Register::aarch64(Rt_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let mut instr = Instruction::builder(Code::CASA_C64_comswap)
.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 Rs_pre = instr.op0().as_register()?.encode();
let Rt_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rs = (Rs_pre & 31);
let Rt = (Rt_pre & 31);
let Rn = (Rn_pre & 31);
let mut instr: u32 = 0b11001000111000000111110000000000;
instr |= (Rs & 31) << 16;
instr |= (Rt & 31) << 0;
instr |= (Rn & 31) << 5;
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<()> {
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.casa_c64_comswap, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c64_comswap, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.casa_c64_comswap, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.casa_c64_comswap, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c64_comswap, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.casa_c64_comswap, instr, 2)?;
if !config.global.syntax.omit_deref_null_const {
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c64_comswap, instr, FormatterTextKind::NumSign)?;
fmt.format_text(output, &config.global, &config.instructions.casa_c64_comswap, instr, "0")?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.casa_c64_comswap, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CasaC64ComswapAliases {
None,
}
pub struct CasalC64Comswap;
impl CasalC64Comswap {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CASAL
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rs = (data >> 16) & 31;
let Rs_post = Rs;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rs_post = Rs;
let op_0 = Register::aarch64(Rs_post, false)?;
let Rt_post = Rt;
let op_1 = Register::aarch64(Rt_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let mut instr = Instruction::builder(Code::CASAL_C64_comswap)
.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 Rs_pre = instr.op0().as_register()?.encode();
let Rt_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rs = (Rs_pre & 31);
let Rt = (Rt_pre & 31);
let Rn = (Rn_pre & 31);
let mut instr: u32 = 0b11001000111000001111110000000000;
instr |= (Rs & 31) << 16;
instr |= (Rt & 31) << 0;
instr |= (Rn & 31) << 5;
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<()> {
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.casal_c64_comswap, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c64_comswap, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.casal_c64_comswap, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.casal_c64_comswap, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c64_comswap, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.casal_c64_comswap, instr, 2)?;
if !config.global.syntax.omit_deref_null_const {
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c64_comswap, instr, FormatterTextKind::NumSign)?;
fmt.format_text(output, &config.global, &config.instructions.casal_c64_comswap, instr, "0")?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.casal_c64_comswap, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CasalC64ComswapAliases {
None,
}
pub struct CaslC64Comswap;
impl CaslC64Comswap {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CASL
}
pub fn size(_instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let Rs = (data >> 16) & 31;
let Rs_post = Rs;
let Rn = (data >> 5) & 31;
let Rn_post = Rn;
let Rt = (data >> 0) & 31;
let Rt_post = Rt;
let Rs_post = Rs;
let op_0 = Register::aarch64(Rs_post, false)?;
let Rt_post = Rt;
let op_1 = Register::aarch64(Rt_post, false)?;
let Rn_post = Rn;
let op_2 = Register::aarch64(Rn_post, true)?;
let mut instr = Instruction::builder(Code::CASL_C64_comswap)
.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 Rs_pre = instr.op0().as_register()?.encode();
let Rt_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rs = (Rs_pre & 31);
let Rt = (Rt_pre & 31);
let Rn = (Rn_pre & 31);
let mut instr: u32 = 0b11001000101000001111110000000000;
instr |= (Rs & 31) << 16;
instr |= (Rt & 31) << 0;
instr |= (Rn & 31) << 5;
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<()> {
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.casl_c64_comswap, instr)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c64_comswap, instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.casl_c64_comswap, instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.casl_c64_comswap, instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c64_comswap, instr, FormatterTextKind::BracketLeft)?;
fmt.format_operand(output, &config.global, &config.instructions.casl_c64_comswap, instr, 2)?;
if !config.global.syntax.omit_deref_null_const {
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c64_comswap, instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c64_comswap, instr, FormatterTextKind::NumSign)?;
fmt.format_text(output, &config.global, &config.instructions.casl_c64_comswap, instr, "0")?;
};
fmt.format_punctuation(output, &config.global, &config.instructions.casl_c64_comswap, instr, FormatterTextKind::BracketRight)?;;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CaslC64ComswapAliases {
None,
}