machinst aarch64: fix encoding generation of left-shift by 0;

The ARM book says that the immr field should contain (-count % 64); the
existing code was approximating this with (64 - count), which is not
correct for a zero count.
This commit is contained in:
Benjamin Bouvier
2020-07-09 15:43:42 +02:00
parent 2a4f72aeb7
commit f316bef763
2 changed files with 30 additions and 2 deletions

View File

@@ -934,6 +934,26 @@ fn test_aarch64_binemit() {
"280141D3",
"lsl x8, x9, #63",
));
insns.push((
Inst::AluRRImmShift {
alu_op: ALUOp::Lsl32,
rd: writable_xreg(10),
rn: xreg(11),
immshift: ImmShift::maybe_from_u64(0).unwrap(),
},
"6A7D0053",
"lsl w10, w11, #0",
));
insns.push((
Inst::AluRRImmShift {
alu_op: ALUOp::Lsl64,
rd: writable_xreg(10),
rn: xreg(11),
immshift: ImmShift::maybe_from_u64(0).unwrap(),
},
"6AFD40D3",
"lsl x10, x11, #0",
));
insns.push((
Inst::AluRRImmLogic {