aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/armv8/a64.rs10
-rw-r--r--tests/armv8/a64.rs5
2 files changed, 11 insertions, 4 deletions
diff --git a/src/armv8/a64.rs b/src/armv8/a64.rs
index cdee6d5..de7a743 100644
--- a/src/armv8/a64.rs
+++ b/src/armv8/a64.rs
@@ -9105,8 +9105,10 @@ impl Decoder<ARMv8> for InstDecoder {
// V==0
let w = (word >> 11) & 1;
let imm9 = ((word >> 12) & 0b1_1111_1111) as i16;
- let imm9 = ((imm9 << 7) >> 7) as i32;
- let imm9 = imm9 << 3; // `simm` is stored as a multiple of 8
+ let S = ((word >> 22) & 1) as i16;
+ let imm10 = imm9 | (S << 9);
+ let imm10 = imm10 << 3; // `simm` is stored as a multiple of 8
+ let imm10 = ((imm10 << 3) >> 3) as i32;
let m = (word >> 23) & 1;
let size = (word >> 30) & 0b11;
if size != 0b11 {
@@ -9122,9 +9124,9 @@ impl Decoder<ARMv8> for InstDecoder {
inst.operands = [
Operand::Register(SizeCode::X, Rt),
if w == 0 {
- Operand::RegPreIndex(Rn, imm9, false)
+ Operand::RegPreIndex(Rn, imm10, false)
} else {
- Operand::RegPreIndex(Rn, imm9, true)
+ Operand::RegPreIndex(Rn, imm10, true)
},
Operand::Nothing,
Operand::Nothing,
diff --git a/tests/armv8/a64.rs b/tests/armv8/a64.rs
index 7f6fd04..1d04a76 100644
--- a/tests/armv8/a64.rs
+++ b/tests/armv8/a64.rs
@@ -4756,6 +4756,11 @@ fn test_vec_shift() {
fn test_pac() {
const TESTS: &[([u8; 4], &'static str)] = &[
([0x00, 0x04, 0xc1, 0xda], "pacib x0, x0"),
+ ([0x00, 0x04, 0xa8, 0xf8], "ldrab x0, [x0, #0x400]"),
+ ([0x00, 0x04, 0xb0, 0xf8], "ldrab x0, [x0, #0x800]"),
+ ([0x00, 0x04, 0xf0, 0xf8], "ldrab x0, [x0, #-0x800]"),
+ ([0x00, 0x14, 0x20, 0xf8], "ldraa x0, [x0, #0x8]"),
+ ([0x00, 0x04, 0xa4, 0xf8], "ldrab x0, [x0, #0x200]"),
];
let errs = run_tests(TESTS);