From c8c1daaa64bab6318a25a2381c348543e107b157 Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Wed, 6 Apr 2022 17:41:13 +0200 Subject: [PATCH] progress mnemonics --- disasm/src/generated.rs | 1238 +++++++++++++++++++++++---------------- disasm/src/lib.rs | 2 +- genisa/src/main.rs | 154 +++-- isa.yaml | 108 ++-- 4 files changed, 915 insertions(+), 587 deletions(-) diff --git a/disasm/src/generated.rs b/disasm/src/generated.rs index 1e555a9..df5963e 100644 --- a/disasm/src/generated.rs +++ b/disasm/src/generated.rs @@ -1160,7 +1160,7 @@ pub enum Field { tbr(OpaqueU), mtfsf_FM(OpaqueU), mtfsf_IMM(OpaqueU), - tw_TO(OpaqueU), + TO(OpaqueU), xer, ctr, lr, @@ -3412,7 +3412,7 @@ impl Ins { ))], Opcode::Tlbsync => vec![], Opcode::Tw => vec![ - Field::tw_TO(OpaqueU( + Field::TO(OpaqueU( (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) as _, )), Field::rA(GPR( @@ -3423,7 +3423,7 @@ impl Ins { )), ], Opcode::Twi => vec![ - Field::tw_TO(OpaqueU( + Field::TO(OpaqueU( (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) as _, )), Field::rA(GPR( @@ -6346,23 +6346,14 @@ impl Ins { m.rc = self.bit(31); m } - Opcode::Addi => { - let mut m = Modifiers::default(); - m - } - Opcode::Addic => { - let mut m = Modifiers::default(); - m - } + Opcode::Addi => Modifiers::default(), + Opcode::Addic => Modifiers::default(), Opcode::Addic_ => { let mut m = Modifiers::default(); m.rc = true; m } - Opcode::Addis => { - let mut m = Modifiers::default(); - m - } + Opcode::Addis => Modifiers::default(), Opcode::Addme => { let mut m = Modifiers::default(); m.oe = self.bit(21); @@ -6417,87 +6408,30 @@ impl Ins { m.lk = self.bit(31); m } - Opcode::Cmp => { - let mut m = Modifiers::default(); - m - } - Opcode::Cmpi => { - let mut m = Modifiers::default(); - m - } - Opcode::Cmpl => { - let mut m = Modifiers::default(); - m - } - Opcode::Cmpli => { - let mut m = Modifiers::default(); - m - } + Opcode::Cmp => Modifiers::default(), + Opcode::Cmpi => Modifiers::default(), + Opcode::Cmpl => Modifiers::default(), + Opcode::Cmpli => Modifiers::default(), Opcode::Cntlzw => { let mut m = Modifiers::default(); m.rc = self.bit(31); m } - Opcode::Crand => { - let mut m = Modifiers::default(); - m - } - Opcode::Crandc => { - let mut m = Modifiers::default(); - m - } - Opcode::Creqv => { - let mut m = Modifiers::default(); - m - } - Opcode::Crnand => { - let mut m = Modifiers::default(); - m - } - Opcode::Crnor => { - let mut m = Modifiers::default(); - m - } - Opcode::Cror => { - let mut m = Modifiers::default(); - m - } - Opcode::Crorc => { - let mut m = Modifiers::default(); - m - } - Opcode::Crxor => { - let mut m = Modifiers::default(); - m - } - Opcode::Dcbf => { - let mut m = Modifiers::default(); - m - } - Opcode::Dcbi => { - let mut m = Modifiers::default(); - m - } - Opcode::Dcbst => { - let mut m = Modifiers::default(); - m - } - Opcode::Dcbt => { - let mut m = Modifiers::default(); - m - } - Opcode::Dcbtst => { - let mut m = Modifiers::default(); - m - } - Opcode::Dcbz => { - let mut m = Modifiers::default(); - m - } - Opcode::DcbzL => { - let mut m = Modifiers::default(); - m - } + Opcode::Crand => Modifiers::default(), + Opcode::Crandc => Modifiers::default(), + Opcode::Creqv => Modifiers::default(), + Opcode::Crnand => Modifiers::default(), + Opcode::Crnor => Modifiers::default(), + Opcode::Cror => Modifiers::default(), + Opcode::Crorc => Modifiers::default(), + Opcode::Crxor => Modifiers::default(), + Opcode::Dcbf => Modifiers::default(), + Opcode::Dcbi => Modifiers::default(), + Opcode::Dcbst => Modifiers::default(), + Opcode::Dcbt => Modifiers::default(), + Opcode::Dcbtst => Modifiers::default(), + Opcode::Dcbz => Modifiers::default(), + Opcode::DcbzL => Modifiers::default(), Opcode::Divw => { let mut m = Modifiers::default(); m.oe = self.bit(21); @@ -6510,18 +6444,9 @@ impl Ins { m.rc = self.bit(31); m } - Opcode::Eciwx => { - let mut m = Modifiers::default(); - m - } - Opcode::Ecowx => { - let mut m = Modifiers::default(); - m - } - Opcode::Eieio => { - let mut m = Modifiers::default(); - m - } + Opcode::Eciwx => Modifiers::default(), + Opcode::Ecowx => Modifiers::default(), + Opcode::Eieio => Modifiers::default(), Opcode::Eqv => { let mut m = Modifiers::default(); m.rc = self.bit(31); @@ -6552,14 +6477,8 @@ impl Ins { m.rc = self.bit(31); m } - Opcode::Fcmpo => { - let mut m = Modifiers::default(); - m - } - Opcode::Fcmpu => { - let mut m = Modifiers::default(); - m - } + Opcode::Fcmpo => Modifiers::default(), + Opcode::Fcmpu => Modifiers::default(), Opcode::Fctiw => { let mut m = Modifiers::default(); m.rc = self.bit(31); @@ -6680,601 +6599,922 @@ impl Ins { m.rc = self.bit(31); m } - Opcode::Isync => { - let mut m = Modifiers::default(); - m - } - Opcode::Lbz => { - let mut m = Modifiers::default(); - m - } - Opcode::Lbzu => { - let mut m = Modifiers::default(); - m - } - Opcode::Lbzux => { - let mut m = Modifiers::default(); - m - } - Opcode::Lbzx => { - let mut m = Modifiers::default(); - m - } - Opcode::Lfd => { - let mut m = Modifiers::default(); - m - } - Opcode::Lfdu => { - let mut m = Modifiers::default(); - m - } - Opcode::Lfdux => { - let mut m = Modifiers::default(); - m - } - Opcode::Lfdx => { - let mut m = Modifiers::default(); - m - } - Opcode::Lfs => { - let mut m = Modifiers::default(); - m - } - Opcode::Lfsu => { - let mut m = Modifiers::default(); - m - } - Opcode::Lfsux => { - let mut m = Modifiers::default(); - m - } - Opcode::Lfsx => { - let mut m = Modifiers::default(); - m - } - Opcode::Lha => { - let mut m = Modifiers::default(); - m - } - Opcode::Lhau => { - let mut m = Modifiers::default(); - m - } - Opcode::Lhaux => { - let mut m = Modifiers::default(); - m - } - Opcode::Lhax => { - let mut m = Modifiers::default(); - m - } - Opcode::Lhbrx => { - let mut m = Modifiers::default(); - m - } - Opcode::Lhz => { - let mut m = Modifiers::default(); - m - } - Opcode::Lhzu => { - let mut m = Modifiers::default(); - m - } - Opcode::Lhzux => { - let mut m = Modifiers::default(); - m - } - Opcode::Lhzx => { - let mut m = Modifiers::default(); - m - } - Opcode::Lmw => { - let mut m = Modifiers::default(); - m - } - Opcode::Lswi => { - let mut m = Modifiers::default(); - m - } - Opcode::Lswx => { - let mut m = Modifiers::default(); - m - } - Opcode::Lwarx => { - let mut m = Modifiers::default(); - m - } - Opcode::Lwbrx => { - let mut m = Modifiers::default(); - m - } - Opcode::Lwz => { - let mut m = Modifiers::default(); - m - } - Opcode::Lwzu => { - let mut m = Modifiers::default(); - m - } - Opcode::Lwzux => { - let mut m = Modifiers::default(); - m - } - Opcode::Lwzx => { - let mut m = Modifiers::default(); - m - } - Opcode::Mcrf => { - let mut m = Modifiers::default(); - m - } - Opcode::Mcrfs => { - let mut m = Modifiers::default(); - m - } - Opcode::Mcrxr => { - let mut m = Modifiers::default(); - m - } - Opcode::Mfcr => { - let mut m = Modifiers::default(); - m - } + Opcode::Isync => Modifiers::default(), + Opcode::Lbz => Modifiers::default(), + Opcode::Lbzu => Modifiers::default(), + Opcode::Lbzux => Modifiers::default(), + Opcode::Lbzx => Modifiers::default(), + Opcode::Lfd => Modifiers::default(), + Opcode::Lfdu => Modifiers::default(), + Opcode::Lfdux => Modifiers::default(), + Opcode::Lfdx => Modifiers::default(), + Opcode::Lfs => Modifiers::default(), + Opcode::Lfsu => Modifiers::default(), + Opcode::Lfsux => Modifiers::default(), + Opcode::Lfsx => Modifiers::default(), + Opcode::Lha => Modifiers::default(), + Opcode::Lhau => Modifiers::default(), + Opcode::Lhaux => Modifiers::default(), + Opcode::Lhax => Modifiers::default(), + Opcode::Lhbrx => Modifiers::default(), + Opcode::Lhz => Modifiers::default(), + Opcode::Lhzu => Modifiers::default(), + Opcode::Lhzux => Modifiers::default(), + Opcode::Lhzx => Modifiers::default(), + Opcode::Lmw => Modifiers::default(), + Opcode::Lswi => Modifiers::default(), + Opcode::Lswx => Modifiers::default(), + Opcode::Lwarx => Modifiers::default(), + Opcode::Lwbrx => Modifiers::default(), + Opcode::Lwz => Modifiers::default(), + Opcode::Lwzu => Modifiers::default(), + Opcode::Lwzux => Modifiers::default(), + Opcode::Lwzx => Modifiers::default(), + Opcode::Mcrf => Modifiers::default(), + Opcode::Mcrfs => Modifiers::default(), + Opcode::Mcrxr => Modifiers::default(), + Opcode::Mfcr => Modifiers::default(), Opcode::Mffs => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } - Opcode::Mfmsr => { - let mut m = Modifiers::default(); - m - } - Opcode::Mfspr => { - let mut m = Modifiers::default(); - m - } - Opcode::Mfsr => { - let mut m = Modifiers::default(); - m - } - Opcode::Mfsrin => { - let mut m = Modifiers::default(); - m - } - Opcode::Mftb => { - let mut m = Modifiers::default(); - m - } - Opcode::Mtcrf => { - let mut m = Modifiers::default(); - m - } + Opcode::Mfmsr => Modifiers::default(), + Opcode::Mfspr => Modifiers::default(), + Opcode::Mfsr => Modifiers::default(), + Opcode::Mfsrin => Modifiers::default(), + Opcode::Mftb => Modifiers::default(), + Opcode::Mtcrf => Modifiers::default(), Opcode::Mtfsb0 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Mtfsb1 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Mtfsf => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Mtfsfi => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } - Opcode::Mtmsr => { - let mut m = Modifiers::default(); - m - } - Opcode::Mtspr => { - let mut m = Modifiers::default(); - m - } - Opcode::Mtsr => { - let mut m = Modifiers::default(); - m - } - Opcode::Mtsrin => { - let mut m = Modifiers::default(); - m - } + Opcode::Mtmsr => Modifiers::default(), + Opcode::Mtspr => Modifiers::default(), + Opcode::Mtsr => Modifiers::default(), + Opcode::Mtsrin => Modifiers::default(), Opcode::Mulhw => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Mulhwu => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Mulli => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Mullw => { let mut m = Modifiers::default(); + m.oe = self.bit(21); + m.rc = self.bit(31); m } Opcode::Nand => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Neg => { let mut m = Modifiers::default(); + m.oe = self.bit(21); + m.rc = self.bit(31); m } Opcode::Nor => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Or => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Orc => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } - Opcode::Ori => { - let mut m = Modifiers::default(); - m - } - Opcode::Oris => { - let mut m = Modifiers::default(); - m - } - Opcode::PsqL => { - let mut m = Modifiers::default(); - m - } - Opcode::PsqLu => { - let mut m = Modifiers::default(); - m - } - Opcode::PsqLux => { - let mut m = Modifiers::default(); - m - } - Opcode::PsqLx => { - let mut m = Modifiers::default(); - m - } - Opcode::PsqSt => { - let mut m = Modifiers::default(); - m - } - Opcode::PsqStu => { - let mut m = Modifiers::default(); - m - } - Opcode::PsqStux => { - let mut m = Modifiers::default(); - m - } - Opcode::PsqStx => { - let mut m = Modifiers::default(); - m - } + Opcode::Ori => Modifiers::default(), + Opcode::Oris => Modifiers::default(), + Opcode::PsqL => Modifiers::default(), + Opcode::PsqLu => Modifiers::default(), + Opcode::PsqLux => Modifiers::default(), + Opcode::PsqLx => Modifiers::default(), + Opcode::PsqSt => Modifiers::default(), + Opcode::PsqStu => Modifiers::default(), + Opcode::PsqStux => Modifiers::default(), + Opcode::PsqStx => Modifiers::default(), Opcode::PsAbs => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsAdd => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } - Opcode::PsCmpo0 => { - let mut m = Modifiers::default(); - m - } - Opcode::PsCmpo1 => { - let mut m = Modifiers::default(); - m - } - Opcode::PsCmpu0 => { - let mut m = Modifiers::default(); - m - } - Opcode::PsCmpu1 => { - let mut m = Modifiers::default(); - m - } + Opcode::PsCmpo0 => Modifiers::default(), + Opcode::PsCmpo1 => Modifiers::default(), + Opcode::PsCmpu0 => Modifiers::default(), + Opcode::PsCmpu1 => Modifiers::default(), Opcode::PsDiv => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMadd => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMadds0 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMadds1 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMerge00 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMerge01 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMerge10 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMerge11 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMr => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMsub => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMul => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMuls0 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsMuls1 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsNabs => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsNeg => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsNmadd => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsNmsub => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsRes => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsRsqrte => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsSel => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsSub => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsSum0 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::PsSum1 => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } - Opcode::Rfi => { - let mut m = Modifiers::default(); - m - } + Opcode::Rfi => Modifiers::default(), Opcode::Rlwimi => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Rlwinm => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Rlwnm => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } - Opcode::Sc => { - let mut m = Modifiers::default(); - m - } + Opcode::Sc => Modifiers::default(), Opcode::Slw => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Sraw => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Srawi => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } Opcode::Srw => { let mut m = Modifiers::default(); + m.rc = self.bit(31); m } - Opcode::Stb => { - let mut m = Modifiers::default(); - m - } - Opcode::Stbu => { - let mut m = Modifiers::default(); - m - } - Opcode::Stbux => { - let mut m = Modifiers::default(); - m - } - Opcode::Stbx => { - let mut m = Modifiers::default(); - m - } - Opcode::Stfd => { - let mut m = Modifiers::default(); - m - } - Opcode::Stfdu => { - let mut m = Modifiers::default(); - m - } - Opcode::Stfdux => { - let mut m = Modifiers::default(); - m - } - Opcode::Stfdx => { - let mut m = Modifiers::default(); - m - } - Opcode::Stfiwx => { - let mut m = Modifiers::default(); - m - } - Opcode::Stfs => { - let mut m = Modifiers::default(); - m - } - Opcode::Stfsu => { - let mut m = Modifiers::default(); - m - } - Opcode::Stfsux => { - let mut m = Modifiers::default(); - m - } - Opcode::Stfsx => { - let mut m = Modifiers::default(); - m - } - Opcode::Sth => { - let mut m = Modifiers::default(); - m - } - Opcode::Sthbrx => { - let mut m = Modifiers::default(); - m - } - Opcode::Sthu => { - let mut m = Modifiers::default(); - m - } - Opcode::Sthux => { - let mut m = Modifiers::default(); - m - } - Opcode::Sthx => { - let mut m = Modifiers::default(); - m - } - Opcode::Stmw => { - let mut m = Modifiers::default(); - m - } - Opcode::Stswi => { - let mut m = Modifiers::default(); - m - } - Opcode::Stswx => { - let mut m = Modifiers::default(); - m - } - Opcode::Stw => { - let mut m = Modifiers::default(); - m - } - Opcode::Stwbrx => { - let mut m = Modifiers::default(); - m - } - Opcode::Stwcx_ => { - let mut m = Modifiers::default(); - m - } - Opcode::Stwu => { - let mut m = Modifiers::default(); - m - } - Opcode::Stwux => { - let mut m = Modifiers::default(); - m - } - Opcode::Stwx => { - let mut m = Modifiers::default(); - m - } + Opcode::Stb => Modifiers::default(), + Opcode::Stbu => Modifiers::default(), + Opcode::Stbux => Modifiers::default(), + Opcode::Stbx => Modifiers::default(), + Opcode::Stfd => Modifiers::default(), + Opcode::Stfdu => Modifiers::default(), + Opcode::Stfdux => Modifiers::default(), + Opcode::Stfdx => Modifiers::default(), + Opcode::Stfiwx => Modifiers::default(), + Opcode::Stfs => Modifiers::default(), + Opcode::Stfsu => Modifiers::default(), + Opcode::Stfsux => Modifiers::default(), + Opcode::Stfsx => Modifiers::default(), + Opcode::Sth => Modifiers::default(), + Opcode::Sthbrx => Modifiers::default(), + Opcode::Sthu => Modifiers::default(), + Opcode::Sthux => Modifiers::default(), + Opcode::Sthx => Modifiers::default(), + Opcode::Stmw => Modifiers::default(), + Opcode::Stswi => Modifiers::default(), + Opcode::Stswx => Modifiers::default(), + Opcode::Stw => Modifiers::default(), + Opcode::Stwbrx => Modifiers::default(), + Opcode::Stwcx_ => Modifiers::default(), + Opcode::Stwu => Modifiers::default(), + Opcode::Stwux => Modifiers::default(), + Opcode::Stwx => Modifiers::default(), Opcode::Subf => { let mut m = Modifiers::default(); + m.oe = self.bit(21); + m.rc = self.bit(31); m } Opcode::Subfc => { let mut m = Modifiers::default(); + m.oe = self.bit(21); + m.rc = self.bit(31); m } Opcode::Subfe => { let mut m = Modifiers::default(); + m.oe = self.bit(21); + m.rc = self.bit(31); m } - Opcode::Subfic => { - let mut m = Modifiers::default(); - m - } + Opcode::Subfic => Modifiers::default(), Opcode::Subfme => { let mut m = Modifiers::default(); + m.oe = self.bit(21); + m.rc = self.bit(31); m } Opcode::Subfze => { let mut m = Modifiers::default(); + m.oe = self.bit(21); + m.rc = self.bit(31); m } - Opcode::Sync => { - let mut m = Modifiers::default(); - m - } - Opcode::Tlbie => { - let mut m = Modifiers::default(); - m - } - Opcode::Tlbsync => { - let mut m = Modifiers::default(); - m - } - Opcode::Tw => { - let mut m = Modifiers::default(); - m - } - Opcode::Twi => { - let mut m = Modifiers::default(); - m - } - Opcode::Xor => { - let mut m = Modifiers::default(); - m - } - Opcode::Xori => { - let mut m = Modifiers::default(); - m - } - Opcode::Xoris => { - let mut m = Modifiers::default(); - m - } + Opcode::Sync => Modifiers::default(), + Opcode::Tlbie => Modifiers::default(), + Opcode::Tlbsync => Modifiers::default(), + Opcode::Tw => Modifiers::default(), + Opcode::Twi => Modifiers::default(), + Opcode::Xor => Modifiers::default(), + Opcode::Xori => Modifiers::default(), + Opcode::Xoris => Modifiers::default(), } } pub(crate) fn _simplified(self) -> SimplifiedIns { + match self.op { + Opcode::Addi => { + if (((self.code) >> (32 - 16u8)) & ((1 << 5usize) - 1)) == 0 { + return SimplifiedIns { + mnemonic: "li", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + Opcode::Addis => { + if (((self.code) >> (32 - 16u8)) & ((1 << 5usize) - 1)) == 0 { + return SimplifiedIns { + mnemonic: "lis", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + Opcode::Bc => { + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "blt", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "ble", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "beq", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "bge", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "bgt", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "bne", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "bso", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "bns", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 16 + && (((self.code) >> (32 - 16u8)) & ((1 << 5usize) - 1)) == 0 + { + return SimplifiedIns { + mnemonic: "bdnz", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 18 + && (((self.code) >> (32 - 16u8)) & ((1 << 5usize) - 1)) == 0 + { + return SimplifiedIns { + mnemonic: "bdz", + modifiers: { + let mut m = Modifiers::default(); + m.aa = self.bit(30); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + } + Opcode::Bcctr => { + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "bltctr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "blectr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "beqctr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "bgectr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "bgtctr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "bnectr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "bsoctr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "bnsctr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + } + Opcode::Bclr => { + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 20 + && (((self.code) >> (32 - 16u8)) & ((1 << 5usize) - 1)) == 0 + { + return SimplifiedIns { + mnemonic: "blr", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "bltlr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "blelr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "beqlr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "bgelr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "bgtlr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "bnelr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 12 { + return SimplifiedIns { + mnemonic: "bsolr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 4 { + return SimplifiedIns { + mnemonic: "bnslr", + modifiers: { + let mut m = Modifiers::default(); + m.lk = self.bit(31); + m + }, + args: vec![], + ins: self, + }; + } + } + Opcode::Cmp => { + if (((self.code) >> (32 - 9u8)) & ((1 << 3usize) - 1)) == 0 { + return SimplifiedIns { + mnemonic: "cmpw", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + Opcode::Cmpi => { + if (((self.code) >> (32 - 9u8)) & ((1 << 3usize) - 1)) == 0 { + return SimplifiedIns { + mnemonic: "cmpwi", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 9u8)) & ((1 << 3usize) - 1)) == 0 { + return SimplifiedIns { + mnemonic: "cmpwi", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + Opcode::Cmpl => { + if (((self.code) >> (32 - 9u8)) & ((1 << 3usize) - 1)) == 0 { + return SimplifiedIns { + mnemonic: "cmplw", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + Opcode::Cmpli => { + if (((self.code) >> (32 - 9u8)) & ((1 << 3usize) - 1)) == 0 { + return SimplifiedIns { + mnemonic: "cmplwi", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 9u8)) & ((1 << 3usize) - 1)) == 0 { + return SimplifiedIns { + mnemonic: "cmplwi", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + Opcode::Mfspr => { + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 1 { + return SimplifiedIns { + mnemonic: "mfxer", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 8 { + return SimplifiedIns { + mnemonic: "mflr", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 9 { + return SimplifiedIns { + mnemonic: "mfctr", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 18 { + return SimplifiedIns { + mnemonic: "mfdsisr", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 397 { + return SimplifiedIns { + mnemonic: "mfdbatu", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 571 { + return SimplifiedIns { + mnemonic: "mftdu", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + Opcode::Mtspr => { + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 1 { + return SimplifiedIns { + mnemonic: "mtxer", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 8 { + return SimplifiedIns { + mnemonic: "mtlr", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 9 { + return SimplifiedIns { + mnemonic: "mtctr", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 18 { + return SimplifiedIns { + mnemonic: "mtdsisr", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 397 { + return SimplifiedIns { + mnemonic: "mtdbatu", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 21u8)) & ((1 << 10usize) - 1)) == 571 { + return SimplifiedIns { + mnemonic: "mttdu", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + Opcode::Or => {} + Opcode::Ori => { + if (((self.code) >> (32 - 16u8)) & ((1 << 5usize) - 1)) == 0 + && (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 0 + && (((self.code) >> (32 - 32u8)) & ((1 << 16usize) - 1)) == 0 + { + return SimplifiedIns { + mnemonic: "nop", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + Opcode::Rlwinm => {} + Opcode::Twi => { + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 8 { + return SimplifiedIns { + mnemonic: "twgti", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + if (((self.code) >> (32 - 11u8)) & ((1 << 5usize) - 1)) == 6 { + return SimplifiedIns { + mnemonic: "twllei", + modifiers: Modifiers::default(), + args: vec![], + ins: self, + }; + } + } + _ => {} + } SimplifiedIns { mnemonic: self.op.mnemonic(), modifiers: self._modifiers(), diff --git a/disasm/src/lib.rs b/disasm/src/lib.rs index 5e38e6c..f36a651 100644 --- a/disasm/src/lib.rs +++ b/disasm/src/lib.rs @@ -203,7 +203,7 @@ impl Field { Field::tbr(x) => Some(Argument::OpaqueU(*x)), Field::mtfsf_FM(x) => Some(Argument::OpaqueU(*x)), Field::mtfsf_IMM(x) => Some(Argument::OpaqueU(*x)), - Field::tw_TO(x) => Some(Argument::OpaqueU(*x)), + Field::TO(x) => Some(Argument::OpaqueU(*x)), _ => None, } } diff --git a/genisa/src/main.rs b/genisa/src/main.rs index f657e54..6601266 100644 --- a/genisa/src/main.rs +++ b/genisa/src/main.rs @@ -8,7 +8,7 @@ use itertools::Itertools; use proc_macro2::{Ident, Literal, Span, TokenStream, TokenTree}; use quote::quote; use serde::{Deserialize, Deserializer}; -use syn::LitInt; +use syn::{LitInt, LitStr}; macro_rules! token_stream { ($stream:ident) => { @@ -23,6 +23,9 @@ fn main() { } } +type Error = Box; +type Result = std::result::Result; + fn _main() -> Result<()> { let isa = load_isa()?; @@ -172,6 +175,7 @@ impl Opcode { pub(crate) struct Mnemonic { name: String, opcode: String, + modifiers: Vec, args: Vec, condition: String, #[serde(rename = "match")] @@ -324,14 +328,19 @@ impl Isa { for field in &self.fields { field_by_name.insert(field.name.clone(), field); } + // Map mnemonics by opcode. + let mut mnemonics_by_opcode = HashMap::<&String, Vec<&Mnemonic>>::new(); + for simple in &self.mnemonics { + mnemonics_by_opcode.entry(&simple.opcode).or_insert_with(|| Vec::new()).push(simple) + } // Generate match arms for each opcode. let mut field_match_arms = Vec::new(); let mut def_match_arms = Vec::new(); let mut use_match_arms = Vec::new(); let mut modifier_match_arms = Vec::new(); + let mut simplified_ins_match_arms = Vec::new(); for opcode in &self.opcodes { // Generate fields of opcode. - // TODO Support mnemonics. let mut fields = Vec::new(); for arg in &opcode.args { let field: &Field = field_by_name.get(arg).ok_or_else(|| { @@ -348,36 +357,12 @@ impl Isa { }); // Generate modifiers. - let mut set_modifiers: Vec = Vec::new(); - for modifier in &opcode.modifiers { - set_modifiers.extend(match modifier.as_str() { - "OE" => quote! { m.oe = self.bit(21); }, - "Rc" => quote! { m.rc = self.bit(31); }, - "AA" => quote! { m.aa = self.bit(30); }, - "LK" => quote! { m.lk = self.bit(31); }, - _ => { - return Err(format!("unsupported modifier {}", modifier).into()); - } - }) - } - for modifier in &opcode.side_effects { - set_modifiers.extend(match modifier.as_str() { - "OE" => quote! { m.oe = true; }, - "Rc" => quote! { m.rc = true; }, - "AA" => quote! { m.aa = true; }, - "LK" => quote! { m.lk = true; }, - _ => { - return Err(format!("unsupported modifier {}", modifier).into()); - } - }) - } - let set_modifiers = token_stream!(set_modifiers); + let modifiers = ModifiersExpr { + modifiers: opcode.modifiers.clone(), + side_effects: opcode.side_effects.clone(), + }.build()?; modifier_match_arms.push(quote! { - Opcode::#ident => { - let mut m = Modifiers::default(); - #set_modifiers - m - } + Opcode::#ident => #modifiers, }); // Generate defs. @@ -434,11 +419,59 @@ impl Isa { uses }, }); + + // Generate instruction simplification. + if let Some(mnemonics) = mnemonics_by_opcode.get(&opcode.name) { + let mut simplified_conditions = Vec::new(); + for mnemonic in mnemonics { + if mnemonic.matcher.is_empty() { + continue; // TODO else branch + } + // Emit if condition. + simplified_conditions.push(quote!(if)); + for (i, condition) in mnemonic.matcher.iter().enumerate() { + if i > 0 { + simplified_conditions.push(quote!(&&)); + } + // Express value from opcode. + let field: &Field = field_by_name.get(&condition.arg).ok_or_else(|| { + Error::from(format!("undefined field {}", &condition.arg)) + })?; + simplified_conditions.push(field.express_value_self()); + // Equate with literal. + let lit_int = LitInt::new(&format!("{}", condition.value), Span::call_site()); + simplified_conditions.push(quote!(== #lit_int)); + } + // Emit branch. + let mnemonic_lit = LitStr::new(&mnemonic.name, Span::call_site()); + let modifiers = ModifiersExpr { + modifiers: mnemonic.modifiers.clone(), + side_effects: vec![], + }.build()?; + simplified_conditions.push(quote! { + { + return SimplifiedIns { + mnemonic: #mnemonic_lit, + modifiers: #modifiers, + args: vec![], + ins: self, + }; + } + }); + } + let simplified_conditions = token_stream!(simplified_conditions); + simplified_ins_match_arms.push(quote! { + Opcode::#ident => { + #simplified_conditions + }, + }); + } } let field_match_arms = token_stream!(field_match_arms); let def_match_arms = token_stream!(def_match_arms); let use_match_arms = token_stream!(use_match_arms); let modifier_match_arms = token_stream!(modifier_match_arms); + let simplified_ins_match_arms = token_stream!(simplified_ins_match_arms); // Generate final fields function. let ins_impl = quote! { impl Ins { @@ -474,6 +507,10 @@ impl Isa { } pub(crate) fn _simplified(self) -> SimplifiedIns { + match self.op { + #simplified_ins_match_arms + _ => {} + } SimplifiedIns { mnemonic: self.op.mnemonic(), modifiers: self._modifiers(), @@ -532,5 +569,56 @@ fn to_rust_variant_str(key: &str) -> Result { } } -type Error = Box; -type Result = std::result::Result; +#[derive(Default)] +pub(crate) struct ModifiersExpr { + pub(crate) modifiers: Vec, + pub(crate) side_effects: Vec, +} + +impl ModifiersExpr { + fn new() -> Self { + Self::default() + } + + fn build(&self) -> Result { + if self.modifiers.is_empty() && self.side_effects.is_empty() { + return Ok(Self::build_empty()); + } + let mut statements: Vec = Vec::new(); + for modifier in &self.modifiers { + statements.extend(match modifier.as_str() { + "OE" => quote! { m.oe = self.bit(21); }, + "Rc" => quote! { m.rc = self.bit(31); }, + "AA" => quote! { m.aa = self.bit(30); }, + "LK" => quote! { m.lk = self.bit(31); }, + _ => { + return Err(format!("unsupported modifier {}", modifier).into()); + } + }) + } + for modifier in &self.side_effects { + statements.extend(match modifier.as_str() { + // TODO dedup modifiers + "OE" => quote! { m.oe = true; }, + "Rc" => quote! { m.rc = true; }, + "AA" => quote! { m.aa = true; }, + "LK" => quote! { m.lk = true; }, + _ => { + return Err(format!("unsupported modifier {}", modifier).into()); + } + }) + } + let statements = token_stream!(statements); + Ok(quote! { + { + let mut m = Modifiers::default(); + #statements + m + } + }) + } + + fn build_empty() -> TokenStream { + quote!(Modifiers::default()) + } +} diff --git a/isa.yaml b/isa.yaml index 6d28f9b..5074eb9 100644 --- a/isa.yaml +++ b/isa.yaml @@ -127,7 +127,7 @@ fields: arg: "OpaqueU" desc: "Immediate for mtfsfi" bits: "16..20" - - name: "tw_TO" + - name: "TO" arg: "OpaqueU" desc: "Bitset for tw and twi" bits: "6..11" @@ -1048,7 +1048,7 @@ opcodes: desc: "Move from FPSCR" bitmask: 0xfc1ffffe pattern: 0xfc00048e - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "crfD" ] defs: [ "crfD" ] @@ -1099,7 +1099,7 @@ opcodes: desc: "Move to FPSCR Bit 0" bitmask: 0xfc1ffffe pattern: 0xfc00008c - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "crbD" ] defs: [ "crbD" ] @@ -1107,7 +1107,7 @@ opcodes: desc: "Move to FPSCR Bit 1" bitmask: 0xfc1ffffe pattern: 0xfc00004c - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "crbD" ] defs: [ "crbD" ] @@ -1115,7 +1115,7 @@ opcodes: desc: "Move to FPSCR Fields" bitmask: 0xfe0107fe pattern: 0xfc00058e - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "mtfsf_FM", "frB" ] uses: [ "frB" ] @@ -1123,7 +1123,7 @@ opcodes: desc: "Move to FPSCR Field Immediate" bitmask: 0xfc7f0ffe pattern: 0xfc00010c - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "crfD", "mtfsf_IMM" ] defs: [ "crfD" ] @@ -1159,7 +1159,7 @@ opcodes: desc: "Multiply High Word" bitmask: 0xfc0007fe pattern: 0x7c000096 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rD", "rA", "rB" ] defs: [ "rD" ] uses: [ "rA", "rB" ] @@ -1168,7 +1168,7 @@ opcodes: desc: "Multiply High Word Unsigned" bitmask: 0xfc0007fe pattern: 0x7c000016 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rD", "rA", "rB" ] defs: [ "rD" ] uses: [ "rA", "rB" ] @@ -1177,7 +1177,7 @@ opcodes: desc: "Multiply Low Immediate" bitmask: 0xfc000000 pattern: 0x1c000000 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rD", "rA", "simm" ] defs: [ "rD" ] uses: [ "rA" ] @@ -1186,7 +1186,7 @@ opcodes: desc: "Multiply Low Word" bitmask: 0xfc0003fe pattern: 0x7c0001d6 - modifier: [ "OE", "Rc" ] + modifiers: [ "OE", "Rc" ] args: [ "rD", "rA", "rB" ] defs: [ "rD" ] uses: [ "rA", "rB" ] @@ -1195,7 +1195,7 @@ opcodes: desc: "NAND" bitmask: 0xfc0007fe pattern: 0x7c0003b8 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "rB" ] defs: [ "rA" ] uses: [ "rS", "rB" ] @@ -1204,7 +1204,7 @@ opcodes: desc: "Negate" bitmask: 0xfc00fffe pattern: 0x7c0000d0 - modifier: [ "OE", "Rc" ] + modifiers: [ "OE", "Rc" ] args: [ "rD", "rA" ] defs: [ "rD" ] uses: [ "rA" ] @@ -1213,7 +1213,7 @@ opcodes: desc: "NOR" bitmask: 0xfc0007fe pattern: 0x7c0000f8 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "rB" ] defs: [ "rA" ] uses: [ "rS", "rB" ] @@ -1222,7 +1222,7 @@ opcodes: desc: "OR" bitmask: 0xfc0007fe pattern: 0x7c000378 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "rB" ] defs: [ "rA" ] uses: [ "rS", "rB" ] @@ -1231,7 +1231,7 @@ opcodes: desc: "OR with Complement" bitmask: 0xfc0007fe pattern: 0x7c000338 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "rB" ] defs: [ "rA" ] uses: [ "rS", "rB" ] @@ -1318,7 +1318,7 @@ opcodes: desc: "Paired Single Absolute Value" bitmask: 0xfc1f07fe pattern: 0x10000210 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frB" ] defs: [ "frD" ] uses: [ "frA", "frB" ] @@ -1327,7 +1327,7 @@ opcodes: desc: "Paired Single Add" bitmask: 0xfc0007fe pattern: 0x1000002a - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frB" ] defs: [ "frD" ] uses: [ "frA", "frB" ] @@ -1368,7 +1368,7 @@ opcodes: desc: "Paired Single Divide" bitmask: 0xfc0007fe pattern: 0x10000024 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frB" ] defs: [ "frD" ] uses: [ "frA", "frB" ] @@ -1377,7 +1377,7 @@ opcodes: desc: "Paired Single Multiply-Add" bitmask: 0xfc00003e pattern: 0x1000003a - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC", "frB" ] defs: [ "frD" ] uses: [ "frA", "frC", "frB" ] @@ -1386,7 +1386,7 @@ opcodes: desc: "Paired Single Multiply-Add Scalar high" bitmask: 0xfc00003e pattern: 0x1000001c - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC", "frB" ] defs: [ "frD" ] uses: [ "frA", "frC", "frB" ] @@ -1395,7 +1395,7 @@ opcodes: desc: "Paired Single Multiply-Add Scalar low" bitmask: 0xfc00003e pattern: 0x1000001e - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC", "frB" ] defs: [ "frD" ] uses: [ "frA", "frC", "frB" ] @@ -1404,7 +1404,7 @@ opcodes: desc: "Paired Single MERGE high" bitmask: 0xfc0007fe pattern: 0x10000420 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frB" ] defs: [ "frD" ] uses: [ "frA", "frB" ] @@ -1413,7 +1413,7 @@ opcodes: desc: "Paired Single MERGE direct" bitmask: 0xfc0007fe pattern: 0x10000460 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frB" ] defs: [ "frD" ] uses: [ "frA", "frB" ] @@ -1422,7 +1422,7 @@ opcodes: desc: "Paired Single MERGE swapped" bitmask: 0xfc0007fe pattern: 0x100004a0 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frB" ] defs: [ "frD" ] uses: [ "frA", "frB" ] @@ -1431,7 +1431,7 @@ opcodes: desc: "Paired Single MERGE low" bitmask: 0xfc0007fe pattern: 0x100004e0 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frB" ] defs: [ "frD" ] uses: [ "frA", "frB" ] @@ -1440,7 +1440,7 @@ opcodes: desc: "Paired Single Move Register" bitmask: 0xfc1f07fe pattern: 0x10000090 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frB" ] defs: [ "frD" ] uses: [ "frB" ] @@ -1449,7 +1449,7 @@ opcodes: desc: "Paired Single Multiply-Subtract" bitmask: 0xfc00003e pattern: 0x10000038 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC", "frB" ] defs: [ "frD" ] uses: [ "frA", "frC", "frB" ] @@ -1458,7 +1458,7 @@ opcodes: desc: "Paired Single Multiply" bitmask: 0xfc00f83e pattern: 0x10000032 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC" ] defs: [ "frD" ] uses: [ "frA", "frC" ] @@ -1467,7 +1467,7 @@ opcodes: desc: "Paired Single Multiply Scalar high" bitmask: 0xfc00f83e pattern: 0x10000018 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC" ] defs: [ "frD" ] uses: [ "frA", "frC" ] @@ -1476,7 +1476,7 @@ opcodes: desc: "Paired Single Multiply Scalar low" bitmask: 0xfc00f83e pattern: 0x1000001a - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC" ] defs: [ "frD" ] uses: [ "frA", "frC" ] @@ -1485,7 +1485,7 @@ opcodes: desc: "Paired Single Negative Absolute Value" bitmask: 0xfc1f07fe pattern: 0x10000110 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frB" ] defs: [ "frD" ] uses: [ "frB" ] @@ -1494,7 +1494,7 @@ opcodes: desc: "Paired Single Negate" bitmask: 0xfc1f07fe pattern: 0x10000050 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frB" ] defs: [ "frD" ] uses: [ "frB" ] @@ -1503,7 +1503,7 @@ opcodes: desc: "Paired Single Negative Multiply-Add" bitmask: 0xfc00003e pattern: 0x1000003e - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC", "frB" ] defs: [ "frD" ] uses: [ "frA", "frC", "frB" ] @@ -1512,7 +1512,7 @@ opcodes: desc: "Paired Single Negative Multiply-Subtract" bitmask: 0xfc00003e pattern: 0x1000003c - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC", "frB" ] defs: [ "frD" ] uses: [ "frA", "frC", "frB" ] @@ -1521,7 +1521,7 @@ opcodes: desc: "Paired Single Reciprocal Estimate" bitmask: 0xfc1f07fe pattern: 0x10000030 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frB" ] defs: [ "frD" ] uses: [ "frB" ] @@ -1530,7 +1530,7 @@ opcodes: desc: "Paired Single Reciprocal Square Root Estimate" bitmask: 0xfc1f07fe pattern: 0x10000034 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frB" ] defs: [ "frD" ] uses: [ "frB" ] @@ -1539,7 +1539,7 @@ opcodes: desc: "Paired Single Select" bitmask: 0xfc00003e pattern: 0x1000002e - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC", "frB" ] defs: [ "frD" ] uses: [ "frA", "frC", "frB" ] @@ -1548,7 +1548,7 @@ opcodes: desc: "Paired Single Subtract" bitmask: 0xfc0007fe pattern: 0x10000028 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frB" ] defs: [ "frD" ] uses: [ "frA", "frB" ] @@ -1557,7 +1557,7 @@ opcodes: desc: "Paired Single vector SUM high" bitmask: 0xfc00003e pattern: 0x10000014 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC", "frB" ] defs: [ "frD" ] uses: [ "frA", "frC", "frB" ] @@ -1566,7 +1566,7 @@ opcodes: desc: "Paired Single vector SUM low" bitmask: 0xfc00003e pattern: 0x10000016 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "frD", "frA", "frC", "frB" ] defs: [ "frD" ] uses: [ "frA", "frC", "frB" ] @@ -1580,7 +1580,7 @@ opcodes: desc: "Rotate Left Word Immediate then Mask Insert" bitmask: 0xfc000000 pattern: 0x50000000 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "SH", "MB", "ME" ] defs: [ "rA" ] uses: [ "rA", "rS", "SH" ] @@ -1589,7 +1589,7 @@ opcodes: desc: "Rotate Left Word Immediate then AND with Mask" bitmask: 0xfc000000 pattern: 0x54000000 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "SH", "MB", "ME" ] defs: [ "rA" ] uses: [ "rS", "SH" ] @@ -1598,7 +1598,7 @@ opcodes: desc: "Rotate Left Word then AND with Mask" bitmask: 0xfc000000 pattern: 0x5c000000 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "rB", "MB", "ME" ] defs: [ "rA" ] uses: [ "rS", "rB" ] @@ -1612,7 +1612,7 @@ opcodes: desc: "Shift Left Word" bitmask: 0xfc0007fe pattern: 0x7c000030 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "rB" ] defs: [ "rA" ] uses: [ "rS", "rB" ] @@ -1621,7 +1621,7 @@ opcodes: desc: "Shift Right Algebraic Word" bitmask: 0xfc0007fe pattern: 0x7c000630 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "rB" ] defs: [ "rA" ] uses: [ "rS", "rB" ] @@ -1630,7 +1630,7 @@ opcodes: desc: "Shift Right Algebraic Word Immediate" bitmask: 0xfc0007fe pattern: 0x7c000670 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rA", "rS", "SH" ] defs: [ "rA" ] uses: [ "rS" ] @@ -1639,7 +1639,7 @@ opcodes: desc: "Shift Right Word" bitmask: 0xfc0007fe pattern: 0x7c000430 - modifier: [ "Rc" ] + modifiers: [ "Rc" ] args: [ "rS", "rA", "rB" ] defs: [ "rA" ] uses: [ "rA", "rB" ] @@ -1847,7 +1847,7 @@ opcodes: desc: "Subtract From Carrying" bitmask: 0xfc0003fe pattern: 0x7c000050 - modifier: [ "OE", "Rc" ] + modifiers: [ "OE", "Rc" ] args: [ "rD", "rA", "rB" ] defs: [ "rD" ] uses: [ "rA", "rB" ] @@ -1856,7 +1856,7 @@ opcodes: desc: "Subtract from Carrying" bitmask: 0xfc0003fe pattern: 0x7c000010 - modifier: [ "OE", "Rc" ] + modifiers: [ "OE", "Rc" ] args: [ "rD", "rA", "rB" ] defs: [ "rD" ] uses: [ "rA", "rB" ] @@ -1865,7 +1865,7 @@ opcodes: desc: "Subtract from Extended" bitmask: 0xfc0003fe pattern: 0x7c000110 - modifier: [ "OE", "Rc" ] + modifiers: [ "OE", "Rc" ] args: [ "rD", "rA", "rB" ] defs: [ "rD" ] uses: [ "rA", "rB" ] @@ -1882,7 +1882,7 @@ opcodes: desc: "Subtract from Minus One Extended" bitmask: 0xfc00fbfe pattern: 0x7c0001d0 - modifier: [ "OE", "Rc" ] + modifiers: [ "OE", "Rc" ] args: [ "rD", "rA" ] defs: [ "rD" ] uses: [ "rA" ] @@ -1891,7 +1891,7 @@ opcodes: desc: "Subtract from Zero Extended" bitmask: 0xfc00fbfe pattern: 0x7c000190 - modifier: [ "OE", "Rc" ] + modifiers: [ "OE", "Rc" ] args: [ "rD", "rA" ] defs: [ "rD" ] uses: [ "rA" ] @@ -1917,14 +1917,14 @@ opcodes: desc: "Trap Word" bitmask: 0xfc0007ff pattern: 0x7c000008 - args: [ "tw_TO", "rA", "rB" ] + args: [ "TO", "rA", "rB" ] uses: [ "rA", "rB" ] - name: "twi" desc: "Trap Word Immediate" bitmask: 0xfc000000 pattern: 0xc0000000 - args: [ "tw_TO", "rA", "simm" ] + args: [ "TO", "rA", "simm" ] uses: [ "rA" ] - name: "xor"