s390x: Fix instruction encoding and disassembly format bugs (#5786)

- Fix encoding of the AHY instruction.
- Fix disassembly format of FIEBR, FIDBR, and LEDBRA instructions.
This commit is contained in:
Ulrich Weigand
2023-02-15 17:36:44 +01:00
committed by GitHub
parent e10094dcd6
commit 305000d14b
5 changed files with 37 additions and 32 deletions

View File

@@ -1568,7 +1568,7 @@ impl Inst {
let (opcode_rx, opcode_rxy) = match alu_op {
ALUOp::Add32 => (Some(0x5a), Some(0xe35a)), // A(Y)
ALUOp::Add32Ext16 => (Some(0x4a), Some(0xe34a)), // AH(Y)
ALUOp::Add32Ext16 => (Some(0x4a), Some(0xe37a)), // AH(Y)
ALUOp::Add64 => (None, Some(0xe308)), // AG
ALUOp::Add64Ext16 => (None, Some(0xe338)), // AGH
ALUOp::Add64Ext32 => (None, Some(0xe318)), // AGF

View File

@@ -587,7 +587,7 @@ fn test_s390x_binemit() {
flags: MemFlags::trusted(),
},
},
"E3102000004A",
"E3102000007A",
"ahy %r1, 0(%r2)",
));
insns.push((
@@ -7999,7 +7999,7 @@ fn test_s390x_binemit() {
rn: vr(12),
},
"B344008C",
"ledbra %f8, %f12, 0",
"ledbra %f8, 0, %f12, 0",
));
insns.push((
Inst::FpuRound {
@@ -8029,7 +8029,7 @@ fn test_s390x_binemit() {
rn: vr(12),
},
"B357708C",
"fiebr %f8, %f12, 7",
"fiebr %f8, 7, %f12",
));
insns.push((
Inst::FpuRound {
@@ -8039,7 +8039,7 @@ fn test_s390x_binemit() {
rn: vr(12),
},
"B35F708C",
"fidbr %f8, %f12, 7",
"fidbr %f8, 7, %f12",
));
insns.push((
Inst::FpuRound {
@@ -8049,7 +8049,7 @@ fn test_s390x_binemit() {
rn: vr(12),
},
"B357608C",
"fiebr %f8, %f12, 6",
"fiebr %f8, 6, %f12",
));
insns.push((
Inst::FpuRound {
@@ -8059,7 +8059,7 @@ fn test_s390x_binemit() {
rn: vr(12),
},
"B35F608C",
"fidbr %f8, %f12, 6",
"fidbr %f8, 6, %f12",
));
insns.push((
Inst::FpuRound {
@@ -8069,7 +8069,7 @@ fn test_s390x_binemit() {
rn: vr(12),
},
"B357508C",
"fiebr %f8, %f12, 5",
"fiebr %f8, 5, %f12",
));
insns.push((
Inst::FpuRound {
@@ -8079,7 +8079,7 @@ fn test_s390x_binemit() {
rn: vr(12),
},
"B35F508C",
"fidbr %f8, %f12, 5",
"fidbr %f8, 5, %f12",
));
insns.push((
Inst::FpuRound {
@@ -8089,7 +8089,7 @@ fn test_s390x_binemit() {
rn: vr(12),
},
"B357408C",
"fiebr %f8, %f12, 4",
"fiebr %f8, 4, %f12",
));
insns.push((
Inst::FpuRound {
@@ -8099,7 +8099,7 @@ fn test_s390x_binemit() {
rn: vr(12),
},
"B35F408C",
"fidbr %f8, %f12, 4",
"fidbr %f8, 4, %f12",
));
insns.push((
Inst::FpuRound {

View File

@@ -2359,11 +2359,16 @@ impl Inst {
let (rn, rn_fpr) = pretty_print_fpr(rn, allocs);
if opcode_fpr.is_some() && rd_fpr.is_some() && rn_fpr.is_some() {
format!(
"{} {}, {}, {}",
"{} {}, {}, {}{}",
opcode_fpr.unwrap(),
rd_fpr.unwrap(),
mode,
rn_fpr.unwrap(),
mode
if opcode_fpr.unwrap().ends_with('a') {
", 0"
} else {
""
}
)
} else if opcode.starts_with('w') {
format!(