Browse Source

Merge pull request #1999 from bnjbvr/fix-aarch64-ishl-by-zero

machinst aarch64: fix encoding generation of left-shift by 0
pull/1992/head
Chris Fallin 4 years ago
committed by GitHub
parent
commit
4b6ebc0c27
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      cranelift/codegen/src/isa/aarch64/inst/emit.rs
  2. 20
      cranelift/codegen/src/isa/aarch64/inst/emit_tests.rs

12
cranelift/codegen/src/isa/aarch64/inst/emit.rs

@ -534,8 +534,16 @@ impl MachInstEmit for Inst {
ALUOp::Lsr64 => (0b1101001101, u32::from(amt), 0b111111),
ALUOp::Asr32 => (0b0001001100, u32::from(amt), 0b011111),
ALUOp::Asr64 => (0b1001001101, u32::from(amt), 0b111111),
ALUOp::Lsl32 => (0b0101001100, u32::from(32 - amt), u32::from(31 - amt)),
ALUOp::Lsl64 => (0b1101001101, u32::from(64 - amt), u32::from(63 - amt)),
ALUOp::Lsl32 => (
0b0101001100,
u32::from((32 - amt) % 32),
u32::from(31 - amt),
),
ALUOp::Lsl64 => (
0b1101001101,
u32::from((64 - amt) % 64),
u32::from(63 - amt),
),
_ => unimplemented!("{:?}", alu_op),
};
sink.put4(

20
cranelift/codegen/src/isa/aarch64/inst/emit_tests.rs

@ -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 {

Loading…
Cancel
Save