Skip to content

Commit

Permalink
YJIT: Respect destination num_bits on STUR (#6848)
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Dec 2, 2022
1 parent 8ffa8fc commit dcbea76
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions yjit/src/asm/arm64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ pub fn stur(cb: &mut CodeBlock, rt: A64Opnd, rn: A64Opnd) {
assert!(rn.num_bits == 32 || rn.num_bits == 64);
assert!(mem_disp_fits_bits(rn.disp), "Expected displacement to be 9 bits or less");

LoadStore::stur(rt.reg_no, rn.base_reg_no, rn.disp as i16, rt.num_bits).into()
LoadStore::stur(rt.reg_no, rn.base_reg_no, rn.disp as i16, rn.num_bits).into()
},
_ => panic!("Invalid operand combination to stur instruction.")
};
Expand Down Expand Up @@ -1499,10 +1499,15 @@ mod tests {
}

#[test]
fn test_stur() {
fn test_stur_64_bits() {
check_bytes("6a0108f8", |cb| stur(cb, X10, A64Opnd::new_mem(64, X11, 128)));
}

#[test]
fn test_stur_32_bits() {
check_bytes("6a0108b8", |cb| stur(cb, X10, A64Opnd::new_mem(32, X11, 128)));
}

#[test]
fn test_sub_reg() {
check_bytes("200002cb", |cb| sub(cb, X0, X1, X2));
Expand Down

0 comments on commit dcbea76

Please sign in to comment.