fix bc opcode
This commit is contained in:
parent
b8199e678c
commit
16f955947e
|
@ -4676,7 +4676,27 @@ impl Ins {
|
|||
}
|
||||
}
|
||||
Opcode::Bc => {
|
||||
if ((self.code >> 21u8) & 0x1f) == 12 {
|
||||
if ((self.code >> 21u8) & 0x1f) == 12
|
||||
&& ((self.code >> 16u8) & 0x1f) & 0b11 == 0b00
|
||||
&& ((self.code >> 18u8) & 0x7) == 0
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "blt",
|
||||
modifiers: {
|
||||
let mut m = Modifiers::default();
|
||||
m.aa = self.bit(30);
|
||||
m.lk = self.bit(31);
|
||||
m
|
||||
},
|
||||
args: vec![Argument::BranchDest(BranchDest(
|
||||
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) << 2u8)
|
||||
as _,
|
||||
))],
|
||||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 12 && ((self.code >> 16u8) & 0x1f) & 0b11 == 0b00
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "blt",
|
||||
modifiers: {
|
||||
|
@ -4695,7 +4715,27 @@ impl Ins {
|
|||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 4 {
|
||||
if ((self.code >> 21u8) & 0x1f) == 4
|
||||
&& ((self.code >> 16u8) & 0x1f) & 0b11 == 0b01
|
||||
&& ((self.code >> 18u8) & 0x7) == 0
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "ble",
|
||||
modifiers: {
|
||||
let mut m = Modifiers::default();
|
||||
m.aa = self.bit(30);
|
||||
m.lk = self.bit(31);
|
||||
m
|
||||
},
|
||||
args: vec![Argument::BranchDest(BranchDest(
|
||||
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) << 2u8)
|
||||
as _,
|
||||
))],
|
||||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 4 && ((self.code >> 16u8) & 0x1f) & 0b11 == 0b01
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "ble",
|
||||
modifiers: {
|
||||
|
@ -4714,7 +4754,27 @@ impl Ins {
|
|||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 12 {
|
||||
if ((self.code >> 21u8) & 0x1f) == 12
|
||||
&& ((self.code >> 16u8) & 0x1f) & 0b11 == 0b10
|
||||
&& ((self.code >> 18u8) & 0x7) == 0
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "beq",
|
||||
modifiers: {
|
||||
let mut m = Modifiers::default();
|
||||
m.aa = self.bit(30);
|
||||
m.lk = self.bit(31);
|
||||
m
|
||||
},
|
||||
args: vec![Argument::BranchDest(BranchDest(
|
||||
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) << 2u8)
|
||||
as _,
|
||||
))],
|
||||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 12 && ((self.code >> 16u8) & 0x1f) & 0b11 == 0b10
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "beq",
|
||||
modifiers: {
|
||||
|
@ -4733,7 +4793,27 @@ impl Ins {
|
|||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 4 {
|
||||
if ((self.code >> 21u8) & 0x1f) == 4
|
||||
&& ((self.code >> 16u8) & 0x1f) & 0b11 == 0b00
|
||||
&& ((self.code >> 18u8) & 0x7) == 0
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bge",
|
||||
modifiers: {
|
||||
let mut m = Modifiers::default();
|
||||
m.aa = self.bit(30);
|
||||
m.lk = self.bit(31);
|
||||
m
|
||||
},
|
||||
args: vec![Argument::BranchDest(BranchDest(
|
||||
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) << 2u8)
|
||||
as _,
|
||||
))],
|
||||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 4 && ((self.code >> 16u8) & 0x1f) & 0b11 == 0b00
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bge",
|
||||
modifiers: {
|
||||
|
@ -4752,7 +4832,27 @@ impl Ins {
|
|||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 12 {
|
||||
if ((self.code >> 21u8) & 0x1f) == 12
|
||||
&& ((self.code >> 16u8) & 0x1f) & 0b11 == 0b01
|
||||
&& ((self.code >> 18u8) & 0x7) == 0
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bgt",
|
||||
modifiers: {
|
||||
let mut m = Modifiers::default();
|
||||
m.aa = self.bit(30);
|
||||
m.lk = self.bit(31);
|
||||
m
|
||||
},
|
||||
args: vec![Argument::BranchDest(BranchDest(
|
||||
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) << 2u8)
|
||||
as _,
|
||||
))],
|
||||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 12 && ((self.code >> 16u8) & 0x1f) & 0b11 == 0b01
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bgt",
|
||||
modifiers: {
|
||||
|
@ -4771,7 +4871,27 @@ impl Ins {
|
|||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 4 {
|
||||
if ((self.code >> 21u8) & 0x1f) == 4
|
||||
&& ((self.code >> 16u8) & 0x1f) & 0b11 == 0b10
|
||||
&& ((self.code >> 18u8) & 0x7) == 0
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bne",
|
||||
modifiers: {
|
||||
let mut m = Modifiers::default();
|
||||
m.aa = self.bit(30);
|
||||
m.lk = self.bit(31);
|
||||
m
|
||||
},
|
||||
args: vec![Argument::BranchDest(BranchDest(
|
||||
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) << 2u8)
|
||||
as _,
|
||||
))],
|
||||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 4 && ((self.code >> 16u8) & 0x1f) & 0b11 == 0b10
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bne",
|
||||
modifiers: {
|
||||
|
@ -4790,7 +4910,27 @@ impl Ins {
|
|||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 12 {
|
||||
if ((self.code >> 21u8) & 0x1f) == 12
|
||||
&& ((self.code >> 16u8) & 0x1f) & 0b11 == 0b11
|
||||
&& ((self.code >> 18u8) & 0x7) == 0
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bso",
|
||||
modifiers: {
|
||||
let mut m = Modifiers::default();
|
||||
m.aa = self.bit(30);
|
||||
m.lk = self.bit(31);
|
||||
m
|
||||
},
|
||||
args: vec![Argument::BranchDest(BranchDest(
|
||||
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) << 2u8)
|
||||
as _,
|
||||
))],
|
||||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 12 && ((self.code >> 16u8) & 0x1f) & 0b11 == 0b11
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bso",
|
||||
modifiers: {
|
||||
|
@ -4809,7 +4949,27 @@ impl Ins {
|
|||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 4 {
|
||||
if ((self.code >> 21u8) & 0x1f) == 4
|
||||
&& ((self.code >> 16u8) & 0x1f) & 0b11 == 0b11
|
||||
&& ((self.code >> 18u8) & 0x7) == 0
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bns",
|
||||
modifiers: {
|
||||
let mut m = Modifiers::default();
|
||||
m.aa = self.bit(30);
|
||||
m.lk = self.bit(31);
|
||||
m
|
||||
},
|
||||
args: vec![Argument::BranchDest(BranchDest(
|
||||
(((((self.code >> 2u8) & 0x3fff) ^ 0x2000).wrapping_sub(0x2000)) << 2u8)
|
||||
as _,
|
||||
))],
|
||||
ins: self,
|
||||
};
|
||||
}
|
||||
if ((self.code >> 21u8) & 0x1f) == 4 && ((self.code >> 16u8) & 0x1f) & 0b11 == 0b11
|
||||
{
|
||||
return SimplifiedIns {
|
||||
mnemonic: "bns",
|
||||
modifiers: {
|
||||
|
|
|
@ -96,7 +96,6 @@ fn test_ins_b() {
|
|||
assert_asm!(0x4BDC1A59, "bl -0x23e5a8");
|
||||
}
|
||||
|
||||
/*
|
||||
#[test]
|
||||
fn test_ins_bc() {
|
||||
assert_asm!(0x40800008, "bge 0x8");
|
||||
|
@ -124,7 +123,6 @@ fn test_ins_bc() {
|
|||
assert_asm!(0x419C0008, "blt cr7, 0x8");
|
||||
assert_asm!(0x4200F560, "bdnz -0xaa0");
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
#[test]
|
||||
|
|
73
isa.yaml
73
isa.yaml
|
@ -2091,46 +2091,103 @@ mnemonics:
|
|||
condition: spr == 571
|
||||
|
||||
# Branch Conditional
|
||||
|
||||
# bc branch if negative
|
||||
- name: blt
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ BD ]
|
||||
condition: BO == 12 && BI & 0b11 == 0b00 && crfS == 0
|
||||
- name: blt
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ crfS, BD ]
|
||||
condition: BO == 12
|
||||
condition: BO == 12 && BI & 0b11 == 0b00
|
||||
|
||||
# bc branch if not positive
|
||||
- name: ble
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ BD ]
|
||||
condition: BO == 4 && BI & 0b11 == 0b01 && crfS == 0
|
||||
- name: ble
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ crfS, BD ]
|
||||
condition: BO == 4
|
||||
condition: BO == 4 && BI & 0b11 == 0b01
|
||||
|
||||
# bc branch if zero
|
||||
- name: beq
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ BD ]
|
||||
condition: BO == 12 && BI & 0b11 == 0b10 && crfS == 0
|
||||
- name: beq
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ crfS, BD ]
|
||||
condition: BO == 12
|
||||
condition: BO == 12 && BI & 0b11 == 0b10
|
||||
|
||||
# bc branch if not negative
|
||||
- name: bge
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ BD ]
|
||||
condition: BO == 4 && BI & 0b11 == 0b00 && crfS == 0
|
||||
- name: bge
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ crfS, BD ]
|
||||
condition: BO == 4
|
||||
condition: BO == 4 && BI & 0b11 == 0b00
|
||||
|
||||
# bc branch if positive
|
||||
- name: bgt
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ BD ]
|
||||
condition: BO == 12 && BI & 0b11 == 0b01 && crfS == 0
|
||||
- name: bgt
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ crfS, BD ]
|
||||
condition: BO == 12
|
||||
condition: BO == 12 && BI & 0b11 == 0b01
|
||||
|
||||
# bc branch if not zero
|
||||
- name: bne
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ BD ]
|
||||
condition: BO == 4 && BI & 0b11 == 0b10 && crfS == 0
|
||||
- name: bne
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ crfS, BD ]
|
||||
condition: BO == 4
|
||||
condition: BO == 4 && BI & 0b11 == 0b10
|
||||
|
||||
# bc branch if summary overflow
|
||||
- name: bso
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ BD ]
|
||||
condition: BO == 12 && BI & 0b11 == 0b11 && crfS == 0
|
||||
- name: bso
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ crfS, BD ]
|
||||
condition: BO == 12
|
||||
condition: BO == 12 && BI & 0b11 == 0b11
|
||||
|
||||
# bc branch if not summary overflow
|
||||
- name: bns
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ BD ]
|
||||
condition: BO == 4 && BI & 0b11 == 0b11 && crfS == 0
|
||||
- name: bns
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
args: [ crfS, BD ]
|
||||
condition: BO == 4
|
||||
condition: BO == 4 && BI & 0b11 == 0b11
|
||||
|
||||
- name: bdnz
|
||||
opcode: bc
|
||||
modifiers: [ AA, LK ]
|
||||
|
|
Loading…
Reference in New Issue