isa: add missing `L` arg to the `cmp` instruction family
Also fix the mnemonics for said instruction family
This commit is contained in:
parent
ad1ec7aaa9
commit
f4389e5edd
|
@ -1166,6 +1166,7 @@ pub enum Field {
|
||||||
mtfsf_FM(OpaqueU),
|
mtfsf_FM(OpaqueU),
|
||||||
mtfsf_IMM(OpaqueU),
|
mtfsf_IMM(OpaqueU),
|
||||||
TO(OpaqueU),
|
TO(OpaqueU),
|
||||||
|
L(OpaqueU),
|
||||||
xer,
|
xer,
|
||||||
ctr,
|
ctr,
|
||||||
lr,
|
lr,
|
||||||
|
@ -1212,6 +1213,7 @@ impl Field {
|
||||||
Field::mtfsf_FM(x) => Some(Argument::OpaqueU(*x)),
|
Field::mtfsf_FM(x) => Some(Argument::OpaqueU(*x)),
|
||||||
Field::mtfsf_IMM(x) => Some(Argument::OpaqueU(*x)),
|
Field::mtfsf_IMM(x) => Some(Argument::OpaqueU(*x)),
|
||||||
Field::TO(x) => Some(Argument::OpaqueU(*x)),
|
Field::TO(x) => Some(Argument::OpaqueU(*x)),
|
||||||
|
Field::L(x) => Some(Argument::OpaqueU(*x)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1256,6 +1258,7 @@ impl Field {
|
||||||
Field::mtfsf_FM(_) => "mtfsf_FM",
|
Field::mtfsf_FM(_) => "mtfsf_FM",
|
||||||
Field::mtfsf_IMM(_) => "mtfsf_IMM",
|
Field::mtfsf_IMM(_) => "mtfsf_IMM",
|
||||||
Field::TO(_) => "TO",
|
Field::TO(_) => "TO",
|
||||||
|
Field::L(_) => "L",
|
||||||
Field::xer => "xer",
|
Field::xer => "xer",
|
||||||
Field::ctr => "ctr",
|
Field::ctr => "ctr",
|
||||||
Field::lr => "lr",
|
Field::lr => "lr",
|
||||||
|
@ -1360,11 +1363,13 @@ impl Ins {
|
||||||
],
|
],
|
||||||
Opcode::Cmp => vec![
|
Opcode::Cmp => vec![
|
||||||
Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
|
Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Field::L(OpaqueU(((self.code >> 21u8) & 0x1) 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(CRField(((self.code >> 23u8) & 0x7) as _)),
|
Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Field::L(OpaqueU(((self.code >> 21u8) & 0x1) 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 i32) as _,
|
((((self.code & 0xffff) ^ 0x8000).wrapping_sub(0x8000)) as i32) as _,
|
||||||
|
@ -1372,11 +1377,13 @@ impl Ins {
|
||||||
],
|
],
|
||||||
Opcode::Cmpl => vec![
|
Opcode::Cmpl => vec![
|
||||||
Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
|
Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Field::L(OpaqueU(((self.code >> 21u8) & 0x1) 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(CRField(((self.code >> 23u8) & 0x7) as _)),
|
Field::crfD(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Field::L(OpaqueU(((self.code >> 21u8) & 0x1) 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 _)),
|
||||||
],
|
],
|
||||||
|
@ -5566,7 +5573,7 @@ impl Ins {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Opcode::Cmp => {
|
Opcode::Cmp => {
|
||||||
if ((self.code >> 23u8) & 0x7) == 0 {
|
if ((self.code >> 23u8) & 0x7) == 0 && ((self.code >> 21u8) & 0x1) == 0 {
|
||||||
return SimplifiedIns {
|
return SimplifiedIns {
|
||||||
mnemonic: "cmpw",
|
mnemonic: "cmpw",
|
||||||
args: vec![
|
args: vec![
|
||||||
|
@ -5576,9 +5583,41 @@ impl Ins {
|
||||||
ins: self,
|
ins: self,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if ((self.code >> 21u8) & 0x1) == 0 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmpw",
|
||||||
|
args: vec![
|
||||||
|
Argument::CRField(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 11u8) & 0x1f) as _)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if ((self.code >> 23u8) & 0x7) == 0 && ((self.code >> 21u8) & 0x1) == 1 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmpd",
|
||||||
|
args: vec![
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 11u8) & 0x1f) as _)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if ((self.code >> 21u8) & 0x1) == 1 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmpd",
|
||||||
|
args: vec![
|
||||||
|
Argument::CRField(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 11u8) & 0x1f) as _)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Opcode::Cmpi => {
|
Opcode::Cmpi => {
|
||||||
if ((self.code >> 23u8) & 0x7) == 0 {
|
if ((self.code >> 23u8) & 0x7) == 0 && ((self.code >> 21u8) & 0x1) == 0 {
|
||||||
return SimplifiedIns {
|
return SimplifiedIns {
|
||||||
mnemonic: "cmpwi",
|
mnemonic: "cmpwi",
|
||||||
args: vec![
|
args: vec![
|
||||||
|
@ -5591,7 +5630,7 @@ impl Ins {
|
||||||
ins: self,
|
ins: self,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ((self.code >> 23u8) & 0x7) == 0 {
|
if ((self.code >> 21u8) & 0x1) == 0 {
|
||||||
return SimplifiedIns {
|
return SimplifiedIns {
|
||||||
mnemonic: "cmpwi",
|
mnemonic: "cmpwi",
|
||||||
args: vec![
|
args: vec![
|
||||||
|
@ -5605,9 +5644,36 @@ impl Ins {
|
||||||
ins: self,
|
ins: self,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if ((self.code >> 23u8) & 0x7) == 0 && ((self.code >> 21u8) & 0x1) == 1 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmpdi",
|
||||||
|
args: vec![
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::Simm(Simm(
|
||||||
|
((((self.code & 0xffff) ^ 0x8000).wrapping_sub(0x8000)) as i32)
|
||||||
|
as _,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if ((self.code >> 21u8) & 0x1) == 1 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmpdi",
|
||||||
|
args: vec![
|
||||||
|
Argument::CRField(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::Simm(Simm(
|
||||||
|
((((self.code & 0xffff) ^ 0x8000).wrapping_sub(0x8000)) as i32)
|
||||||
|
as _,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Opcode::Cmpl => {
|
Opcode::Cmpl => {
|
||||||
if ((self.code >> 23u8) & 0x7) == 0 {
|
if ((self.code >> 23u8) & 0x7) == 0 && ((self.code >> 21u8) & 0x1) == 0 {
|
||||||
return SimplifiedIns {
|
return SimplifiedIns {
|
||||||
mnemonic: "cmplw",
|
mnemonic: "cmplw",
|
||||||
args: vec![
|
args: vec![
|
||||||
|
@ -5617,9 +5683,41 @@ impl Ins {
|
||||||
ins: self,
|
ins: self,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if ((self.code >> 21u8) & 0x1) == 0 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmplw",
|
||||||
|
args: vec![
|
||||||
|
Argument::CRField(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 11u8) & 0x1f) as _)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if ((self.code >> 23u8) & 0x7) == 0 && ((self.code >> 21u8) & 0x1) == 1 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmpld",
|
||||||
|
args: vec![
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 11u8) & 0x1f) as _)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if ((self.code >> 21u8) & 0x1) == 1 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmpld",
|
||||||
|
args: vec![
|
||||||
|
Argument::CRField(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 11u8) & 0x1f) as _)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Opcode::Cmpli => {
|
Opcode::Cmpli => {
|
||||||
if ((self.code >> 23u8) & 0x7) == 0 {
|
if ((self.code >> 23u8) & 0x7) == 0 && ((self.code >> 21u8) & 0x1) == 0 {
|
||||||
return SimplifiedIns {
|
return SimplifiedIns {
|
||||||
mnemonic: "cmplwi",
|
mnemonic: "cmplwi",
|
||||||
args: vec![
|
args: vec![
|
||||||
|
@ -5629,7 +5727,7 @@ impl Ins {
|
||||||
ins: self,
|
ins: self,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ((self.code >> 23u8) & 0x7) == 0 {
|
if ((self.code >> 21u8) & 0x1) == 0 {
|
||||||
return SimplifiedIns {
|
return SimplifiedIns {
|
||||||
mnemonic: "cmplwi",
|
mnemonic: "cmplwi",
|
||||||
args: vec![
|
args: vec![
|
||||||
|
@ -5640,6 +5738,27 @@ impl Ins {
|
||||||
ins: self,
|
ins: self,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if ((self.code >> 23u8) & 0x7) == 0 && ((self.code >> 21u8) & 0x1) == 1 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmpldi",
|
||||||
|
args: vec![
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::Uimm(Uimm((self.code & 0xffff) as _)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if ((self.code >> 21u8) & 0x1) == 1 {
|
||||||
|
return SimplifiedIns {
|
||||||
|
mnemonic: "cmpldi",
|
||||||
|
args: vec![
|
||||||
|
Argument::CRField(CRField(((self.code >> 23u8) & 0x7) as _)),
|
||||||
|
Argument::GPR(GPR(((self.code >> 16u8) & 0x1f) as _)),
|
||||||
|
Argument::Uimm(Uimm((self.code & 0xffff) as _)),
|
||||||
|
],
|
||||||
|
ins: self,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Opcode::Creqv => {
|
Opcode::Creqv => {
|
||||||
if ((self.code >> 21u8) & 0x1f) == ((self.code >> 16u8) & 0x1f)
|
if ((self.code >> 21u8) & 0x1f) == ((self.code >> 16u8) & 0x1f)
|
||||||
|
@ -6093,6 +6212,10 @@ impl Ins {
|
||||||
((self.code >> 21u8) & 0x1f) as _
|
((self.code >> 21u8) & 0x1f) as _
|
||||||
}
|
}
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
pub fn field_L(&self) -> usize {
|
||||||
|
((self.code >> 21u8) & 0x1) as _
|
||||||
|
}
|
||||||
|
#[inline(always)]
|
||||||
pub fn field_OE(&self) -> bool {
|
pub fn field_OE(&self) -> bool {
|
||||||
self.bit(21usize)
|
self.bit(21usize)
|
||||||
}
|
}
|
||||||
|
|
86
isa.yaml
86
isa.yaml
|
@ -145,6 +145,10 @@ fields:
|
||||||
arg: OpaqueU
|
arg: OpaqueU
|
||||||
desc: Bitset for tw and twi
|
desc: Bitset for tw and twi
|
||||||
bits: 6..11
|
bits: 6..11
|
||||||
|
- name: L
|
||||||
|
arg: OpaqueU
|
||||||
|
desc: Bitset for cmp, cmpi, cmpl, cmpli
|
||||||
|
bits: 10..11
|
||||||
- name: xer
|
- name: xer
|
||||||
- name: ctr
|
- name: ctr
|
||||||
- name: lr
|
- name: lr
|
||||||
|
@ -313,7 +317,7 @@ opcodes:
|
||||||
desc: Compare
|
desc: Compare
|
||||||
bitmask: 0xfc4007ff
|
bitmask: 0xfc4007ff
|
||||||
pattern: 0x7c000000
|
pattern: 0x7c000000
|
||||||
args: [ crfD, rA, rB ]
|
args: [ crfD, L, rA, rB ]
|
||||||
defs: [ crfD ]
|
defs: [ crfD ]
|
||||||
uses: [ rA, rB ]
|
uses: [ rA, rB ]
|
||||||
|
|
||||||
|
@ -321,7 +325,7 @@ opcodes:
|
||||||
desc: Compare Immediate
|
desc: Compare Immediate
|
||||||
bitmask: 0xfc400000
|
bitmask: 0xfc400000
|
||||||
pattern: 0x2c000000
|
pattern: 0x2c000000
|
||||||
args: [ crfD, rA, simm ]
|
args: [ crfD, L, rA, simm ]
|
||||||
defs: [ crfD ]
|
defs: [ crfD ]
|
||||||
uses: [ rA ]
|
uses: [ rA ]
|
||||||
|
|
||||||
|
@ -329,7 +333,7 @@ opcodes:
|
||||||
desc: Compare Logical
|
desc: Compare Logical
|
||||||
bitmask: 0xfc4007ff
|
bitmask: 0xfc4007ff
|
||||||
pattern: 0x7c000040
|
pattern: 0x7c000040
|
||||||
args: [ crfD, rA, rB ]
|
args: [ crfD, L, rA, rB ]
|
||||||
defs: [ crfD ]
|
defs: [ crfD ]
|
||||||
uses: [ rA, rB ]
|
uses: [ rA, rB ]
|
||||||
|
|
||||||
|
@ -337,7 +341,7 @@ opcodes:
|
||||||
desc: Compare Logical Immediate
|
desc: Compare Logical Immediate
|
||||||
bitmask: 0xfc400000
|
bitmask: 0xfc400000
|
||||||
pattern: 0x28000000
|
pattern: 0x28000000
|
||||||
args: [ crfD, rA, uimm ]
|
args: [ crfD, L, rA, uimm ]
|
||||||
defs: [ crfD ]
|
defs: [ crfD ]
|
||||||
uses: [ rA ]
|
uses: [ rA ]
|
||||||
|
|
||||||
|
@ -2005,37 +2009,73 @@ mnemonics:
|
||||||
args: [ rA, rS, MB ]
|
args: [ rA, rS, MB ]
|
||||||
condition: ME == 31 && 32 - MB == SH
|
condition: ME == 31 && 32 - MB == SH
|
||||||
|
|
||||||
# Compares
|
# Compares Word
|
||||||
- name: cmpw
|
|
||||||
opcode: cmp
|
|
||||||
args: [ rA, rB ]
|
|
||||||
condition: crfD == 0
|
|
||||||
- name: cmpw
|
|
||||||
opcode: cmp
|
|
||||||
args: [ crfD, rA, rB ]
|
|
||||||
- name: cmplw
|
|
||||||
opcode: cmpl
|
|
||||||
args: [ rA, rB ]
|
|
||||||
condition: crfD == 0
|
|
||||||
- name: cmplw
|
|
||||||
opcode: cmpl
|
|
||||||
args: [ crfD, rA, rB ]
|
|
||||||
- name: cmpwi
|
- name: cmpwi
|
||||||
opcode: cmpi
|
opcode: cmpi
|
||||||
args: [ rA, simm ]
|
args: [ rA, simm ]
|
||||||
condition: crfD == 0
|
condition: crfD == 0 && L == 0
|
||||||
- name: cmpwi
|
- name: cmpwi
|
||||||
opcode: cmpi
|
opcode: cmpi
|
||||||
args: [ crfD, rA, simm ]
|
args: [ crfD, rA, simm ]
|
||||||
condition: crfD == 0
|
condition: L == 0
|
||||||
|
- name: cmpw
|
||||||
|
opcode: cmp
|
||||||
|
args: [ rA, rB ]
|
||||||
|
condition: crfD == 0 && L == 0
|
||||||
|
- name: cmpw
|
||||||
|
opcode: cmp
|
||||||
|
args: [ crfD, rA, rB ]
|
||||||
|
condition: L == 0
|
||||||
- name: cmplwi
|
- name: cmplwi
|
||||||
opcode: cmpli
|
opcode: cmpli
|
||||||
args: [ rA, uimm ]
|
args: [ rA, uimm ]
|
||||||
condition: crfD == 0
|
condition: crfD == 0 && L == 0
|
||||||
- name: cmplwi
|
- name: cmplwi
|
||||||
opcode: cmpli
|
opcode: cmpli
|
||||||
args: [ crfD, rA, uimm ]
|
args: [ crfD, rA, uimm ]
|
||||||
condition: crfD == 0
|
condition: L == 0
|
||||||
|
- name: cmplw
|
||||||
|
opcode: cmpl
|
||||||
|
args: [ rA, rB ]
|
||||||
|
condition: crfD == 0 && L == 0
|
||||||
|
- name: cmplw
|
||||||
|
opcode: cmpl
|
||||||
|
args: [ crfD, rA, rB ]
|
||||||
|
condition: L == 0
|
||||||
|
|
||||||
|
# Compares Doubleword
|
||||||
|
- name: cmpdi
|
||||||
|
opcode: cmpi
|
||||||
|
args: [ rA, simm ]
|
||||||
|
condition: crfD == 0 && L == 1
|
||||||
|
- name: cmpdi
|
||||||
|
opcode: cmpi
|
||||||
|
args: [ crfD, rA, simm ]
|
||||||
|
condition: L == 1
|
||||||
|
- name: cmpd
|
||||||
|
opcode: cmp
|
||||||
|
args: [ rA, rB ]
|
||||||
|
condition: crfD == 0 && L == 1
|
||||||
|
- name: cmpd
|
||||||
|
opcode: cmp
|
||||||
|
args: [ crfD, rA, rB ]
|
||||||
|
condition: L == 1
|
||||||
|
- name: cmpldi
|
||||||
|
opcode: cmpli
|
||||||
|
args: [ rA, uimm ]
|
||||||
|
condition: crfD == 0 && L == 1
|
||||||
|
- name: cmpldi
|
||||||
|
opcode: cmpli
|
||||||
|
args: [ crfD, rA, uimm ]
|
||||||
|
condition: L == 1
|
||||||
|
- name: cmpld
|
||||||
|
opcode: cmpl
|
||||||
|
args: [ rA, rB ]
|
||||||
|
condition: crfD == 0 && L == 1
|
||||||
|
- name: cmpld
|
||||||
|
opcode: cmpl
|
||||||
|
args: [ crfD, rA, rB ]
|
||||||
|
condition: L == 1
|
||||||
|
|
||||||
# Condition Register Logical
|
# Condition Register Logical
|
||||||
- name: crset
|
- name: crset
|
||||||
|
|
Loading…
Reference in New Issue