isa: `b` and `bc` change modifiers order
Previously they were `modifiers: [ AA, LK ]` and this caused problems, because the modifiers add a char to the instruction mnemonics, but this char is position dependant.
This commit is contained in:
parent
f4389e5edd
commit
65b0966a97
|
@ -4204,22 +4204,22 @@ impl Ins {
|
||||||
Opcode::Andis_ => String::new(),
|
Opcode::Andis_ => String::new(),
|
||||||
Opcode::B => {
|
Opcode::B => {
|
||||||
let mut s = String::with_capacity(4);
|
let mut s = String::with_capacity(4);
|
||||||
if self.bit(30usize) {
|
|
||||||
s.push('a');
|
|
||||||
}
|
|
||||||
if self.bit(31usize) {
|
if self.bit(31usize) {
|
||||||
s.push('l');
|
s.push('l');
|
||||||
}
|
}
|
||||||
|
if self.bit(30usize) {
|
||||||
|
s.push('a');
|
||||||
|
}
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
Opcode::Bc => {
|
Opcode::Bc => {
|
||||||
let mut s = String::with_capacity(4);
|
let mut s = String::with_capacity(4);
|
||||||
if self.bit(30usize) {
|
|
||||||
s.push('a');
|
|
||||||
}
|
|
||||||
if self.bit(31usize) {
|
if self.bit(31usize) {
|
||||||
s.push('l');
|
s.push('l');
|
||||||
}
|
}
|
||||||
|
if self.bit(30usize) {
|
||||||
|
s.push('a');
|
||||||
|
}
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
Opcode::Bcctr => {
|
Opcode::Bcctr => {
|
||||||
|
|
|
@ -94,6 +94,7 @@ fn test_ins_b() {
|
||||||
assert_asm!(0x4823B4D9, "bl 0x23b4d8");
|
assert_asm!(0x4823B4D9, "bl 0x23b4d8");
|
||||||
assert_asm!(0x4BE03C99, "bl -0x1fc368");
|
assert_asm!(0x4BE03C99, "bl -0x1fc368");
|
||||||
assert_asm!(0x4BDC1A59, "bl -0x23e5a8");
|
assert_asm!(0x4BDC1A59, "bl -0x23e5a8");
|
||||||
|
assert_asm!(0x48000063, "bla 0x60");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
42
isa.yaml
42
isa.yaml
|
@ -287,14 +287,14 @@ opcodes:
|
||||||
desc: Branch
|
desc: Branch
|
||||||
bitmask: 0xfc000000
|
bitmask: 0xfc000000
|
||||||
pattern: 0x48000000
|
pattern: 0x48000000
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ LI ]
|
args: [ LI ]
|
||||||
|
|
||||||
- name: bc
|
- name: bc
|
||||||
desc: Branch Conditional
|
desc: Branch Conditional
|
||||||
bitmask: 0xfc000000
|
bitmask: 0xfc000000
|
||||||
pattern: 0x40000000
|
pattern: 0x40000000
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BO, BI, BD ]
|
args: [ BO, BI, BD ]
|
||||||
|
|
||||||
- name: bcctr
|
- name: bcctr
|
||||||
|
@ -2164,105 +2164,105 @@ mnemonics:
|
||||||
# bc branch always
|
# bc branch always
|
||||||
- name: b
|
- name: b
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
condition: BO == 20 && BI == 0
|
condition: BO == 20 && BI == 0
|
||||||
# bc branch if negative
|
# bc branch if negative
|
||||||
- name: blt
|
- name: blt
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 12 && BI & 0b11 == 0b00 && crfS == 0
|
condition: BO == 12 && BI & 0b11 == 0b00 && crfS == 0
|
||||||
- name: blt
|
- name: blt
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ crfS, BD ]
|
args: [ crfS, BD ]
|
||||||
condition: BO == 12 && BI & 0b11 == 0b00
|
condition: BO == 12 && BI & 0b11 == 0b00
|
||||||
# bc branch if not positive
|
# bc branch if not positive
|
||||||
- name: ble
|
- name: ble
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 4 && BI & 0b11 == 0b01 && crfS == 0
|
condition: BO == 4 && BI & 0b11 == 0b01 && crfS == 0
|
||||||
- name: ble
|
- name: ble
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ crfS, BD ]
|
args: [ crfS, BD ]
|
||||||
condition: BO == 4 && BI & 0b11 == 0b01
|
condition: BO == 4 && BI & 0b11 == 0b01
|
||||||
# bc branch if zero
|
# bc branch if zero
|
||||||
- name: beq
|
- name: beq
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 12 && BI & 0b11 == 0b10 && crfS == 0
|
condition: BO == 12 && BI & 0b11 == 0b10 && crfS == 0
|
||||||
- name: beq
|
- name: beq
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ crfS, BD ]
|
args: [ crfS, BD ]
|
||||||
condition: BO == 12 && BI & 0b11 == 0b10
|
condition: BO == 12 && BI & 0b11 == 0b10
|
||||||
# bc branch if not negative
|
# bc branch if not negative
|
||||||
- name: bge
|
- name: bge
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 4 && BI & 0b11 == 0b00 && crfS == 0
|
condition: BO == 4 && BI & 0b11 == 0b00 && crfS == 0
|
||||||
- name: bge
|
- name: bge
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ crfS, BD ]
|
args: [ crfS, BD ]
|
||||||
condition: BO == 4 && BI & 0b11 == 0b00
|
condition: BO == 4 && BI & 0b11 == 0b00
|
||||||
# bc branch if positive
|
# bc branch if positive
|
||||||
- name: bgt
|
- name: bgt
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 12 && BI & 0b11 == 0b01 && crfS == 0
|
condition: BO == 12 && BI & 0b11 == 0b01 && crfS == 0
|
||||||
- name: bgt
|
- name: bgt
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ crfS, BD ]
|
args: [ crfS, BD ]
|
||||||
condition: BO == 12 && BI & 0b11 == 0b01
|
condition: BO == 12 && BI & 0b11 == 0b01
|
||||||
# bc branch if not zero
|
# bc branch if not zero
|
||||||
- name: bne
|
- name: bne
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 4 && BI & 0b11 == 0b10 && crfS == 0
|
condition: BO == 4 && BI & 0b11 == 0b10 && crfS == 0
|
||||||
- name: bne
|
- name: bne
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ crfS, BD ]
|
args: [ crfS, BD ]
|
||||||
condition: BO == 4 && BI & 0b11 == 0b10
|
condition: BO == 4 && BI & 0b11 == 0b10
|
||||||
# bc branch if summary overflow
|
# bc branch if summary overflow
|
||||||
- name: bso
|
- name: bso
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 12 && BI & 0b11 == 0b11 && crfS == 0
|
condition: BO == 12 && BI & 0b11 == 0b11 && crfS == 0
|
||||||
- name: bso
|
- name: bso
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ crfS, BD ]
|
args: [ crfS, BD ]
|
||||||
condition: BO == 12 && BI & 0b11 == 0b11
|
condition: BO == 12 && BI & 0b11 == 0b11
|
||||||
# bc branch if not summary overflow
|
# bc branch if not summary overflow
|
||||||
- name: bns
|
- name: bns
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 4 && BI & 0b11 == 0b11 && crfS == 0
|
condition: BO == 4 && BI & 0b11 == 0b11 && crfS == 0
|
||||||
- name: bns
|
- name: bns
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ crfS, BD ]
|
args: [ crfS, BD ]
|
||||||
condition: BO == 4 && BI & 0b11 == 0b11
|
condition: BO == 4 && BI & 0b11 == 0b11
|
||||||
|
|
||||||
- name: bdnz
|
- name: bdnz
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 16 && BI == 0
|
condition: BO == 16 && BI == 0
|
||||||
- name: bdz
|
- name: bdz
|
||||||
opcode: bc
|
opcode: bc
|
||||||
modifiers: [ AA, LK ]
|
modifiers: [ LK, AA ]
|
||||||
args: [ BD ]
|
args: [ BD ]
|
||||||
condition: BO == 18 && BI == 0
|
condition: BO == 18 && BI == 0
|
||||||
# TODO support conditional bd...
|
# TODO support conditional bd...
|
||||||
|
|
Loading…
Reference in New Issue