Various bitmask and modifier fixes

This commit is contained in:
Luke Street 2024-03-08 22:50:42 -07:00
parent 4a2bbbc6f8
commit f6e15052b1
4 changed files with 269 additions and 91 deletions

View File

@ -105,10 +105,6 @@ impl Ins {
self.0.field_rB() as i64 self.0.field_rB() as i64
} }
#[getter] #[getter]
fn rC(&self) -> i64 {
self.0.field_rC() as i64
}
#[getter]
fn sr(&self) -> i64 { fn sr(&self) -> i64 {
self.0.field_sr() as i64 self.0.field_sr() as i64
} }

View File

@ -455,13 +455,13 @@ impl Opcode {
} }
} }
pub(crate) fn _detect(code: u32) -> Self { pub(crate) fn _detect(code: u32) -> Self {
if code & 0xfc0007fe == 0x7c000214 { if code & 0xfc0003fe == 0x7c000214 {
return Opcode::Add; return Opcode::Add;
} }
if code & 0xfc0007fe == 0x7c000014 { if code & 0xfc0003fe == 0x7c000014 {
return Opcode::Addc; return Opcode::Addc;
} }
if code & 0xfc0007fe == 0x7c000114 { if code & 0xfc0003fe == 0x7c000114 {
return Opcode::Adde; return Opcode::Adde;
} }
if code & 0xfc000000 == 0x38000000 { if code & 0xfc000000 == 0x38000000 {
@ -500,10 +500,10 @@ impl Opcode {
if code & 0xfc000000 == 0x40000000 { if code & 0xfc000000 == 0x40000000 {
return Opcode::Bc; return Opcode::Bc;
} }
if code & 0xfc007ffe == 0x4c000420 { if code & 0xfc00fffe == 0x4c000420 {
return Opcode::Bcctr; return Opcode::Bcctr;
} }
if code & 0xfc007ffe == 0x4c000020 { if code & 0xfc00fffe == 0x4c000020 {
return Opcode::Bclr; return Opcode::Bclr;
} }
if code & 0xfc4007ff == 0x7c000000 { if code & 0xfc4007ff == 0x7c000000 {
@ -581,7 +581,7 @@ impl Opcode {
if code & 0xffffffff == 0x7c0006ac { if code & 0xffffffff == 0x7c0006ac {
return Opcode::Eieio; return Opcode::Eieio;
} }
if code & 0xfc0003fe == 0x7c000238 { if code & 0xfc0007fe == 0x7c000238 {
return Opcode::Eqv; return Opcode::Eqv;
} }
if code & 0xfc00fffe == 0x7c000774 { if code & 0xfc00fffe == 0x7c000774 {
@ -674,7 +674,7 @@ impl Opcode {
if code & 0xfc0007fe == 0xec000028 { if code & 0xfc0007fe == 0xec000028 {
return Opcode::Fsubs; return Opcode::Fsubs;
} }
if code & 0xffe007ff == 0x7c0007ac { if code & 0xffe007fe == 0x7c0007ac {
return Opcode::Icbi; return Opcode::Icbi;
} }
if code & 0xffffffff == 0x4c00012c { if code & 0xffffffff == 0x4c00012c {
@ -842,7 +842,7 @@ impl Opcode {
if code & 0xfc0007fe == 0x7c0003b8 { if code & 0xfc0007fe == 0x7c0003b8 {
return Opcode::Nand; return Opcode::Nand;
} }
if code & 0xfc00fffe == 0x7c0000d0 { if code & 0xfc00fbfe == 0x7c0000d0 {
return Opcode::Neg; return Opcode::Neg;
} }
if code & 0xfc0007fe == 0x7c0000f8 { if code & 0xfc0007fe == 0x7c0000f8 {
@ -971,7 +971,7 @@ impl Opcode {
if code & 0xfc00003e == 0x10000016 { if code & 0xfc00003e == 0x10000016 {
return Opcode::PsSum1; return Opcode::PsSum1;
} }
if code & 0xfffff801 == 0x4c000000 { if code & 0xffffffff == 0x4c000064 {
return Opcode::Rfi; return Opcode::Rfi;
} }
if code & 0xfc000000 == 0x50000000 { if code & 0xfc000000 == 0x50000000 {
@ -1133,7 +1133,6 @@ pub enum Field {
ps_offset(Offset), ps_offset(Offset),
BO(OpaqueU), BO(OpaqueU),
BI(CRBit), BI(CRBit),
BH(OpaqueU),
BD(BranchDest), BD(BranchDest),
LI(BranchDest), LI(BranchDest),
SH(OpaqueU), SH(OpaqueU),
@ -1143,7 +1142,6 @@ pub enum Field {
rD(GPR), rD(GPR),
rA(GPR), rA(GPR),
rB(GPR), rB(GPR),
rC(GPR),
sr(SR), sr(SR),
spr(SPR), spr(SPR),
frS(FPR), frS(FPR),
@ -1182,7 +1180,6 @@ impl Field {
Field::ps_offset(x) => Some(Argument::Offset(*x)), Field::ps_offset(x) => Some(Argument::Offset(*x)),
Field::BO(x) => Some(Argument::OpaqueU(*x)), Field::BO(x) => Some(Argument::OpaqueU(*x)),
Field::BI(x) => Some(Argument::CRBit(*x)), Field::BI(x) => Some(Argument::CRBit(*x)),
Field::BH(x) => Some(Argument::OpaqueU(*x)),
Field::BD(x) => Some(Argument::BranchDest(*x)), Field::BD(x) => Some(Argument::BranchDest(*x)),
Field::LI(x) => Some(Argument::BranchDest(*x)), Field::LI(x) => Some(Argument::BranchDest(*x)),
Field::SH(x) => Some(Argument::OpaqueU(*x)), Field::SH(x) => Some(Argument::OpaqueU(*x)),
@ -1192,7 +1189,6 @@ impl Field {
Field::rD(x) => Some(Argument::GPR(*x)), Field::rD(x) => Some(Argument::GPR(*x)),
Field::rA(x) => Some(Argument::GPR(*x)), Field::rA(x) => Some(Argument::GPR(*x)),
Field::rB(x) => Some(Argument::GPR(*x)), Field::rB(x) => Some(Argument::GPR(*x)),
Field::rC(x) => Some(Argument::GPR(*x)),
Field::sr(x) => Some(Argument::SR(*x)), Field::sr(x) => Some(Argument::SR(*x)),
Field::spr(x) => Some(Argument::SPR(*x)), Field::spr(x) => Some(Argument::SPR(*x)),
Field::frS(x) => Some(Argument::FPR(*x)), Field::frS(x) => Some(Argument::FPR(*x)),
@ -1229,7 +1225,6 @@ impl Field {
Field::ps_offset(_) => "ps_offset", Field::ps_offset(_) => "ps_offset",
Field::BO(_) => "BO", Field::BO(_) => "BO",
Field::BI(_) => "BI", Field::BI(_) => "BI",
Field::BH(_) => "BH",
Field::BD(_) => "BD", Field::BD(_) => "BD",
Field::LI(_) => "LI", Field::LI(_) => "LI",
Field::SH(_) => "SH", Field::SH(_) => "SH",
@ -1239,7 +1234,6 @@ impl Field {
Field::rD(_) => "rD", Field::rD(_) => "rD",
Field::rA(_) => "rA", Field::rA(_) => "rA",
Field::rB(_) => "rB", Field::rB(_) => "rB",
Field::rC(_) => "rC",
Field::sr(_) => "sr", Field::sr(_) => "sr",
Field::spr(_) => "spr", Field::spr(_) => "spr",
Field::frS(_) => "frS", Field::frS(_) => "frS",
@ -1360,12 +1354,10 @@ impl Ins {
Opcode::Bcctr => vec![ Opcode::Bcctr => vec![
Field::BO(OpaqueU(((self.code >> 21u8) & 0x1f) as _)), Field::BO(OpaqueU(((self.code >> 21u8) & 0x1f) as _)),
Field::BI(CRBit(((self.code >> 16u8) & 0x1f) as _)), Field::BI(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::BH(OpaqueU(((self.code >> 11u8) & 0x3) as _)),
], ],
Opcode::Bclr => vec![ Opcode::Bclr => vec![
Field::BO(OpaqueU(((self.code >> 21u8) & 0x1f) as _)), Field::BO(OpaqueU(((self.code >> 21u8) & 0x1f) as _)),
Field::BI(CRBit(((self.code >> 16u8) & 0x1f) as _)), Field::BI(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::BH(OpaqueU(((self.code >> 11u8) & 0x3) as _)),
], ],
Opcode::Cmp => vec![ Opcode::Cmp => vec![
Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
@ -4557,7 +4549,13 @@ impl Ins {
Opcode::Mcrfs => String::new(), Opcode::Mcrfs => String::new(),
Opcode::Mcrxr => String::new(), Opcode::Mcrxr => String::new(),
Opcode::Mfcr => String::new(), Opcode::Mfcr => String::new(),
Opcode::Mffs => String::new(), Opcode::Mffs => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::Mfmsr => String::new(), Opcode::Mfmsr => String::new(),
Opcode::Mfspr => String::new(), Opcode::Mfspr => String::new(),
Opcode::Mfsr => String::new(), Opcode::Mfsr => String::new(),
@ -4669,35 +4667,185 @@ impl Ins {
Opcode::PsqStu => String::new(), Opcode::PsqStu => String::new(),
Opcode::PsqStux => String::new(), Opcode::PsqStux => String::new(),
Opcode::PsqStx => String::new(), Opcode::PsqStx => String::new(),
Opcode::PsAbs => String::new(), Opcode::PsAbs => {
Opcode::PsAdd => String::new(), let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsAdd => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsCmpo0 => String::new(), Opcode::PsCmpo0 => String::new(),
Opcode::PsCmpo1 => String::new(), Opcode::PsCmpo1 => String::new(),
Opcode::PsCmpu0 => String::new(), Opcode::PsCmpu0 => String::new(),
Opcode::PsCmpu1 => String::new(), Opcode::PsCmpu1 => String::new(),
Opcode::PsDiv => String::new(), Opcode::PsDiv => {
Opcode::PsMadd => String::new(), let mut s = String::with_capacity(4);
Opcode::PsMadds0 => String::new(), if self.bit(31usize) {
Opcode::PsMadds1 => String::new(), s.push('.');
Opcode::PsMerge00 => String::new(), }
Opcode::PsMerge01 => String::new(), s
Opcode::PsMerge10 => String::new(), }
Opcode::PsMerge11 => String::new(), Opcode::PsMadd => {
Opcode::PsMr => String::new(), let mut s = String::with_capacity(4);
Opcode::PsMsub => String::new(), if self.bit(31usize) {
Opcode::PsMul => String::new(), s.push('.');
Opcode::PsMuls0 => String::new(), }
Opcode::PsMuls1 => String::new(), s
Opcode::PsNabs => String::new(), }
Opcode::PsNeg => String::new(), Opcode::PsMadds0 => {
Opcode::PsNmadd => String::new(), let mut s = String::with_capacity(4);
Opcode::PsNmsub => String::new(), if self.bit(31usize) {
Opcode::PsRes => String::new(), s.push('.');
Opcode::PsRsqrte => String::new(), }
Opcode::PsSel => String::new(), s
Opcode::PsSub => String::new(), }
Opcode::PsSum0 => String::new(), Opcode::PsMadds1 => {
Opcode::PsSum1 => String::new(), let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsMerge00 => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsMerge01 => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsMerge10 => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsMerge11 => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsMr => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsMsub => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsMul => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsMuls0 => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsMuls1 => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsNabs => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsNeg => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsNmadd => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsNmsub => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsRes => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsRsqrte => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsSel => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsSub => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsSum0 => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::PsSum1 => {
let mut s = String::with_capacity(4);
if self.bit(31usize) {
s.push('.');
}
s
}
Opcode::Rfi => String::new(), Opcode::Rfi => String::new(),
Opcode::Rlwimi => { Opcode::Rlwimi => {
let mut s = String::with_capacity(4); let mut s = String::with_capacity(4);
@ -6925,8 +7073,8 @@ impl Ins {
} }
} }
Opcode::Creqv => { Opcode::Creqv => {
if ((self.code >> 21u8) & 0x1f) == ((self.code >> 16u8) & 0x1f) if ((self.code >> 16u8) & 0x1f) == ((self.code >> 21u8) & 0x1f)
&& ((self.code >> 21u8) & 0x1f) == ((self.code >> 11u8) & 0x1f) && ((self.code >> 11u8) & 0x1f) == ((self.code >> 21u8) & 0x1f)
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "crset", mnemonic: "crset",
@ -6937,7 +7085,7 @@ impl Ins {
} }
} }
Opcode::Crnor => { Opcode::Crnor => {
if ((self.code >> 16u8) & 0x1f) == ((self.code >> 11u8) & 0x1f) { if ((self.code >> 11u8) & 0x1f) == ((self.code >> 16u8) & 0x1f) {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "crnot", mnemonic: "crnot",
suffix: String::new(), suffix: String::new(),
@ -6950,7 +7098,7 @@ impl Ins {
} }
} }
Opcode::Cror => { Opcode::Cror => {
if ((self.code >> 16u8) & 0x1f) == ((self.code >> 11u8) & 0x1f) { if ((self.code >> 11u8) & 0x1f) == ((self.code >> 16u8) & 0x1f) {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "crmove", mnemonic: "crmove",
suffix: String::new(), suffix: String::new(),
@ -6963,8 +7111,8 @@ impl Ins {
} }
} }
Opcode::Crxor => { Opcode::Crxor => {
if ((self.code >> 21u8) & 0x1f) == ((self.code >> 16u8) & 0x1f) if ((self.code >> 16u8) & 0x1f) == ((self.code >> 21u8) & 0x1f)
&& ((self.code >> 21u8) & 0x1f) == ((self.code >> 11u8) & 0x1f) && ((self.code >> 11u8) & 0x1f) == ((self.code >> 21u8) & 0x1f)
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "crclr", mnemonic: "crclr",
@ -7403,7 +7551,7 @@ impl Ins {
} }
} }
Opcode::Or => { Opcode::Or => {
if ((self.code >> 21u8) & 0x1f) == ((self.code >> 11u8) & 0x1f) { if ((self.code >> 11u8) & 0x1f) == ((self.code >> 21u8) & 0x1f) {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "mr", mnemonic: "mr",
suffix: { suffix: {
@ -7527,7 +7675,7 @@ impl Ins {
}; };
} }
if ((self.code >> 6u8) & 0x1f) == 0 if ((self.code >> 6u8) & 0x1f) == 0
&& 31 - ((self.code >> 11u8) & 0x1f) == ((self.code >> 1u8) & 0x1f) && ((self.code >> 1u8) & 0x1f) == 31 - ((self.code >> 11u8) & 0x1f)
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "slwi", mnemonic: "slwi",
@ -7549,7 +7697,7 @@ impl Ins {
}; };
} }
if ((self.code >> 1u8) & 0x1f) == 31 if ((self.code >> 1u8) & 0x1f) == 31
&& 32 - ((self.code >> 6u8) & 0x1f) == ((self.code >> 11u8) & 0x1f) && ((self.code >> 11u8) & 0x1f) == 32 - ((self.code >> 6u8) & 0x1f)
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "srwi", mnemonic: "srwi",
@ -7776,10 +7924,6 @@ impl Ins {
((self.code >> 16u8) & 0x1f) as _ ((self.code >> 16u8) & 0x1f) as _
} }
#[inline(always)] #[inline(always)]
pub fn field_BH(&self) -> usize {
((self.code >> 11u8) & 0x3) as _
}
#[inline(always)]
pub fn field_BD(&self) -> isize { pub fn field_BD(&self) -> isize {
((((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) as i32) << 2u8) as _ ((((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) as i32) << 2u8) as _
} }
@ -7816,10 +7960,6 @@ impl Ins {
((self.code >> 11u8) & 0x1f) as _ ((self.code >> 11u8) & 0x1f) as _
} }
#[inline(always)] #[inline(always)]
pub fn field_rC(&self) -> usize {
((self.code >> 6u8) & 0x1f) as _
}
#[inline(always)]
pub fn field_sr(&self) -> usize { pub fn field_sr(&self) -> usize {
((self.code >> 16u8) & 0xf) as _ ((self.code >> 16u8) & 0xf) as _
} }

View File

@ -10,12 +10,24 @@ macro_rules! assert_asm {
}}; }};
} }
#[test]
fn test_ins_add() {
assert_asm!(0x7C432214, "add r2, r3, r4");
assert_asm!(0x7CE62A15, "add. r7, r6, r5");
assert_asm!(0x7FFFFE14, "addo r31, r31, r31");
assert_asm!(0x7F9DF615, "addo. r28, r29, r30");
}
#[test] #[test]
fn test_ins_addc() { fn test_ins_addc() {
let ins = Ins::new(0x7c002014, 0x8000_0000u32); let ins = Ins::new(0x7c002014, 0x8000_0000u32);
assert_eq!(ins.op, Addc); assert_eq!(ins.op, Addc);
assert_eq!(ins.fields(), vec![rD(GPR(0)), rA(GPR(0)), rB(GPR(4))]); assert_eq!(ins.fields(), vec![rD(GPR(0)), rA(GPR(0)), rB(GPR(4))]);
assert_asm!(ins, "addc r0, r0, r4"); assert_asm!(ins, "addc r0, r0, r4");
assert_asm!(0x7C432014, "addc r2, r3, r4");
assert_asm!(0x7CE62815, "addc. r7, r6, r5");
assert_asm!(0x7FFFFC14, "addco r31, r31, r31");
assert_asm!(0x7F9DF415, "addco. r28, r29, r30");
} }
#[test] #[test]
@ -41,6 +53,10 @@ fn test_ins_addi() {
#[test] #[test]
fn test_ins_adde() { fn test_ins_adde() {
assert_asm!(0x7c006114, "adde r0, r0, r12"); assert_asm!(0x7c006114, "adde r0, r0, r12");
assert_asm!(0x7C432114, "adde r2, r3, r4");
assert_asm!(0x7CE62915, "adde. r7, r6, r5");
assert_asm!(0x7FFFFD14, "addeo r31, r31, r31");
assert_asm!(0x7F9DF515, "addeo. r28, r29, r30");
} }
#[test] #[test]
@ -652,6 +668,9 @@ fn test_ins_nand() {
#[test] #[test]
fn test_ins_neg() { fn test_ins_neg() {
assert_asm!(0x7C0600D0, "neg r0, r6"); assert_asm!(0x7C0600D0, "neg r0, r6");
assert_asm!(0x7C4A00D1, "neg. r2, r10");
assert_asm!(0x7CC104D0, "nego r6, r1");
assert_asm!(0x7DF004D1, "nego. r15, r16");
} }
#[test] #[test]

View File

@ -22,9 +22,6 @@ fields:
- name: BI - name: BI
arg: CRBit arg: CRBit
bits: 11..16 bits: 11..16
- name: BH
arg: OpaqueU
bits: 19..21
- name: BD - name: BD
arg: BranchDest arg: BranchDest
bits: 16..30 bits: 16..30
@ -64,9 +61,6 @@ fields:
- name: rB - name: rB
arg: GPR arg: GPR
bits: 16..21 bits: 16..21
- name: rC
arg: GPR
bits: 21..26
- name: sr - name: sr
arg: SR arg: SR
bits: 12..16 bits: 12..16
@ -161,17 +155,19 @@ fields:
- name: ctr - name: ctr
- name: lr - name: lr
# TODO Add defs/uses for modifiers.
modifiers: modifiers:
- name: OE - name: OE
suffix: o suffix: o
bit: 21 bit: 21
side_effects: [ xer ]
- name: Rc - name: Rc
suffix: . suffix: .
bit: 31 bit: 31
side_effects: [ cr0 ]
- name: LK - name: LK
suffix: l suffix: l
bit: 31 bit: 31
side_effects: [ lr ]
- name: AA - name: AA
suffix: a suffix: a
bit: 30 bit: 30
@ -191,7 +187,7 @@ modifiers:
opcodes: opcodes:
- name: add - name: add
desc: Add desc: Add
bitmask: 0xfc0007fe bitmask: 0xfc0003fe
pattern: 0x7c000214 pattern: 0x7c000214
modifiers: [ OE, Rc ] modifiers: [ OE, Rc ]
args: [ rD, rA, rB ] args: [ rD, rA, rB ]
@ -200,7 +196,7 @@ opcodes:
- name: addc - name: addc
desc: Add Carrying desc: Add Carrying
bitmask: 0xfc0007fe bitmask: 0xfc0003fe
pattern: 0x7c000014 pattern: 0x7c000014
modifiers: [ OE, Rc ] modifiers: [ OE, Rc ]
args: [ rD, rA, rB ] args: [ rD, rA, rB ]
@ -209,7 +205,7 @@ opcodes:
- name: adde - name: adde
desc: Add Extended desc: Add Extended
bitmask: 0xfc0007fe bitmask: 0xfc0003fe
pattern: 0x7c000114 pattern: 0x7c000114
modifiers: [ OE, Rc ] modifiers: [ OE, Rc ]
args: [ rD, rA, rB ] args: [ rD, rA, rB ]
@ -229,6 +225,7 @@ opcodes:
bitmask: 0xfc000000 bitmask: 0xfc000000
pattern: 0x30000000 pattern: 0x30000000
args: [ rD, rA, simm ] args: [ rD, rA, simm ]
side_effects: [ xer ]
defs: [ rD ] defs: [ rD ]
uses: [ rA ] uses: [ rA ]
@ -237,7 +234,7 @@ opcodes:
bitmask: 0xfc000000 bitmask: 0xfc000000
pattern: 0x34000000 pattern: 0x34000000
args: [ rD, rA, simm ] args: [ rD, rA, simm ]
side_effects: [ Rc ] side_effects: [ xer, cr0 ]
defs: [ rD ] defs: [ rD ]
uses: [ rA ] uses: [ rA ]
@ -319,18 +316,18 @@ opcodes:
- name: bcctr - name: bcctr
desc: Branch Conditional to Count Register desc: Branch Conditional to Count Register
bitmask: 0xfc007ffe bitmask: 0xfc00fffe
pattern: 0x4c000420 pattern: 0x4c000420
modifiers: [ LK, BP_ND ] modifiers: [ LK, BP_ND ]
args: [ BO, BI, BH ] args: [ BO, BI ]
uses: [ ctr ] uses: [ ctr ]
- name: bclr - name: bclr
desc: Branch Conditional to Link Register desc: Branch Conditional to Link Register
bitmask: 0xfc007ffe bitmask: 0xfc00fffe
pattern: 0x4c000020 pattern: 0x4c000020
modifiers: [ LK, BP_ND ] modifiers: [ LK, BP_ND ]
args: [ BO, BI, BH ] args: [ BO, BI ]
uses: [ lr ] uses: [ lr ]
- name: cmp - name: cmp
@ -527,7 +524,7 @@ opcodes:
- name: eqv - name: eqv
desc: Equivalent desc: Equivalent
bitmask: 0xfc0003fe bitmask: 0xfc0007fe
pattern: 0x7c000238 pattern: 0x7c000238
modifiers: [ Rc ] modifiers: [ Rc ]
args: [ rA, rS, rB ] args: [ rA, rS, rB ]
@ -804,7 +801,7 @@ opcodes:
- name: icbi - name: icbi
desc: Instruction Cache Block Invalidate desc: Instruction Cache Block Invalidate
bitmask: 0xffe007ff bitmask: 0xffe007fe
pattern: 0x7c0007ac pattern: 0x7c0007ac
modifiers: [ Rc ] modifiers: [ Rc ]
args: [ rA, rB ] args: [ rA, rB ]
@ -1090,6 +1087,7 @@ opcodes:
desc: Move from FPSCR desc: Move from FPSCR
bitmask: 0xfc1ffffe bitmask: 0xfc1ffffe
pattern: 0xfc00048e pattern: 0xfc00048e
modifiers: [ Rc ]
args: [ frD ] args: [ frD ]
defs: [ frD ] defs: [ frD ]
@ -1242,7 +1240,7 @@ opcodes:
- name: neg - name: neg
desc: Negate desc: Negate
bitmask: 0xfc00fffe bitmask: 0xfc00fbfe
pattern: 0x7c0000d0 pattern: 0x7c0000d0
modifiers: [ OE, Rc ] modifiers: [ OE, Rc ]
args: [ rD, rA ] args: [ rD, rA ]
@ -1358,6 +1356,7 @@ opcodes:
desc: Paired Single Absolute Value desc: Paired Single Absolute Value
bitmask: 0xfc1f07fe bitmask: 0xfc1f07fe
pattern: 0x10000210 pattern: 0x10000210
modifiers: [ Rc ]
args: [ frD, frB ] args: [ frD, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frB ] uses: [ frB ]
@ -1366,6 +1365,7 @@ opcodes:
desc: Paired Single Add desc: Paired Single Add
bitmask: 0xfc0007fe bitmask: 0xfc0007fe
pattern: 0x1000002a pattern: 0x1000002a
modifiers: [ Rc ]
args: [ frD, frA, frB ] args: [ frD, frA, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frB ] uses: [ frA, frB ]
@ -1406,6 +1406,7 @@ opcodes:
desc: Paired Single Divide desc: Paired Single Divide
bitmask: 0xfc0007fe bitmask: 0xfc0007fe
pattern: 0x10000024 pattern: 0x10000024
modifiers: [ Rc ]
args: [ frD, frA, frB ] args: [ frD, frA, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frB ] uses: [ frA, frB ]
@ -1414,6 +1415,7 @@ opcodes:
desc: Paired Single Multiply-Add desc: Paired Single Multiply-Add
bitmask: 0xfc00003e bitmask: 0xfc00003e
pattern: 0x1000003a pattern: 0x1000003a
modifiers: [ Rc ]
args: [ frD, frA, frC, frB ] args: [ frD, frA, frC, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC, frB ] uses: [ frA, frC, frB ]
@ -1422,6 +1424,7 @@ opcodes:
desc: Paired Single Multiply-Add Scalar high desc: Paired Single Multiply-Add Scalar high
bitmask: 0xfc00003e bitmask: 0xfc00003e
pattern: 0x1000001c pattern: 0x1000001c
modifiers: [ Rc ]
args: [ frD, frA, frC, frB ] args: [ frD, frA, frC, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC, frB ] uses: [ frA, frC, frB ]
@ -1430,6 +1433,7 @@ opcodes:
desc: Paired Single Multiply-Add Scalar low desc: Paired Single Multiply-Add Scalar low
bitmask: 0xfc00003e bitmask: 0xfc00003e
pattern: 0x1000001e pattern: 0x1000001e
modifiers: [ Rc ]
args: [ frD, frA, frC, frB ] args: [ frD, frA, frC, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC, frB ] uses: [ frA, frC, frB ]
@ -1438,6 +1442,7 @@ opcodes:
desc: Paired Single MERGE high desc: Paired Single MERGE high
bitmask: 0xfc0007fe bitmask: 0xfc0007fe
pattern: 0x10000420 pattern: 0x10000420
modifiers: [ Rc ]
args: [ frD, frA, frB ] args: [ frD, frA, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frB ] uses: [ frA, frB ]
@ -1446,6 +1451,7 @@ opcodes:
desc: Paired Single MERGE direct desc: Paired Single MERGE direct
bitmask: 0xfc0007fe bitmask: 0xfc0007fe
pattern: 0x10000460 pattern: 0x10000460
modifiers: [ Rc ]
args: [ frD, frA, frB ] args: [ frD, frA, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frB ] uses: [ frA, frB ]
@ -1454,6 +1460,7 @@ opcodes:
desc: Paired Single MERGE swapped desc: Paired Single MERGE swapped
bitmask: 0xfc0007fe bitmask: 0xfc0007fe
pattern: 0x100004a0 pattern: 0x100004a0
modifiers: [ Rc ]
args: [ frD, frA, frB ] args: [ frD, frA, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frB ] uses: [ frA, frB ]
@ -1462,6 +1469,7 @@ opcodes:
desc: Paired Single MERGE low desc: Paired Single MERGE low
bitmask: 0xfc0007fe bitmask: 0xfc0007fe
pattern: 0x100004e0 pattern: 0x100004e0
modifiers: [ Rc ]
args: [ frD, frA, frB ] args: [ frD, frA, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frB ] uses: [ frA, frB ]
@ -1470,6 +1478,7 @@ opcodes:
desc: Paired Single Move Register desc: Paired Single Move Register
bitmask: 0xfc1f07fe bitmask: 0xfc1f07fe
pattern: 0x10000090 pattern: 0x10000090
modifiers: [ Rc ]
args: [ frD, frB ] args: [ frD, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frB ] uses: [ frB ]
@ -1478,6 +1487,7 @@ opcodes:
desc: Paired Single Multiply-Subtract desc: Paired Single Multiply-Subtract
bitmask: 0xfc00003e bitmask: 0xfc00003e
pattern: 0x10000038 pattern: 0x10000038
modifiers: [ Rc ]
args: [ frD, frA, frC, frB ] args: [ frD, frA, frC, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC, frB ] uses: [ frA, frC, frB ]
@ -1486,6 +1496,7 @@ opcodes:
desc: Paired Single Multiply desc: Paired Single Multiply
bitmask: 0xfc00f83e bitmask: 0xfc00f83e
pattern: 0x10000032 pattern: 0x10000032
modifiers: [ Rc ]
args: [ frD, frA, frC ] args: [ frD, frA, frC ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC ] uses: [ frA, frC ]
@ -1494,6 +1505,7 @@ opcodes:
desc: Paired Single Multiply Scalar high desc: Paired Single Multiply Scalar high
bitmask: 0xfc00f83e bitmask: 0xfc00f83e
pattern: 0x10000018 pattern: 0x10000018
modifiers: [ Rc ]
args: [ frD, frA, frC ] args: [ frD, frA, frC ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC ] uses: [ frA, frC ]
@ -1502,6 +1514,7 @@ opcodes:
desc: Paired Single Multiply Scalar low desc: Paired Single Multiply Scalar low
bitmask: 0xfc00f83e bitmask: 0xfc00f83e
pattern: 0x1000001a pattern: 0x1000001a
modifiers: [ Rc ]
args: [ frD, frA, frC ] args: [ frD, frA, frC ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC ] uses: [ frA, frC ]
@ -1510,6 +1523,7 @@ opcodes:
desc: Paired Single Negative Absolute Value desc: Paired Single Negative Absolute Value
bitmask: 0xfc1f07fe bitmask: 0xfc1f07fe
pattern: 0x10000110 pattern: 0x10000110
modifiers: [ Rc ]
args: [ frD, frB ] args: [ frD, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frB ] uses: [ frB ]
@ -1518,6 +1532,7 @@ opcodes:
desc: Paired Single Negate desc: Paired Single Negate
bitmask: 0xfc1f07fe bitmask: 0xfc1f07fe
pattern: 0x10000050 pattern: 0x10000050
modifiers: [ Rc ]
args: [ frD, frB ] args: [ frD, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frB ] uses: [ frB ]
@ -1526,6 +1541,7 @@ opcodes:
desc: Paired Single Negative Multiply-Add desc: Paired Single Negative Multiply-Add
bitmask: 0xfc00003e bitmask: 0xfc00003e
pattern: 0x1000003e pattern: 0x1000003e
modifiers: [ Rc ]
args: [ frD, frA, frC, frB ] args: [ frD, frA, frC, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC, frB ] uses: [ frA, frC, frB ]
@ -1534,6 +1550,7 @@ opcodes:
desc: Paired Single Negative Multiply-Subtract desc: Paired Single Negative Multiply-Subtract
bitmask: 0xfc00003e bitmask: 0xfc00003e
pattern: 0x1000003c pattern: 0x1000003c
modifiers: [ Rc ]
args: [ frD, frA, frC, frB ] args: [ frD, frA, frC, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC, frB ] uses: [ frA, frC, frB ]
@ -1542,6 +1559,7 @@ opcodes:
desc: Paired Single Reciprocal Estimate desc: Paired Single Reciprocal Estimate
bitmask: 0xfc1f07fe bitmask: 0xfc1f07fe
pattern: 0x10000030 pattern: 0x10000030
modifiers: [ Rc ]
args: [ frD, frB ] args: [ frD, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frB ] uses: [ frB ]
@ -1550,6 +1568,7 @@ opcodes:
desc: Paired Single Reciprocal Square Root Estimate desc: Paired Single Reciprocal Square Root Estimate
bitmask: 0xfc1f07fe bitmask: 0xfc1f07fe
pattern: 0x10000034 pattern: 0x10000034
modifiers: [ Rc ]
args: [ frD, frB ] args: [ frD, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frB ] uses: [ frB ]
@ -1558,6 +1577,7 @@ opcodes:
desc: Paired Single Select desc: Paired Single Select
bitmask: 0xfc00003e bitmask: 0xfc00003e
pattern: 0x1000002e pattern: 0x1000002e
modifiers: [ Rc ]
args: [ frD, frA, frC, frB ] args: [ frD, frA, frC, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC, frB ] uses: [ frA, frC, frB ]
@ -1566,6 +1586,7 @@ opcodes:
desc: Paired Single Subtract desc: Paired Single Subtract
bitmask: 0xfc0007fe bitmask: 0xfc0007fe
pattern: 0x10000028 pattern: 0x10000028
modifiers: [ Rc ]
args: [ frD, frA, frB ] args: [ frD, frA, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frB ] uses: [ frA, frB ]
@ -1574,6 +1595,7 @@ opcodes:
desc: Paired Single vector SUM high desc: Paired Single vector SUM high
bitmask: 0xfc00003e bitmask: 0xfc00003e
pattern: 0x10000014 pattern: 0x10000014
modifiers: [ Rc ]
args: [ frD, frA, frC, frB ] args: [ frD, frA, frC, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC, frB ] uses: [ frA, frC, frB ]
@ -1582,14 +1604,15 @@ opcodes:
desc: Paired Single vector SUM low desc: Paired Single vector SUM low
bitmask: 0xfc00003e bitmask: 0xfc00003e
pattern: 0x10000016 pattern: 0x10000016
modifiers: [ Rc ]
args: [ frD, frA, frC, frB ] args: [ frD, frA, frC, frB ]
defs: [ frD ] defs: [ frD ]
uses: [ frA, frC, frB ] uses: [ frA, frC, frB ]
- name: rfi - name: rfi
desc: Return from Interrupt desc: Return from Interrupt
bitmask: 0xfffff801 bitmask: 0xffffffff
pattern: 0x4c000000 pattern: 0x4c000064
- name: rlwimi - name: rlwimi
desc: Rotate Left Word Immediate then Mask Insert desc: Rotate Left Word Immediate then Mask Insert
@ -1996,7 +2019,7 @@ mnemonics:
- name: mr - name: mr
opcode: or opcode: or
args: [ rA, rS ] args: [ rA, rS ]
condition: rS == rB condition: rB == rS
- name: nop - name: nop
opcode: ori opcode: ori
condition: rA == 0 && rS == 0 && uimm == 0 condition: rA == 0 && rS == 0 && uimm == 0
@ -2029,11 +2052,11 @@ mnemonics:
- name: slwi - name: slwi
opcode: rlwinm opcode: rlwinm
args: [ rA, rS, SH ] args: [ rA, rS, SH ]
condition: MB == 0 && 31 - SH == ME condition: MB == 0 && ME == 31 - SH
- name: srwi - name: srwi
opcode: rlwinm opcode: rlwinm
args: [ rA, rS, MB ] args: [ rA, rS, MB ]
condition: ME == 31 && 32 - MB == SH condition: ME == 31 && SH == 32 - MB
- name: clrlslwi - name: clrlslwi
opcode: rlwinm opcode: rlwinm
args: [ rA, rS, MB=MB+SH, SH ] args: [ rA, rS, MB=MB+SH, SH ]
@ -2119,19 +2142,19 @@ mnemonics:
- name: crset - name: crset
opcode: creqv opcode: creqv
args: [ crbD ] args: [ crbD ]
condition: crbD == crbA && crbD == crbB condition: crbA == crbD && crbB == crbD
- name: crclr - name: crclr
opcode: crxor opcode: crxor
args: [ crbD ] args: [ crbD ]
condition: crbD == crbA && crbD == crbB condition: crbA == crbD && crbB == crbD
- name: crmove - name: crmove
opcode: cror opcode: cror
args: [ crbD, crbA ] args: [ crbD, crbA ]
condition: crbA == crbB condition: crbB == crbA
- name: crnot - name: crnot
opcode: crnor opcode: crnor
args: [ crbD, crbA ] args: [ crbD, crbA ]
condition: crbA == crbB condition: crbB == crbA
# Misc # Misc
- name: tweq - name: tweq