fix condition register logical instructions

This commit is contained in:
Richard Patel 2022-04-09 15:33:40 +02:00
parent 70192c75a4
commit 9d5b73c0dc
4 changed files with 211 additions and 154 deletions

View File

@ -572,10 +572,10 @@ impl Opcode {
if code & 0xfc0003fe == 0x7c000396 { if code & 0xfc0003fe == 0x7c000396 {
return Opcode::Divwu; return Opcode::Divwu;
} }
if code & 0xfc0003ff == 0x7c00026c { if code & 0xfc0007ff == 0x7c00026c {
return Opcode::Eciwx; return Opcode::Eciwx;
} }
if code & 0xfc0003ff == 0x7c00036c { if code & 0xfc0007ff == 0x7c00036c {
return Opcode::Ecowx; return Opcode::Ecowx;
} }
if code & 0xffffffff == 0x7c0006ac { if code & 0xffffffff == 0x7c0006ac {
@ -1004,10 +1004,10 @@ impl Opcode {
if code & 0xfc000000 == 0x9c000000 { if code & 0xfc000000 == 0x9c000000 {
return Opcode::Stbu; return Opcode::Stbu;
} }
if code & 0xfc0003ff == 0x7c0001ee { if code & 0xfc0007ff == 0x7c0001ee {
return Opcode::Stbux; return Opcode::Stbux;
} }
if code & 0xfc0003ff == 0x7c0001ae { if code & 0xfc0007ff == 0x7c0001ae {
return Opcode::Stbx; return Opcode::Stbx;
} }
if code & 0xfc000000 == 0xd8000000 { if code & 0xfc000000 == 0xd8000000 {
@ -1150,11 +1150,11 @@ pub enum Field {
frA(FPR), frA(FPR),
frB(FPR), frB(FPR),
frC(FPR), frC(FPR),
crbD(CRField), crbD(CRBit),
crbA(CRField), crbA(CRBit),
crbB(CRField), crbB(CRBit),
crfD(CRBit), crfD(CRField),
crfS(CRBit), crfS(CRField),
crm(OpaqueU), crm(OpaqueU),
ps_l(GQR), ps_l(GQR),
ps_W(OpaqueU), ps_W(OpaqueU),
@ -1260,24 +1260,24 @@ impl Ins {
Field::BI(OpaqueU(((self.code >> 16u8) & 0x1f) as _)), Field::BI(OpaqueU(((self.code >> 16u8) & 0x1f) as _)),
], ],
Opcode::Cmp => vec![ Opcode::Cmp => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)), Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)),
Field::rB(GPR(((self.code >> 11u8) & 0x1f) as _)), Field::rB(GPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Cmpi => vec![ Opcode::Cmpi => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)), Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)),
Field::simm(Simm( Field::simm(Simm(
(((self.code & 0xffff) ^ 0x8000).wrapping_sub(0x8000)) as _, (((self.code & 0xffff) ^ 0x8000).wrapping_sub(0x8000)) as _,
)), )),
], ],
Opcode::Cmpl => vec![ Opcode::Cmpl => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)), Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)),
Field::rB(GPR(((self.code >> 11u8) & 0x1f) as _)), Field::rB(GPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Cmpli => vec![ Opcode::Cmpli => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)), Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)),
Field::uimm(Uimm((self.code & 0xffff) as _)), Field::uimm(Uimm((self.code & 0xffff) as _)),
], ],
@ -1286,44 +1286,44 @@ impl Ins {
Field::rS(GPR(((self.code >> 21u8) & 0x1f) as _)), Field::rS(GPR(((self.code >> 21u8) & 0x1f) as _)),
], ],
Opcode::Crand => vec![ Opcode::Crand => vec![
Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _)), Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Crandc => vec![ Opcode::Crandc => vec![
Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _)), Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Creqv => vec![ Opcode::Creqv => vec![
Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _)), Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Crnand => vec![ Opcode::Crnand => vec![
Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _)), Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Crnor => vec![ Opcode::Crnor => vec![
Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _)), Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Cror => vec![ Opcode::Cror => vec![
Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _)), Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Crorc => vec![ Opcode::Crorc => vec![
Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _)), Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Crxor => vec![ Opcode::Crxor => vec![
Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _)), Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Dcbf => vec![ Opcode::Dcbf => vec![
Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)), Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)),
@ -1402,12 +1402,12 @@ impl Ins {
Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)), Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Fcmpo => vec![ Opcode::Fcmpo => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)), Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)),
Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)), Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Fcmpu => vec![ Opcode::Fcmpu => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)), Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)),
Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)), Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
@ -1709,16 +1709,16 @@ impl Ins {
Field::rB(GPR(((self.code >> 11u8) & 0x1f) as _)), Field::rB(GPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Mcrf => vec![ Opcode::Mcrf => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::crfS(CRBit(((self.code >> 18u8) & 0x7) as _)), Field::crfS(CRField(((self.code >> 18u8) & 0x7) as _)),
], ],
Opcode::Mcrfs => vec![ Opcode::Mcrfs => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::crfS(CRBit(((self.code >> 18u8) & 0x7) as _)), Field::crfS(CRField(((self.code >> 18u8) & 0x7) as _)),
], ],
Opcode::Mcrxr => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Mcrxr => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Mfcr => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Mfcr => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Mffs => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Mffs => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mfmsr => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mfmsr => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mfspr => vec![ Opcode::Mfspr => vec![
Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _)), Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _)),
@ -1740,14 +1740,14 @@ impl Ins {
Field::crm(OpaqueU(((self.code >> 12u8) & 0xff) as _)), Field::crm(OpaqueU(((self.code >> 12u8) & 0xff) as _)),
Field::rS(GPR(((self.code >> 21u8) & 0x1f) as _)), Field::rS(GPR(((self.code >> 21u8) & 0x1f) as _)),
], ],
Opcode::Mtfsb0 => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mtfsb0 => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mtfsb1 => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mtfsb1 => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mtfsf => vec![ Opcode::Mtfsf => vec![
Field::mtfsf_FM(OpaqueU(((self.code >> 17u8) & 0xff) as _)), Field::mtfsf_FM(OpaqueU(((self.code >> 17u8) & 0xff) as _)),
Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)), Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::Mtfsfi => vec![ Opcode::Mtfsfi => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::mtfsf_IMM(OpaqueU(((self.code >> 12u8) & 0xf) as _)), Field::mtfsf_IMM(OpaqueU(((self.code >> 12u8) & 0xf) as _)),
], ],
Opcode::Mtmsr => vec![Field::rS(GPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mtmsr => vec![Field::rS(GPR(((self.code >> 21u8) & 0x1f) as _))],
@ -1893,22 +1893,22 @@ impl Ins {
Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)), Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::PsCmpo0 => vec![ Opcode::PsCmpo0 => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)), Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)),
Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)), Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::PsCmpo1 => vec![ Opcode::PsCmpo1 => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)), Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)),
Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)), Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::PsCmpu0 => vec![ Opcode::PsCmpu0 => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)), Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)),
Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)), Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
Opcode::PsCmpu1 => vec![ Opcode::PsCmpu1 => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)), Field::frA(FPR(((self.code >> 16u8) & 0x1f) as _)),
Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)), Field::frB(FPR(((self.code >> 11u8) & 0x1f) as _)),
], ],
@ -2314,19 +2314,19 @@ impl Ins {
Opcode::Bc => vec![], Opcode::Bc => vec![],
Opcode::Bcctr => vec![], Opcode::Bcctr => vec![],
Opcode::Bclr => vec![], Opcode::Bclr => vec![],
Opcode::Cmp => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Cmp => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Cmpi => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Cmpi => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Cmpl => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Cmpl => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Cmpli => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Cmpli => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Cntlzw => vec![Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _))], Opcode::Cntlzw => vec![Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _))],
Opcode::Crand => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Crand => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Crandc => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Crandc => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Creqv => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Creqv => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Crnand => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Crnand => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Crnor => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Crnor => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Cror => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Cror => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Crorc => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Crorc => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Crxor => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Crxor => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Dcbf => vec![], Opcode::Dcbf => vec![],
Opcode::Dcbi => vec![], Opcode::Dcbi => vec![],
Opcode::Dcbst => vec![], Opcode::Dcbst => vec![],
@ -2345,8 +2345,8 @@ impl Ins {
Opcode::Fabs => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Fabs => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Fadd => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Fadd => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Fadds => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Fadds => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Fcmpo => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Fcmpo => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Fcmpu => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Fcmpu => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Fctiw => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Fctiw => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Fctiwz => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Fctiwz => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Fdiv => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Fdiv => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
@ -2438,24 +2438,24 @@ impl Ins {
Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)), Field::rA(GPR(((self.code >> 16u8) & 0x1f) as _)),
], ],
Opcode::Lwzx => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Lwzx => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mcrf => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Mcrf => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Mcrfs => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Mcrfs => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Mcrxr => vec![ Opcode::Mcrxr => vec![
Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _)), Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
Field::xer, Field::xer,
], ],
Opcode::Mfcr => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Mfcr => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Mffs => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Mffs => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mfmsr => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mfmsr => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mfspr => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mfspr => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mfsr => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mfsr => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mfsrin => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mfsrin => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mftb => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mftb => vec![Field::rD(GPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mtcrf => vec![], Opcode::Mtcrf => vec![],
Opcode::Mtfsb0 => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mtfsb0 => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mtfsb1 => vec![Field::crbD(CRField(((self.code >> 21u8) & 0x1f) as _))], Opcode::Mtfsb1 => vec![Field::crbD(CRBit(((self.code >> 21u8) & 0x1f) as _))],
Opcode::Mtfsf => vec![], Opcode::Mtfsf => vec![],
Opcode::Mtfsfi => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::Mtfsfi => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::Mtmsr => vec![], Opcode::Mtmsr => vec![],
Opcode::Mtspr => vec![], Opcode::Mtspr => vec![],
Opcode::Mtsr => vec![], Opcode::Mtsr => vec![],
@ -2487,10 +2487,10 @@ impl Ins {
Opcode::PsqStx => vec![], Opcode::PsqStx => vec![],
Opcode::PsAbs => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::PsAbs => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::PsAdd => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::PsAdd => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::PsCmpo0 => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::PsCmpo0 => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::PsCmpo1 => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::PsCmpo1 => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::PsCmpu0 => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::PsCmpu0 => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::PsCmpu1 => vec![Field::crfD(CRBit(((self.code >> 23u8) & 0x7) as _))], Opcode::PsCmpu1 => vec![Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _))],
Opcode::PsDiv => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::PsDiv => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::PsMadd => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::PsMadd => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
Opcode::PsMadds0 => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))], Opcode::PsMadds0 => vec![Field::frD(FPR(((self.code >> 21u8) & 0x1f) as _))],
@ -2686,57 +2686,57 @@ impl Ins {
} }
Opcode::Crand => { Opcode::Crand => {
let mut uses = vec![ let mut uses = vec![
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
]; ];
uses uses
} }
Opcode::Crandc => { Opcode::Crandc => {
let mut uses = vec![ let mut uses = vec![
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
]; ];
uses uses
} }
Opcode::Creqv => { Opcode::Creqv => {
let mut uses = vec![ let mut uses = vec![
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
]; ];
uses uses
} }
Opcode::Crnand => { Opcode::Crnand => {
let mut uses = vec![ let mut uses = vec![
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
]; ];
uses uses
} }
Opcode::Crnor => { Opcode::Crnor => {
let mut uses = vec![ let mut uses = vec![
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
]; ];
uses uses
} }
Opcode::Cror => { Opcode::Cror => {
let mut uses = vec![ let mut uses = vec![
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
]; ];
uses uses
} }
Opcode::Crorc => { Opcode::Crorc => {
let mut uses = vec![ let mut uses = vec![
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
]; ];
uses uses
} }
Opcode::Crxor => { Opcode::Crxor => {
let mut uses = vec![ let mut uses = vec![
Field::crbA(CRField(((self.code >> 16u8) & 0x1f) as _)), Field::crbA(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Field::crbB(CRField(((self.code >> 11u8) & 0x1f) as _)), Field::crbB(CRBit(((self.code >> 11u8) & 0x1f) as _)),
]; ];
uses uses
} }
@ -3265,11 +3265,11 @@ impl Ins {
uses uses
} }
Opcode::Mcrf => { Opcode::Mcrf => {
let mut uses = vec![Field::crfS(CRBit(((self.code >> 18u8) & 0x7) as _))]; let mut uses = vec![Field::crfS(CRField(((self.code >> 18u8) & 0x7) as _))];
uses uses
} }
Opcode::Mcrfs => { Opcode::Mcrfs => {
let mut uses = vec![Field::crfS(CRBit(((self.code >> 18u8) & 0x7) as _))]; let mut uses = vec![Field::crfS(CRField(((self.code >> 18u8) & 0x7) as _))];
uses uses
} }
Opcode::Mcrxr => { Opcode::Mcrxr => {
@ -4903,7 +4903,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "blt", mnemonic: "blt",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _)),
Argument::BranchDest(BranchDest( Argument::BranchDest(BranchDest(
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) (((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000))
<< 2u8) as _, << 2u8) as _,
@ -4930,7 +4930,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "ble", mnemonic: "ble",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _)),
Argument::BranchDest(BranchDest( Argument::BranchDest(BranchDest(
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) (((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000))
<< 2u8) as _, << 2u8) as _,
@ -4957,7 +4957,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "beq", mnemonic: "beq",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _)),
Argument::BranchDest(BranchDest( Argument::BranchDest(BranchDest(
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) (((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000))
<< 2u8) as _, << 2u8) as _,
@ -4984,7 +4984,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bge", mnemonic: "bge",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _)),
Argument::BranchDest(BranchDest( Argument::BranchDest(BranchDest(
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) (((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000))
<< 2u8) as _, << 2u8) as _,
@ -5011,7 +5011,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bgt", mnemonic: "bgt",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _)),
Argument::BranchDest(BranchDest( Argument::BranchDest(BranchDest(
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) (((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000))
<< 2u8) as _, << 2u8) as _,
@ -5038,7 +5038,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bne", mnemonic: "bne",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _)),
Argument::BranchDest(BranchDest( Argument::BranchDest(BranchDest(
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) (((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000))
<< 2u8) as _, << 2u8) as _,
@ -5065,7 +5065,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bso", mnemonic: "bso",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _)),
Argument::BranchDest(BranchDest( Argument::BranchDest(BranchDest(
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) (((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000))
<< 2u8) as _, << 2u8) as _,
@ -5092,7 +5092,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bns", mnemonic: "bns",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _)),
Argument::BranchDest(BranchDest( Argument::BranchDest(BranchDest(
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) (((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000))
<< 2u8) as _, << 2u8) as _,
@ -5144,7 +5144,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bltctr", mnemonic: "bltctr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5162,7 +5162,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "blectr", mnemonic: "blectr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5180,7 +5180,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "beqctr", mnemonic: "beqctr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5198,7 +5198,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bgectr", mnemonic: "bgectr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5216,7 +5216,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bgtctr", mnemonic: "bgtctr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5234,7 +5234,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bnectr", mnemonic: "bnectr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5252,7 +5252,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bsoctr", mnemonic: "bsoctr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5270,7 +5270,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bnsctr", mnemonic: "bnsctr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5297,7 +5297,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bltlr", mnemonic: "bltlr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5315,7 +5315,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "blelr", mnemonic: "blelr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5333,7 +5333,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "beqlr", mnemonic: "beqlr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5351,7 +5351,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bgelr", mnemonic: "bgelr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5369,7 +5369,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bgtlr", mnemonic: "bgtlr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5387,7 +5387,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bnelr", mnemonic: "bnelr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5405,7 +5405,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bsolr", mnemonic: "bsolr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5423,7 +5423,7 @@ impl Ins {
{ {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "bnslr", mnemonic: "bnslr",
args: vec![Argument::CRBit(CRBit(((self.code >> 18u8) & 0x7) as _))], args: vec![Argument::CRField(CRField(((self.code >> 18u8) & 0x7) as _))],
ins: self, ins: self,
}; };
} }
@ -5457,7 +5457,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "cmpwi", mnemonic: "cmpwi",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 23u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 23u8) & 0x7) as _)),
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)), Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
Argument::Simm(Simm( Argument::Simm(Simm(
(((self.code & 0xffff) ^ 0x8000).wrapping_sub(0x8000)) as _, (((self.code & 0xffff) ^ 0x8000).wrapping_sub(0x8000)) as _,
@ -5494,7 +5494,7 @@ impl Ins {
return SimplifiedIns { return SimplifiedIns {
mnemonic: "cmplwi", mnemonic: "cmplwi",
args: vec![ args: vec![
Argument::CRBit(CRBit(((self.code >> 23u8) & 0x7) as _)), Argument::CRField(CRField(((self.code >> 23u8) & 0x7) as _)),
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)), Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
Argument::Uimm(Uimm((self.code & 0xffff) as _)), Argument::Uimm(Uimm((self.code & 0xffff) as _)),
], ],
@ -5502,6 +5502,54 @@ impl Ins {
}; };
} }
} }
Opcode::Creqv => {
if ((self.code >> 21u8) & 0x1f) == ((self.code >> 16u8) & 0x1f)
&& ((self.code >> 21u8) & 0x1f) == ((self.code >> 11u8) & 0x1f)
{
return SimplifiedIns {
mnemonic: "crset",
args: vec![Argument::CRBit(CRBit(((self.code >> 21u8) & 0x1f) as _))],
ins: self,
};
}
}
Opcode::Crnor => {
if ((self.code >> 16u8) & 0x1f) == ((self.code >> 11u8) & 0x1f) {
return SimplifiedIns {
mnemonic: "crnot",
args: vec![
Argument::CRBit(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Argument::CRBit(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Argument::CRBit(CRBit(((self.code >> 11u8) & 0x1f) as _)),
],
ins: self,
};
}
}
Opcode::Cror => {
if ((self.code >> 16u8) & 0x1f) == ((self.code >> 11u8) & 0x1f) {
return SimplifiedIns {
mnemonic: "crmove",
args: vec![
Argument::CRBit(CRBit(((self.code >> 21u8) & 0x1f) as _)),
Argument::CRBit(CRBit(((self.code >> 16u8) & 0x1f) as _)),
Argument::CRBit(CRBit(((self.code >> 11u8) & 0x1f) as _)),
],
ins: self,
};
}
}
Opcode::Crxor => {
if ((self.code >> 21u8) & 0x1f) == ((self.code >> 16u8) & 0x1f)
&& ((self.code >> 21u8) & 0x1f) == ((self.code >> 11u8) & 0x1f)
{
return SimplifiedIns {
mnemonic: "crclr",
args: vec![Argument::CRBit(CRBit(((self.code >> 21u8) & 0x1f) as _))],
ins: self,
};
}
}
Opcode::Mfspr => { Opcode::Mfspr => {
if ((self.code >> 11u8) & 0x3ff) == 1 { if ((self.code >> 11u8) & 0x3ff) == 1 {
return SimplifiedIns { return SimplifiedIns {

View File

@ -106,9 +106,9 @@ field_arg!(SR, u8);
// Special-purpose register. // Special-purpose register.
field_arg!(SPR, u16); field_arg!(SPR, u16);
// Condition register field. // Condition register field.
field_arg!(CRField, u8, "crb{}"); field_arg!(CRField, u8, "cr{}");
// Condition register bit (index + condition case). // Condition register bit (index + condition case).
field_arg!(CRBit, u8, "cr{}"); field_arg!(CRBit, u8, "{}");
// Paired-single graphics quantization register // Paired-single graphics quantization register
field_arg!(GQR, u8, "qr{}"); field_arg!(GQR, u8, "qr{}");
// Unsigned immediate. // Unsigned immediate.
@ -192,11 +192,11 @@ impl Field {
Field::frA(x) => Some(Argument::FPR(*x)), Field::frA(x) => Some(Argument::FPR(*x)),
Field::frB(x) => Some(Argument::FPR(*x)), Field::frB(x) => Some(Argument::FPR(*x)),
Field::frC(x) => Some(Argument::FPR(*x)), Field::frC(x) => Some(Argument::FPR(*x)),
Field::crbD(x) => Some(Argument::CRField(*x)), Field::crbD(x) => Some(Argument::CRBit(*x)),
Field::crbA(x) => Some(Argument::CRField(*x)), Field::crbA(x) => Some(Argument::CRBit(*x)),
Field::crbB(x) => Some(Argument::CRField(*x)), Field::crbB(x) => Some(Argument::CRBit(*x)),
Field::crfD(x) => Some(Argument::CRBit(*x)), Field::crfD(x) => Some(Argument::CRField(*x)),
Field::crfS(x) => Some(Argument::CRBit(*x)), Field::crfS(x) => Some(Argument::CRField(*x)),
Field::crm(x) => Some(Argument::OpaqueU(*x)), Field::crm(x) => Some(Argument::OpaqueU(*x)),
Field::ps_l(x) => Some(Argument::GQR(*x)), Field::ps_l(x) => Some(Argument::GQR(*x)),
Field::ps_W(x) => Some(Argument::OpaqueU(*x)), Field::ps_W(x) => Some(Argument::OpaqueU(*x)),

View File

@ -172,12 +172,10 @@ fn test_ins_cntlzw() {
assert_asm!(0x7C030034, "cntlzw r3, r0"); assert_asm!(0x7C030034, "cntlzw r3, r0");
} }
/*
#[test] #[test]
fn test_ins_cror() { fn test_ins_cror() {
assert_asm!(0x4C411382, "cror cr2, cr1, cr2"); assert_asm!(0x4C411382, "cror 2, 1, 2");
} }
*/
#[test] #[test]
fn test_ins_dcbf() { fn test_ins_dcbf() {
@ -487,12 +485,10 @@ fn test_ins_mfcr() {
assert_asm!(0x7C000026, "mfcr cr0"); assert_asm!(0x7C000026, "mfcr cr0");
} }
/*
#[test] #[test]
fn test_ins_mffs() { fn test_ins_mffs() {
assert_asm!(0xFC00048E, "mffs f0"); assert_asm!(0xFC00048E, "mffs f0");
} }
*/
#[test] #[test]
fn test_ins_mfmsr() { fn test_ins_mfmsr() {
@ -522,12 +518,12 @@ fn test_ins_mtcrf() {
/* /*
#[test] #[test]
fn test_ins_mtfsb0() {} fn test_ins_mtfsb0() {}
*/
#[test] #[test]
fn test_ins_mtfsb1() { fn test_ins_mtfsb1() {
assert_asm!(0xFFA0004C, "mtfsb1 0x1d"); assert_asm!(0xFFA0004C, "mtfsb1 29");
} }
*/
#[test] #[test]
fn test_ins_mtfsf() { fn test_ins_mtfsf() {
@ -611,12 +607,10 @@ fn test_ins_psq_l() {
assert_asm!(0xE02500AC, "psq_l f1, 0xac(r5), 0, qr0"); assert_asm!(0xE02500AC, "psq_l f1, 0xac(r5), 0, qr0");
} }
/*
#[test] #[test]
fn test_ins_psq_lu() { fn test_ins_psq_lu() {
assert_asm!(0xE5435010, "psq_lu f10, 0x10(r3), 0, qr5"); assert_asm!(0xE5435010, "psq_lu f10, 0x10(r3), 0, qr5");
} }
*/
#[test] #[test]
fn test_ins_psq_lx() { fn test_ins_psq_lx() {
@ -856,12 +850,10 @@ fn test_ins_stfdu() {
assert_asm!(0xDC24FFC0, "stfdu f1, -0x40(r4)"); assert_asm!(0xDC24FFC0, "stfdu f1, -0x40(r4)");
} }
/*
#[test] #[test]
fn test_ins_stfdx() { fn test_ins_stfdx() {
assert_asm!(0x7C4405AE, "stfdx f2, r4, r0"); assert_asm!(0x7C4405AE, "stfdx f2, r4, r0");
} }
*/
#[test] #[test]
fn test_ins_stfs() { fn test_ins_stfs() {

View File

@ -87,23 +87,22 @@ fields:
- name: frC - name: frC
arg: FPR arg: FPR
bits: 21..26 bits: 21..26
# Condition registers # Condition register bits
# TODO This looks swapped the wrong way around
- name: crbD - name: crbD
arg: CRField arg: CRBit
bits: 6..11 bits: 6..11
- name: crbA - name: crbA
arg: CRField arg: CRBit
bits: 11..16 bits: 11..16
- name: crbB - name: crbB
arg: CRField arg: CRBit
bits: 16..21 bits: 16..21
# Condition register fields # Condition register fields
- name: crfD - name: crfD
arg: CRBit arg: CRField
bits: 6..9 bits: 6..9
- name: crfS - name: crfS
arg: CRBit arg: CRField
bits: 11..14 bits: 11..14
# Condition register misc # Condition register misc
- name: crm - name: crm
@ -475,7 +474,7 @@ opcodes:
- name: eciwx - name: eciwx
desc: External Control In Word Indexed desc: External Control In Word Indexed
bitmask: 0xfc0003ff bitmask: 0xfc0007ff
pattern: 0x7c00026c pattern: 0x7c00026c
args: [ rD, rA, rB ] args: [ rD, rA, rB ]
defs: [ rD ] defs: [ rD ]
@ -483,7 +482,7 @@ opcodes:
- name: ecowx - name: ecowx
desc: External Control Out Word Indexed desc: External Control Out Word Indexed
bitmask: 0xfc0003ff bitmask: 0xfc0007ff
pattern: 0x7c00036c pattern: 0x7c00036c
args: [ rS, rA, rB ] args: [ rS, rA, rB ]
uses: [ rS, rA.nz, rB ] uses: [ rS, rA.nz, rB ]
@ -1059,8 +1058,8 @@ opcodes:
bitmask: 0xfc1ffffe bitmask: 0xfc1ffffe
pattern: 0xfc00048e pattern: 0xfc00048e
modifiers: [ Rc ] modifiers: [ Rc ]
args: [ crfD ] args: [ frD ]
defs: [ crfD ] defs: [ frD ]
- name: mfmsr - name: mfmsr
desc: Move from Machine State Register desc: Move from Machine State Register
@ -1671,7 +1670,7 @@ opcodes:
- name: stbux - name: stbux
desc: Store Byte with Update Indexed desc: Store Byte with Update Indexed
bitmask: 0xfc0003ff bitmask: 0xfc0007ff
pattern: 0x7c0001ee pattern: 0x7c0001ee
args: [ rS, rA, rB ] args: [ rS, rA, rB ]
defs: [ rA ] defs: [ rA ]
@ -1679,7 +1678,7 @@ opcodes:
- name: stbx - name: stbx
desc: Store Byte Indexed desc: Store Byte Indexed
bitmask: 0xfc0003ff bitmask: 0xfc0007ff
pattern: 0x7c0001ae pattern: 0x7c0001ae
args: [ rS, rA, rB ] args: [ rS, rA, rB ]
uses: [ rS, rA.nz, rB ] uses: [ rS, rA.nz, rB ]
@ -2029,6 +2028,24 @@ mnemonics:
args: [ crfD, rA, uimm ] args: [ crfD, rA, uimm ]
condition: crfD == 0 condition: crfD == 0
# Condition Register Logical
- name: crset
opcode: creqv
args: [ crbD ]
condition: crbD == crbA && crbD == crbB
- name: crclr
opcode: crxor
args: [ crbD ]
condition: crbD == crbA && crbD == crbB
- name: crmove
opcode: cror
args: [ crbD, crbA, crbB ]
condition: crbA == crbB
- name: crnot
opcode: crnor
args: [ crbD, crbA, crbB ]
condition: crbA == crbB
# Misc # Misc
- name: twgti - name: twgti
opcode: twi opcode: twi