From 0bcea6031e3d0b48acb15f6a7dfdab670ec8fcfc Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 2 Jan 2022 13:27:48 -0800 Subject: get test situation in order --- test/armv7.rs | 811 --------- test/armv7/thumb.rs | 4084 ------------------------------------------ test/armv8/a64.rs | 4879 --------------------------------------------------- test/armv8/mod.rs | 1 - test/test.rs | 52 - 5 files changed, 9827 deletions(-) delete mode 100644 test/armv7.rs delete mode 100644 test/armv7/thumb.rs delete mode 100644 test/armv8/a64.rs delete mode 100644 test/armv8/mod.rs delete mode 100644 test/test.rs (limited to 'test') diff --git a/test/armv7.rs b/test/armv7.rs deleted file mode 100644 index a60b50a..0000000 --- a/test/armv7.rs +++ /dev/null @@ -1,811 +0,0 @@ -use yaxpeax_arch::{Arch, Decoder, LengthedInstruction}; -use yaxpeax_arm::armv7::{ARMv7, Instruction, ConditionCode, DecodeError, Operand, Opcode, Reg, RegShift}; - -mod thumb; - -type InstDecoder = ::Decoder; - -fn test_invalid_under(decoder: &InstDecoder, data: [u8; 4]) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - match decoder.decode(&mut reader) { - Err(_) => { }, - Ok(inst) => { - panic!( - "unexpected successful decode for {:02x}{:02x}{:02x}{:02x}\ngot: {}", - data[0], data[1], data[2], data[3], - inst - ); - } - } -} - -fn test_display_under(decoder: &InstDecoder, data: [u8; 4], expected: &'static str) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - let instr = match decoder.decode(&mut reader) { - Err(e) => { - panic!("failed to decode {:02x}{:02x}{:02x}{:02x}: {}", data[0], data[1], data[2], data[3], e) - }, - Ok(instr) => instr, - }; - let displayed = format!("{}", instr); - assert!( - displayed == expected, - "decode error for {:02x}{:02x}{:02x}{:02x}:\n displayed: {}\n expected: {}\n", - data[0], data[1], data[2], data[3], - displayed, expected - ); -} - -fn test_decode(data: [u8; 4], expected: Instruction) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - let instr = InstDecoder::default().decode(&mut reader).unwrap(); - assert!( - instr == expected, - "decode error for {:02x}{:02x}{:02x}{:02x}:\n decoded: {:?}\n expected: {:?}\n", - data[0], data[1], data[2], data[3], - instr, expected - ); -} - -fn test_invalid(data: [u8; 4]) { - test_invalid_under(&InstDecoder::default(), data); -} - -fn test_all(data: [u8; 4], expected: &'static str) { - test_display_under(&InstDecoder::armv4(), data, expected); - test_display_under(&InstDecoder::armv5(), data, expected); - test_display_under(&InstDecoder::armv6(), data, expected); - test_display_under(&InstDecoder::armv7(), data, expected); -} -fn test_armv5(data: [u8; 4], expected: &'static str) { - test_display_under(&InstDecoder::armv5(), data, expected); -// test_invalid_under(&InstDecoder::armv4(), data); -} -fn test_armv6(data: [u8; 4], expected: &'static str) { - test_display_under(&InstDecoder::armv6(), data, expected); -// test_invalid_under(&InstDecoder::armv5(), data); -} -fn test_armv6t2(data: [u8; 4], expected: &'static str) { - test_display_under(&InstDecoder::armv6t2(), data, expected); -// test_invalid_under(&InstDecoder::armv6(), data); -} -#[allow(dead_code)] -fn test_armv7(data: [u8; 4], expected: &'static str) { - test_display_under(&InstDecoder::armv7(), data, expected); -// test_invalid_under(&InstDecoder::armv6(), data); -} -fn test_armv7ve(data: [u8; 4], expected: &'static str) { - test_display_under(&InstDecoder::armv7ve(), data, expected); -// test_invalid_under(&InstDecoder::armv7(), data, expected); -} -fn test_arm_security_extensions(data: [u8; 4], expected: &'static str) { - test_display_under(&InstDecoder::armv7vese(), data, expected); -// test_invalid_under(&InstDecoder::armv7ve(), data, expected); -} - -fn test_nonconformant(data: [u8; 4]) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - let result = InstDecoder::default().decode(&mut reader); - assert!( - result == Err(DecodeError::Nonconforming), - "got bad result: {:?} from {:#x?}", result, data - ); -} - -fn test_display(data: [u8; 4], expected: &'static str) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - let instr = InstDecoder::default().decode(&mut reader).unwrap(); - let text = format!("{}", instr); - assert!( - text == expected, - "display error for {:02x}{:02x}{:02x}{:02x}:\n decoded: {:?}\n displayed: {}\n expected: {}\n", - data[0], data[1], data[2], data[3], - instr, - text, expected - ); -} - -#[test] -fn test_unpredictable_instructions() { - test_invalid([0x00, 0x02, 0x08, 0x01]); // msr with invalid machine register -} - -#[test] -fn test_decode_str_ldr() { - test_decode( - [0x24, 0xc0, 0x9f, 0xe5], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::LDR, - operands: [ - Operand::Reg(Reg::from_u8(12)), - Operand::RegDerefPreindexOffset(Reg::from_u8(15), 0x24, true, false), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x10, 0x00, 0x9f, 0xe5], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::LDR, - operands: [ - Operand::Reg(Reg::from_u8(0)), - Operand::RegDerefPreindexOffset(Reg::from_u8(15), 0x10, true, false), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x04, 0x20, 0x2d, 0xe5], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::STR, - operands: [ - Operand::Reg(Reg::from_u8(2)), - Operand::RegDerefPreindexOffset(Reg::from_u8(13), 4, false, true), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x04, 0x00, 0x2d, 0xe5], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::STR, - operands: [ - Operand::Reg(Reg::from_u8(0)), - Operand::RegDerefPreindexOffset(Reg::from_u8(13), 4, false, true), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x14, 0x30, 0x9f, 0xe5], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::LDR, - operands: [ - Operand::Reg(Reg::from_u8(3)), - Operand::RegDerefPreindexOffset(Reg::from_u8(15), 0x14, true, false), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x14, 0x20, 0x9f, 0xe5], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::LDR, - operands: [ - Operand::Reg(Reg::from_u8(2)), - Operand::RegDerefPreindexOffset(Reg::from_u8(15), 0x14, true, false), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_all([0x10, 0x00, 0x7f, 0xe5], "ldrb r0, [pc, -0x10]!"); - test_all([0x10, 0x00, 0x3f, 0xe5], "ldr r0, [pc, -0x10]!"); - test_all([0x10, 0x00, 0x7f, 0xe4], "ldrbt r0, [pc], -0x10"); - test_all([0x10, 0x00, 0x3f, 0xe4], "ldrt r0, [pc], -0x10"); - test_all([0x10, 0x00, 0x4f, 0xe4], "strb r0, [pc], -0x10"); - // Extra load/store instructions A5.2.8, page A5-201 - test_all([0xbb, 0x38, 0xa5, 0xe1], "strh r3, [r5, fp]!"); - test_all([0xbb, 0x38, 0xb5, 0xe1], "ldrh r3, [r5, fp]!"); - test_all([0xbb, 0x38, 0xe5, 0xe1], "strh r3, [r5, 0x8b]!"); - test_all([0xbb, 0x38, 0xf5, 0xe1], "ldrh r3, [r5, 0x8b]!"); - test_armv5([0xdb, 0x48, 0xa6, 0xe1], "ldrd r4, r5, [r6, fp]!"); - test_invalid([0xdb, 0x38, 0xa5, 0xe1]); - test_all([0xdb, 0x38, 0xb5, 0xe1], "ldrsb r3, [r5, fp]!"); - test_armv5([0xdb, 0x48, 0xe6, 0xe1], "ldrd r4, r5, [r6, 0x8b]!"); - test_invalid([0xdb, 0x38, 0xe5, 0xe1]); - test_all([0xdb, 0x38, 0xf5, 0xe1], "ldrsb r3, [r5, 0x8b]!"); - test_invalid([0xfb, 0x38, 0xa5, 0xe1]); - test_all([0xfb, 0x48, 0xa6, 0xe1], "strd r4, r5, [r6, fp]!"); - test_all([0xfb, 0x38, 0xb5, 0xe1], "ldrsh r3, [r5, fp]!"); - test_invalid([0xfb, 0x38, 0xe5, 0xe1]); - test_all([0xfb, 0x48, 0xe6, 0xe1], "strd r4, r5, [r6, 0x8b]!"); - test_all([0xfb, 0x38, 0xf5, 0xe1], "ldrsh r3, [r5, 0x8b]!"); - test_all([0xfb, 0x38, 0xff, 0xe1], "ldrsh r3, [pc, 0x8b]!"); - -} - -#[test] -fn test_synchronization() { - test_display( - [0x94, 0x8f, 0x8a, 0xe1], - "strex r8, r4, [r10]" - ); - test_display( - [0x9f, 0x8f, 0x9a, 0xe1], - "ldrex r8, [r10]" - ); - test_display( - [0x94, 0x2f, 0xa4, 0xe1], - "strexd r2, r4, r5, [r4]" - ); - test_display( - [0x9f, 0x2f, 0xb4, 0xe1], - "ldrexd r2, r3, [r4]" - ); - test_display( - [0x9f, 0x2f, 0xc4, 0xe1], - "strexb r2, pc, [r4]" - ); - test_display( - [0x9f, 0x2f, 0xd4, 0xe1], - "ldrexb r2, [r4]" - ); - test_display( - [0x9f, 0x2f, 0xe4, 0xe1], - "strexh r2, pc, [r4]" - ); - test_display( - [0x9f, 0x2f, 0xf4, 0xe1], - "ldrexh r2, [r4]" - ); -} - -#[test] -fn test_str() { - test_display( - [0xb5, 0x53, 0x68, 0xe0], - "strht r5, [r8], -0x35" - ); -} - -#[test] -fn test_data_imm() { - test_display( - [0x12, 0x34, 0xa0, 0xe3], - "mov r3, 0x12000000" - ); - test_display( - [0x12, 0x44, 0x9c, 0xe3], - "orrs r4, ip, 0x12000000" - ); -} - -#[test] -fn test_decode_misc() { - test_armv5([0x32, 0xff, 0x2f, 0xe1], "blx r2"); - test_display( - [0x13, 0x5f, 0x6f, 0xe1], - "clz r5, r3" - ); - test_display( - [0xc8, 0xac, 0x0b, 0xe1], - "smlabt fp, r8, ip, r10" - ); - test_display( - [0x32, 0xff, 0x2f, 0xe1], - "blx r2" - ); - test_display( - [0x02, 0x00, 0xa0, 0xe3], - "mov r0, 0x2" - ); - test_display( - [0xe8, 0x10, 0x9f, 0xe5], - "ldr r1, [pc, 0xe8]" - ); - // https://www.raspberrypi.org/forums/viewtopic.php?p=967759&sid=25fa58d95208c0c76b579012ca693380#p967759 - // it looks like gcc toolchains older than 6.1(?) don't support -march=armv7e - test_armv7ve([0x6e, 0x00, 0x60, 0xe1], "eret"); - test_armv5([0x76, 0x00, 0x23, 0xe1], "bkpt 0x3006"); - // ARMv7VE only, capstone (not-next) doesn't have this, no secondary confirmation yet - test_armv7ve([0x76, 0x00, 0x43, 0xe1], "hvc 0x3006"); - test_arm_security_extensions([0x76, 0x00, 0x63, 0xe1], "smc 0x3006"); - test_all([0x6e, 0xf0, 0x28, 0xe3], "msr apsr_nzcvq, 0x6e"); - test_all([0x6e, 0xf0, 0x24, 0xe3], "msr apsr_g, 0x6e"); - test_all([0x6e, 0xf0, 0x2c, 0xe3], "msr apsr_nzcvqg, 0x6e"); - - test_all([0x6e, 0xf0, 0x21, 0xe3], "msr cpsr_c, 0x6e"); - test_all([0x6e, 0xf0, 0x22, 0xe3], "msr cpsr_x, 0x6e"); - test_all([0x6e, 0xf0, 0x23, 0xe3], "msr cpsr_xc, 0x6e"); - test_all([0x6e, 0xf0, 0x25, 0xe3], "msr cpsr_sc, 0x6e"); - test_all([0x6e, 0xf0, 0x26, 0xe3], "msr cpsr_sx, 0x6e"); - test_all([0x6e, 0xf0, 0x27, 0xe3], "msr cpsr_sxc, 0x6e"); - test_all([0x6e, 0xf0, 0x29, 0xe3], "msr cpsr_fc, 0x6e"); - test_all([0x6e, 0xf0, 0x2a, 0xe3], "msr cpsr_fx, 0x6e"); - test_all([0x6e, 0xf0, 0x2b, 0xe3], "msr cpsr_fxc, 0x6e"); - test_all([0x6e, 0xf0, 0x2d, 0xe3], "msr cpsr_fsc, 0x6e"); - test_all([0x6e, 0xf0, 0x2e, 0xe3], "msr cpsr_fsx, 0x6e"); - test_all([0x6e, 0xf0, 0x2f, 0xe3], "msr cpsr_fsxc, 0x6e"); - test_all([0x6e, 0xf0, 0x60, 0xe3], "msr spsr, 0x6e"); - test_all([0x6e, 0xf0, 0x61, 0xe3], "msr spsr_c, 0x6e"); - test_all([0x6e, 0xf0, 0x62, 0xe3], "msr spsr_x, 0x6e"); - test_all([0x6e, 0xf0, 0x63, 0xe3], "msr spsr_xc, 0x6e"); - test_all([0x6e, 0xf0, 0x64, 0xe3], "msr spsr_s, 0x6e"); - test_all([0x6e, 0xf0, 0x65, 0xe3], "msr spsr_sc, 0x6e"); - test_all([0x6e, 0xf0, 0x66, 0xe3], "msr spsr_sx, 0x6e"); - test_all([0x6e, 0xf0, 0x67, 0xe3], "msr spsr_sxc, 0x6e"); - test_all([0x6e, 0xf0, 0x68, 0xe3], "msr spsr_f, 0x6e"); - test_all([0x6e, 0xf0, 0x69, 0xe3], "msr spsr_fc, 0x6e"); - test_all([0x6e, 0xf0, 0x6a, 0xe3], "msr spsr_fx, 0x6e"); - test_all([0x6e, 0xf0, 0x6b, 0xe3], "msr spsr_fxc, 0x6e"); - test_all([0x6e, 0xf0, 0x6c, 0xe3], "msr spsr_fs, 0x6e"); - test_all([0x6e, 0xf0, 0x6d, 0xe3], "msr spsr_fsc, 0x6e"); - test_all([0x6e, 0xf0, 0x6e, 0xe3], "msr spsr_fsx, 0x6e"); - test_all([0x6e, 0xf0, 0x6f, 0xe3], "msr spsr_fsxc, 0x6e"); - test_armv6t2([0x45, 0x67, 0x01, 0xe3], "mov r6, 0x1745"); - test_armv6t2([0x45, 0x67, 0x41, 0xe3], "movt r6, 0x1745"); -} - -#[test] -fn test_decode_pop() { - test_decode( - [0x04, 0x10, 0x9d, 0xe4], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::LDR, - operands: [ - Operand::Reg(Reg::from_u8(1)), - Operand::RegDerefPostindexOffset(Reg::from_u8(13), 0x4, true, false), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_display( - [0x04, 0x10, 0x9d, 0xe4], - "pop {r1}" - ); - test_decode( - [0xf0, 0x40, 0x2d, 0xe9], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::STM(false, true, false, false), - operands: [ - Operand::RegWBack(Reg::from_u8(13), true), - Operand::RegList(16624), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_display( - [0xf0, 0x40, 0x2d, 0xe9], - "push {r4, r5, r6, r7, lr}" - ); - test_decode( - [0xf0, 0x80, 0xbd, 0x18], - Instruction { - condition: ConditionCode::NE, - opcode: Opcode::LDM(true, false, false, false), - operands: [ - Operand::RegWBack(Reg::from_u8(13), true), - Operand::RegList(33008), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_display( - [0xf0, 0x80, 0xbd, 0x18], - "popne {r4, r5, r6, r7, pc}" - ); -} - -#[test] -fn test_decode_mov() { - test_decode( - [0x0d, 0x20, 0xa0, 0xe1], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::MOV, - operands: [ - Operand::Reg(Reg::from_u8(2)), - Operand::Reg(Reg::from_u8(13)), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_display([0x0d, 0x20, 0xa0, 0xe1], "mov r2, sp"); - test_nonconformant([0x0d, 0x20, 0xa1, 0xe1]); - test_decode( - [0x00, 0xb0, 0xa0, 0xe3], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::MOV, - operands: [ - Operand::Reg(Reg::from_u8(11)), - Operand::Imm32(0), - Operand::Nothing, - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); -} - -#[test] -fn test_decode_arithmetic() { - test_decode( - [0x18, 0x1d, 0x00, 0x00], - Instruction { - condition: ConditionCode::EQ, - opcode: Opcode::AND, - operands: [Operand::Reg(Reg::from_u8(1)), Operand::Reg(Reg::from_u8(0)), Operand::RegShift(RegShift::from_raw(0xd18)), Operand::Nothing], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_display( - [0x18, 0x1d, 0x00, 0x00], - "andeq r1, r0, r8, lsl sp", - ); - test_decode( - [0x03, 0x30, 0x8f, 0xe0], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::ADD, - operands: [Operand::Reg(Reg::from_u8(3)), Operand::Reg(Reg::from_u8(15)), Operand::Reg(Reg::from_u8(3)), Operand::Nothing], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x03, 0x30, 0x66, 0xe0], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::RSB, - operands: [Operand::Reg(Reg::from_u8(3)), Operand::Reg(Reg::from_u8(6)), Operand::Reg(Reg::from_u8(3)), Operand::Nothing], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x43, 0x31, 0xa0, 0xe1], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::MOV, - operands: [Operand::Reg(Reg::from_u8(3)), Operand::Reg(Reg::from_u8(0)), Operand::RegShift(RegShift::from_raw(0x143)), Operand::Nothing], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x01, 0x50, 0x43, 0xe2], - Instruction { - condition: ConditionCode::AL, - opcode: Opcode::SUB, - operands: [Operand::Reg(Reg::from_u8(5)), Operand::Reg(Reg::from_u8(3)), Operand::Imm32(1), Operand::Nothing], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); -} - -#[test] -fn test_unconditional() { - test_armv6([0x00, 0x0a, 0x15, 0xf8], "rfeda r5"); - test_nonconformant([0x10, 0x0a, 0x15, 0xf8]); - test_armv6([0x00, 0x0a, 0x1f, 0xf8], "rfeda pc"); - test_armv6([0x00, 0x0a, 0xb5, 0xf8], "rfeia r5!"); - test_armv6([0x00, 0x0a, 0xb5, 0xf9], "rfeib r5!"); - test_armv6([0x0f, 0x05, 0x4d, 0xf8], "srsda sp, 0xf"); - test_nonconformant([0xff, 0x05, 0xed, 0xf8]); - test_armv6([0x0f, 0x05, 0x4d, 0xf8], "srsda sp, 0xf"); - test_armv6([0x0f, 0x05, 0xed, 0xf9], "srsib sp!, 0xf"); - test_armv6([0x0f, 0x05, 0xed, 0xf8], "srsia sp!, 0xf"); - test_armv5([0x01, 0x02, 0x03, 0xfb], "blx $+0xc0806"); - test_armv5([0x01, 0x02, 0x03, 0xfa], "blx $+0xc0804"); - test_armv5([0x12, 0x34, 0xcf, 0xfc], "stc2l p4, c3, [pc], {0x12}"); - test_armv5([0x12, 0x34, 0xdf, 0xfc], "ldc2l p4, c3, [pc], {0x12}"); - test_armv5([0x34, 0x78, 0xff, 0xfc], "ldc2l p8, c7, [pc], 0xd0"); - test_invalid([0x34, 0x78, 0x1f, 0xfc]); - test_armv5([0x34, 0x78, 0x9f, 0xfc], "ldc2 p8, c7, [pc], {0x34}"); - test_armv5([0x34, 0x78, 0xbf, 0xfc], "ldc2 p8, c7, [pc], 0xd0"); - test_armv5([0x34, 0x78, 0xbf, 0xfd], "ldc2 p8, c7, [pc, 0xd0]!"); - test_armv5([0x34, 0x78, 0x9f, 0xfd], "ldc2 p8, c7, [pc, 0xd0]"); - test_armv5([0x34, 0x78, 0x1f, 0xfd], "ldc2 p8, c7, [pc, -0xd0]"); - test_armv5([0x34, 0x78, 0xdf, 0xfc], "ldc2l p8, c7, [pc], {0x34}"); - test_armv6([0x34, 0x78, 0x5a, 0xfc], "mrrc2 p8, 3, r7, r10, c4"); - // Rt/Rt2 may not be r15 - test_invalid([0x34, 0x78, 0x5f, 0xfc]); - test_armv6([0x34, 0x78, 0x4a, 0xfc], "mcrr2 p8, 3, r7, r10, c4"); - // Rt/Rt2 may not be r15 - test_invalid([0x34, 0x78, 0x4f, 0xfc]); - test_armv5([0x34, 0x78, 0x4f, 0xfe], "mcr2 p8, 2, r7, c15, c4, 1"); - test_armv5([0x34, 0x78, 0x5f, 0xfe], "mrc2 p8, 2, r7, c15, c4, 1"); - test_armv5([0x24, 0x78, 0x5f, 0xfe], "cdp2 p8, 5, c7, c15, c4, 1"); - test_armv5([0x24, 0x78, 0x4f, 0xfe], "cdp2 p8, 4, c7, c15, c4, 1"); -} - -#[test] -fn test_saturating_addsub() { - test_armv5([0x50, 0x10, 0x64, 0xe1], "qdsub r1, r0, r4"); - test_nonconformant([0x50, 0x14, 0x64, 0xe1]); - test_armv5([0x50, 0x10, 0x44, 0xe1], "qdadd r1, r0, r4"); - test_nonconformant([0x50, 0x14, 0x44, 0xe1]); - test_armv5([0x50, 0x10, 0x24, 0xe1], "qsub r1, r0, r4"); - test_nonconformant([0x50, 0x14, 0x24, 0xe1]); - test_armv5([0x50, 0x10, 0x04, 0xe1], "qadd r1, r0, r4"); - test_nonconformant([0x50, 0x14, 0x04, 0xe1]); -} - -#[test] -fn test_decode_mul() { - test_decode( - [0x9c, 0x7d, 0x0b, 0x00], - Instruction { - condition: ConditionCode::EQ, - opcode: Opcode::MUL, - operands: [ - Operand::Reg(Reg::from_u8(11)), - Operand::Reg(Reg::from_u8(12)), - Operand::Reg(Reg::from_u8(13)), - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x90, 0x79, 0x09, 0x00], - Instruction { - condition: ConditionCode::EQ, - opcode: Opcode::MUL, - operands: [ - Operand::Reg(Reg::from_u8(9)), - Operand::Reg(Reg::from_u8(0)), - Operand::Reg(Reg::from_u8(9)), - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); - test_decode( - [0x94, 0x79, 0x09, 0x00], - Instruction { - condition: ConditionCode::EQ, - opcode: Opcode::MUL, - operands: [ - Operand::Reg(Reg::from_u8(9)), - Operand::Reg(Reg::from_u8(4)), - Operand::Reg(Reg::from_u8(9)), - Operand::Nothing, - ], - s: false, - thumb_w: false, - thumb: false, - wide: false, - } - ); -} - -static INSTRUCTION_BYTES: [u8; 4 * 60] = [ - 0x24, 0xc0, 0x9f, 0xe5, - 0x00, 0xb0, 0xa0, 0xe3, - 0x04, 0x10, 0x9d, 0xe4, - 0x0d, 0x20, 0xa0, 0xe1, - 0x04, 0x20, 0x2d, 0xe5, - 0x04, 0x00, 0x2d, 0xe5, - 0x10, 0x00, 0x9f, 0xe5, - 0x10, 0x30, 0x9f, 0xe5, - 0x04, 0xc0, 0x2d, 0xe5, - 0x4b, 0xfe, 0xff, 0xeb, - 0xd5, 0xfd, 0xff, 0xeb, - 0x90, 0x79, 0x09, 0x00, - 0x64, 0xd0, 0x01, 0x00, - 0x94, 0x79, 0x09, 0x00, - 0x14, 0x30, 0x9f, 0xe5, - 0x14, 0x20, 0x9f, 0xe5, - 0x03, 0x30, 0x8f, 0xe0, - 0x02, 0x10, 0x93, 0xe7, - 0x00, 0x00, 0x51, 0xe3, - 0x0e, 0xf0, 0xa0, 0x01, - 0x01, 0xfe, 0xff, 0xea, - 0x58, 0x75, 0x09, 0x00, - 0xec, 0x02, 0x00, 0x00, - 0xf0, 0x40, 0x2d, 0xe9, - 0x54, 0x70, 0x9f, 0xe5, - 0x00, 0x30, 0xd7, 0xe5, - 0x00, 0x00, 0x53, 0xe3, - 0xf0, 0x80, 0xbd, 0x18, - 0x48, 0x60, 0x9f, 0xe5, - 0x48, 0x30, 0x9f, 0xe5, - 0x48, 0x40, 0x9f, 0xe5, - 0x03, 0x30, 0x66, 0xe0, - 0x43, 0x31, 0xa0, 0xe1, - 0x00, 0x20, 0x94, 0xe5, - 0x01, 0x50, 0x43, 0xe2, - 0x05, 0x00, 0x52, 0xe1, - 0x06, 0x00, 0x00, 0x2a, - 0x01, 0x30, 0x82, 0xe2, - 0x00, 0x30, 0x84, 0xe5, - 0x0f, 0xe0, 0xa0, 0xe1, - 0x03, 0xf1, 0x96, 0xe7, - 0x00, 0x20, 0x94, 0xe5, - 0x05, 0x00, 0x52, 0xe1, - 0xf8, 0xff, 0xff, 0x3a, - 0x01, 0x30, 0xa0, 0xe3, - 0x00, 0x30, 0xc7, 0xe5, - 0xf0, 0x80, 0xbd, 0xe8, - 0x9c, 0x7d, 0x0b, 0x00, - 0xa0, 0x33, 0x0b, 0x00, - 0xa4, 0x33, 0x0b, 0x00, - 0xa0, 0x7d, 0x0b, 0x00, - 0x04, 0xe0, 0x2d, 0xe5, - 0x04, 0xf0, 0x9d, 0xe4, - 0x24, 0x00, 0x9f, 0xe5, - 0x00, 0x30, 0x90, 0xe5, - 0x00, 0x00, 0x53, 0xe3, - 0x04, 0xe0, 0x2d, 0xe5, - 0x04, 0xf0, 0x9d, 0x04, - 0x14, 0x30, 0x9f, 0xe5, - 0x00, 0x00, 0x53, 0xe3 - ]; - - -#[test] -fn test_decode_span() { - let mut i = 0u32; - while i < INSTRUCTION_BYTES.len() as u32 { - let mut reader = yaxpeax_arch::U8Reader::new(&INSTRUCTION_BYTES[(i as usize)..]); - let instr = InstDecoder::default().decode(&mut reader).unwrap(); - println!( - "Decoded {:02x}{:02x}{:02x}{:02x}: {}", //{:?}\n {}", - INSTRUCTION_BYTES[i as usize], - INSTRUCTION_BYTES[i as usize + 1], - INSTRUCTION_BYTES[i as usize + 2], - INSTRUCTION_BYTES[i as usize + 3], -// instr, - instr); - i += instr.len(); - } -// panic!("done"); -} -/* - * from debian 5.0.10 bash 3.2-4_arm - * 0x0001bee4 24c09fe5 ldr ip, sym.__libc_csu_fini - * 0x0001bee8 00b0a0e3 mov fp, 0 - * 0x0001beec 04109de4 pop {r1} - * 0x0001bef0 0d20a0e1 mov r2, sp - * 0x0001bef4 04202de5 str r2, [sp, -4]! - * 0x0001bef8 04002de5 str r0, [sp, -4]! - * 0x0001befc 10009fe5 ldr r0, sym.main - * 0x0001bf00 10309fe5 ldr r3, sym.__libc_csu_init - * 0x0001bf04 04c02de5 str ip, [sp, -4]! - * 0x0001bf08 4bfeffeb bl sym.imp.__libc_start_main - * 0x0001bf0c d5fdffeb bl sym.imp.abort - * 0x0001bf10 90790900 muleq sb, r0, sb - * 0x0001bf14 64d00100 andeq sp, r1, r4, rrx - * 0x0001bf18 94790900 muleq sb, r4, sb - * 0x0001bf1c 14309fe5 ldr r3, [0x0001bf38] - * 0x0001bf20 14209fe5 ldr r2, [0x0001bf3c] - * 0x0001bf24 03308fe0 add r3, pc, r3 - * 0x0001bf28 021093e7 ldr r1, [r3, r2] - * 0x0001bf2c 000051e3 cmp r1, 0 - * 0x0001bf30 0ef0a001 moveq pc, lr - * 0x0001bf34 01feffea b loc.imp.__gmon_start__ - * 0x0001bf38 58750900 andeq r7, sb, r8, asr r5 - * 0x0001bf3c ec020000 andeq r0, r0, ip, ror 5 - * 0x0001bf40 f0402de9 push {r4, r5, r6, r7, lr} - * 0x0001bf44 54709fe5 ldr r7, [0x0001bfa0] - * 0x0001bf48 0030d7e5 ldrb r3, [r7] - * 0x0001bf4c 000053e3 cmp r3, 0 - * 0x0001bf50 f080bd18 popne {r4, r5, r6, r7, pc} - * 0x0001bf54 48609fe5 ldr r6, [0x0001bfa4] - * 0x0001bf58 48309fe5 ldr r3, [0x0001bfa8] - * 0x0001bf5c 48409fe5 ldr r4, [0x0001bfac] - * 0x0001bf60 033066e0 rsb r3, r6, r3 - * 0x0001bf64 4331a0e1 asr r3, r3, 2 - * 0x0001bf68 002094e5 ldr r2, [r4] - * 0x0001bf6c 015043e2 sub r5, r3, 1 - * 0x0001bf70 050052e1 cmp r2, r5 - * 0x0001bf74 0600002a bhs 0x1bf94 - * 0x0001bf78 013082e2 add r3, r2, 1 - * 0x0001bf7c 003084e5 str r3, [r4] - * 0x0001bf80 0fe0a0e1 mov lr, pc - * 0x0001bf84 03f196e7 ldr pc, [r6, r3, lsl 2] - * 0x0001bf88 002094e5 ldr r2, [r4] - * 0x0001bf8c 050052e1 cmp r2, r5 - * 0x0001bf90 f8ffff3a blo 0x1bf78 - * 0x0001bf94 0130a0e3 mov r3, 1 - * 0x0001bf98 0030c7e5 strb r3, [r7] - * 0x0001bf9c f080bde8 pop {r4, r5, r6, r7, pc} - * 0x0001bfa0 9c7d0b00 muleq fp, ip, sp - * 0x0001bfa4 a0330b00 andeq r3, fp, r0, lsr 7 - * 0x0001bfa8 a4330b00 andeq r3, fp, r4, lsr 7 - * 0x0001bfac a07d0b00 andeq r7, fp, r0, lsr 27 - * 0x0001bfb0 04e02de5 str lr, [sp, -4]! - * 0x0001bfb4 04f09de4 pop {pc} - * 0x0001bfb8 24009fe5 ldr r0, [0x0001bfe4] - * 0x0001bfbc 003090e5 ldr r3, [r0] - * 0x0001bfc0 000053e3 cmp r3, 0 - * 0x0001bfc4 04e02de5 str lr, [sp, -4]! - * 0x0001bfc8 04f09d04 popeq {pc} - * 0x0001bfcc 14309fe5 ldr r3, [0x0001bfe8] - * 0x0001bfd0 000053e3 cmp r3, 0 - */ - -/* -use test::Bencher; -#[bench] -pub fn bench_60000_instrs(b: &mut Bencher) { - b.iter(|| { - for i in (0..1000) { - let mut iter = INSTRUCTION_BYTES.iter().map(|x| *x); - let decoder = InstDecoder::default(); - let mut result = Instruction::default(); - loop { - match decoder.decode_into(&mut result, &mut iter) { - Ok(result) => { - test::black_box(&result); - }, - Err(_) => { - break; - } - } - } - } - }); -} -*/ diff --git a/test/armv7/thumb.rs b/test/armv7/thumb.rs deleted file mode 100644 index 9182f6e..0000000 --- a/test/armv7/thumb.rs +++ /dev/null @@ -1,4084 +0,0 @@ -use yaxpeax_arch::{Arch, Decoder}; -use yaxpeax_arm::armv7::{ARMv7, Instruction}; - -type InstDecoder = ::Decoder; - -#[allow(dead_code)] -fn test_invalid_under(decoder: &InstDecoder, data: &[u8]) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - match decoder.decode(&mut reader) { - Err(_) => { }, - Ok(inst) => { - panic!( - "unexpected successful decode for {:#x?}\ngot: {}", - data, - inst - ); - } - } -} - -#[allow(dead_code)] -fn test_display_under(decoder: &InstDecoder, data: [u8; 4], expected: &'static str) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - let instr = match decoder.decode(&mut reader) { - Err(e) => { - panic!("failed to decode {:#x?}: {}", data, e) - } - Ok(instr) => instr, - }; - let displayed = format!("{}", instr); - assert!( - displayed == expected, - "decode error for {:#x?}:\n decoded: {:?}\n expected: {:?}\n", - data, - displayed, expected - ); -} - -#[allow(dead_code)] -fn test_decode(data: &[u8], expected: Instruction) { - let mut reader = yaxpeax_arch::U8Reader::new(data); - let instr = match InstDecoder::default_thumb().decode(&mut reader) { - Err(e) => { - panic!("failed to decode {:#x?}: {}", data, e) - } - Ok(instr) => instr, - }; - assert!( - instr == expected, - "decode error for {:#x?}:\n decoded: {:?}\n expected: {:?}\n", - data, - instr, expected - ); -} - -#[allow(dead_code)] -fn test_invalid(data: &[u8]) { - test_invalid_under(&InstDecoder::default_thumb(), data); -} - -fn test_display(data: &[u8], expected: &'static str) { - let mut reader = yaxpeax_arch::U8Reader::new(data); - let instr = match InstDecoder::default_thumb().decode(&mut reader) { - Err(e) => { - panic!("failed to decode {:#x?}: {}", data, e) - } - Ok(instr) => instr, - }; - let text = format!("{}", instr); - assert!( - text == expected, - "display error for {:#x?}\n decoded: {:?}\n displayed: {}\n expected: {}\n", - data, - instr, - text, expected - ); -} - -#[test] -fn test_unpredictable_instructions() { - test_invalid(&[0x80, 0xfa, 0x40, 0x00]); -} - -#[test] -fn test_decode_add_cases() { - test_display( - &[0x01, 0x44], - "add r1, r0" - ); - test_display( - &[0x01, 0xa8], - "add r0, sp, 0x4" - ); - test_display( - &[0x01, 0xa9], - "add r1, sp, 0x4" - ); - test_display( - &[0x01, 0xaa], - "add r2, sp, 0x4" - ); - test_display( - &[0x01, 0xab], - "add r3, sp, 0x4" - ); - test_display( - &[0x01, 0xad], - "add r5, sp, 0x4" - ); - test_display( - &[0x01, 0xae], - "add r6, sp, 0x4" - ); - test_display( - &[0x01, 0xaf], - "add r7, sp, 0x4" - ); - test_display( - &[0x05, 0xac], - "add r4, sp, 0x14" - ); - test_display( - &[0x61, 0xb0], - "add sp, sp, 0x184" - ); - test_display( - &[0x01, 0xb0], - "add sp, sp, 0x4" - ); - test_display( - &[0x02, 0x44], - "add r2, r0" - ); - test_display( - &[0x02, 0xb0], - "add sp, sp, 0x8" - ); - test_display( - &[0x03, 0x44], - "add r3, r0" - ); - test_display( - &[0x17, 0x44], - "add r7, r2" - ); - test_display( - &[0x1b, 0x44], - "add r3, r3" - ); - test_display( - &[0x54, 0x44], - "add r4, r10" - ); - test_display( - &[0x57, 0x44], - "add r7, r10" - ); - test_display( - &[0x5a, 0x44], - "add r2, fp" - ); - test_display( - &[0x61, 0x44], - "add r1, ip" - ); - test_display( - &[0x68, 0x44], - "add r0, sp" - ); - test_display( - &[0x69, 0x44], - "add r1, sp" - ); - test_display( - &[0x6a, 0x44], - "add r2, sp" - ); - test_display( - &[0x6b, 0x44], - "add r3, sp" - ); - test_display( - &[0x6d, 0x44], - "add r5, sp" - ); - test_display( - &[0x6e, 0x44], - "add r6, sp" - ); - test_display( - &[0x6f, 0x44], - "add r7, sp" - ); - test_display( - &[0x75, 0x44], - "add r5, lr" - ); - test_display( - &[0x79, 0x44], - "add r1, pc" - ); - test_display( - &[0xc0, 0x44], - "add r8, r8" - ); - test_display( - &[0xc1, 0x44], - "add sb, r8" - ); - test_display( - &[0xc2, 0x44], - "add r10, r8" - ); - test_display( - &[0xc3, 0x44], - "add fp, r8" - ); - test_display( - &[0xc4, 0x44], - "add ip, r8" - ); - test_display( - &[0xc5, 0x44], - "add sp, r8" - ); - test_display( - &[0xc6, 0x44], - "add lr, r8" - ); - test_display( - &[0xc7, 0x44], - "add pc, r8" - ); - test_display( - &[0xc8, 0x44], - "add r8, sb" - ); - test_display( - &[0xc9, 0x44], - "add sb, sb" - ); - test_display( - &[0xca, 0x44], - "add r10, sb" - ); - test_display( - &[0xcb, 0x44], - "add fp, sb" - ); - test_display( - &[0xcc, 0x44], - "add ip, sb" - ); - test_display( - &[0xcd, 0x44], - "add sp, sb" - ); - test_display( - &[0xce, 0x44], - "add lr, sb" - ); - test_display( - &[0xcf, 0x44], - "add pc, sb" - ); - test_display( - &[0xd0, 0x44], - "add r8, r10" - ); - test_display( - &[0xd1, 0x44], - "add sb, r10" - ); - test_display( - &[0xd2, 0x44], - "add r10, r10" - ); - test_display( - &[0xd3, 0x44], - "add fp, r10" - ); - test_display( - &[0xd4, 0x44], - "add ip, r10" - ); - test_display( - &[0xd5, 0x44], - "add sp, r10" - ); - test_display( - &[0xd6, 0x44], - "add lr, r10" - ); - test_display( - &[0xd7, 0x44], - "add pc, r10" - ); - test_display( - &[0xd8, 0x44], - "add r8, fp" - ); - test_display( - &[0xd9, 0x44], - "add sb, fp" - ); - test_display( - &[0xda, 0x44], - "add r10, fp" - ); - test_display( - &[0xdb, 0x44], - "add fp, fp" - ); - test_display( - &[0xdc, 0x44], - "add ip, fp" - ); - test_display( - &[0xdd, 0x44], - "add sp, fp" - ); - test_display( - &[0xde, 0x44], - "add lr, fp" - ); - test_display( - &[0xdf, 0x44], - "add pc, fp" - ); - test_display( - &[0xe0, 0x44], - "add r8, ip" - ); - test_display( - &[0xe1, 0x44], - "add sb, ip" - ); - test_display( - &[0xe2, 0x44], - "add r10, ip" - ); - test_display( - &[0xe3, 0x44], - "add fp, ip" - ); - test_display( - &[0xe4, 0x44], - "add ip, ip" - ); - test_display( - &[0xe5, 0x44], - "add sp, ip" - ); - test_display( - &[0xe6, 0x44], - "add lr, ip" - ); - test_display( - &[0xe7, 0x44], - "add pc, ip" - ); - test_display( - &[0xe8, 0x44], - "add r8, sp" - ); - test_display( - &[0xe9, 0x44], - "add sb, sp" - ); - test_display( - &[0xea, 0x44], - "add r10, sp" - ); - test_display( - &[0xeb, 0x44], - "add fp, sp" - ); - test_display( - &[0xec, 0x44], - "add ip, sp" - ); - test_display( - &[0xed, 0x44], - "add sp, sp" - ); - test_display( - &[0xee, 0x44], - "add lr, sp" - ); - test_display( - &[0xef, 0x44], - "add pc, sp" - ); - test_display( - &[0xf0, 0x44], - "add r8, lr" - ); - test_display( - &[0xf1, 0x44], - "add sb, lr" - ); - test_display( - &[0xf2, 0x44], - "add r10, lr" - ); - test_display( - &[0xf3, 0x44], - "add fp, lr" - ); - test_display( - &[0xf4, 0x44], - "add ip, lr" - ); - test_display( - &[0xf5, 0x44], - "add sp, lr" - ); - test_display( - &[0xf6, 0x44], - "add lr, lr" - ); - test_display( - &[0xf7, 0x44], - "add pc, lr" - ); - test_display( - &[0xf8, 0x44], - "add r8, pc" - ); - test_display( - &[0xf9, 0x44], - "add sb, pc" - ); - test_display( - &[0xfa, 0x44], - "add r10, pc" - ); - test_display( - &[0xfb, 0x44], - "add fp, pc" - ); - test_display( - &[0xfc, 0x44], - "add ip, pc" - ); - test_display( - &[0xfd, 0x44], - "add sp, pc" - ); - test_display( - &[0xfe, 0x44], - "add lr, pc" - ); - test_display( - &[0xff, 0x44], - "add pc, pc" - ); -} -#[test] -fn test_decode_adr_cases() { - test_display( - &[0x00, 0xa3], - "adr r3, 0x0" - ); - test_display( - &[0x28, 0xa7], - "adr r7, 0xa0" - ); - test_display( - &[0x29, 0xa0], - "adr r0, 0xa4" - ); - test_display( - &[0xff, 0xa6], - "adr r6, 0x3fc" - ); - test_display( - &[0xff, 0xa7], - "adr r7, 0x3fc" - ); - test_display( - &[0x0f, 0xf2, 0x4f, 0x56], - "add r6, pc, 0x54f" - ); - test_display( - &[0xaf, 0xf2, 0x4f, 0x56], - "sub r6, pc, 0x54f" - ); -} -#[test] -fn test_decode_bcc_cases() { - test_display( - &[0x80, 0x47], - "blx r0" - ); - test_display( - &[0x88, 0x47], - "blx r1" - ); - test_display( - &[0x90, 0x47], - "blx r2" - ); - test_display( - &[0x98, 0x47], - "blx r3" - ); - test_display( - &[0xa0, 0x47], - "blx r4" - ); - test_display( - &[0xa8, 0x47], - "blx r5" - ); - test_display( - &[0xb0, 0x47], - "blx r6" - ); - test_display( - &[0xb8, 0x47], - "blx r7" - ); - test_display( - &[0xc0, 0x47], - "blx r8" - ); - test_display( - &[0xc8, 0x47], - "blx sb" - ); - test_display( - &[0xd0, 0x47], - "blx r10" - ); - test_display( - &[0xd8, 0x47], - "blx fp" - ); - test_display( - &[0xe0, 0x47], - "blx ip" - ); - test_display( - &[0xe8, 0x47], - "blx sp" - ); - test_display( - &[0xf0, 0x47], - "blx lr" - ); - test_display( - &[0xf8, 0x47], - "blx pc" - ); - test_display( - &[0xfe, 0xd0], - "beq $-0x2" - ); - test_display( - &[0xfe, 0xd1], - "bne $-0x2" - ); - test_display( - &[0xfe, 0xd2], - "bhs $-0x2" - ); - test_display( - &[0xfe, 0xd3], - "blo $-0x2" - ); - test_display( - &[0xfe, 0xd4], - "bmi $-0x2" - ); - test_display( - &[0xfe, 0xd5], - "bpl $-0x2" - ); - test_display( - &[0xfe, 0xd6], - "bvs $-0x2" - ); - test_display( - &[0xfe, 0xd7], - "bvc $-0x2" - ); - test_display( - &[0xfe, 0xd8], - "bhi $-0x2" - ); - test_display( - &[0xfe, 0xd9], - "bls $-0x2" - ); - test_display( - &[0xfe, 0xda], - "bge $-0x2" - ); - test_display( - &[0xfe, 0xdb], - "blt $-0x2" - ); - test_display( - &[0xfe, 0xdc], - "bgt $-0x2" - ); - test_display( - &[0xfe, 0xdd], - "ble $-0x2" - ); - test_display( - &[0xd3, 0xd0], - "beq $-0x58" - ); - test_display( - &[0xd3, 0xd1], - "bne $-0x58" - ); - test_display( - &[0xd3, 0xd2], - "bhs $-0x58" - ); - test_display( - &[0xd3, 0xd3], - "blo $-0x58" - ); - test_display( - &[0xd3, 0xd4], - "bmi $-0x58" - ); - test_display( - &[0xd3, 0xd5], - "bpl $-0x58" - ); - test_display( - &[0xd3, 0xd6], - "bvs $-0x58" - ); - test_display( - &[0xd3, 0xd7], - "bvc $-0x58" - ); - test_display( - &[0xd3, 0xd8], - "bhi $-0x58" - ); - test_display( - &[0xd3, 0xd9], - "bls $-0x58" - ); - test_display( - &[0xd3, 0xda], - "bge $-0x58" - ); - test_display( - &[0xd3, 0xdb], - "blt $-0x58" - ); - test_display( - &[0xd3, 0xdc], - "bgt $-0x58" - ); - test_display( - &[0xd3, 0xdd], - "ble $-0x58" - ); - test_display( - &[0xfd, 0xd0], - "beq $-0x4" - ); - test_display( - &[0xfd, 0xd1], - "bne $-0x4" - ); - test_display( - &[0xfd, 0xd2], - "bhs $-0x4" - ); - test_display( - &[0xfd, 0xd3], - "blo $-0x4" - ); - test_display( - &[0xfd, 0xd4], - "bmi $-0x4" - ); - test_display( - &[0xfd, 0xd5], - "bpl $-0x4" - ); - test_display( - &[0xfd, 0xd6], - "bvs $-0x4" - ); - test_display( - &[0xfd, 0xd7], - "bvc $-0x4" - ); - test_display( - &[0xfd, 0xd8], - "bhi $-0x4" - ); - test_display( - &[0xfd, 0xd9], - "bls $-0x4" - ); - test_display( - &[0xfd, 0xda], - "bge $-0x4" - ); - test_display( - &[0xfd, 0xdb], - "blt $-0x4" - ); - test_display( - &[0xfd, 0xdc], - "bgt $-0x4" - ); - test_display( - &[0xfd, 0xdd], - "ble $-0x4" - ); -} -#[test] -fn test_decode_bkpt_cases() { - test_display( - &[0x00, 0xbe], - "bkpt 0x0" - ); - test_display( - &[0x75, 0xbe], - "bkpt 0x75" - ); - test_display( - &[0xff, 0xbe], - "bkpt 0xff" - ); -} -#[test] -fn test_decode_bx_cases() { - test_display( - &[0x00, 0x47], - "bx r0" - ); - test_display( - &[0x01, 0x47], - "bx r0" - ); - test_display( - &[0x02, 0x47], - "bx r0" - ); - test_display( - &[0x03, 0x47], - "bx r0" - ); - test_display( - &[0x04, 0x47], - "bx r0" - ); - test_display( - &[0x05, 0x47], - "bx r0" - ); - test_display( - &[0x06, 0x47], - "bx r0" - ); - test_display( - &[0x07, 0x47], - "bx r0" - ); - test_display( - &[0x08, 0x47], - "bx r1" - ); - test_display( - &[0x09, 0x47], - "bx r1" - ); - test_display( - &[0x0a, 0x47], - "bx r1" - ); - test_display( - &[0x0b, 0x47], - "bx r1" - ); - test_display( - &[0x0c, 0x47], - "bx r1" - ); - test_display( - &[0x0d, 0x47], - "bx r1" - ); - test_display( - &[0x0e, 0x47], - "bx r1" - ); - test_display( - &[0x0f, 0x47], - "bx r1" - ); - test_display( - &[0x10, 0x47], - "bx r2" - ); - test_display( - &[0x11, 0x47], - "bx r2" - ); - test_display( - &[0x12, 0x47], - "bx r2" - ); - test_display( - &[0x13, 0x47], - "bx r2" - ); - test_display( - &[0x14, 0x47], - "bx r2" - ); - test_display( - &[0x15, 0x47], - "bx r2" - ); - test_display( - &[0x16, 0x47], - "bx r2" - ); - test_display( - &[0x17, 0x47], - "bx r2" - ); - test_display( - &[0x18, 0x47], - "bx r3" - ); - test_display( - &[0x19, 0x47], - "bx r3" - ); - test_display( - &[0x1a, 0x47], - "bx r3" - ); - test_display( - &[0x1b, 0x47], - "bx r3" - ); - test_display( - &[0x1c, 0x47], - "bx r3" - ); - test_display( - &[0x1d, 0x47], - "bx r3" - ); - test_display( - &[0x1e, 0x47], - "bx r3" - ); - test_display( - &[0x1f, 0x47], - "bx r3" - ); - test_display( - &[0x20, 0x47], - "bx r4" - ); - test_display( - &[0x21, 0x47], - "bx r4" - ); - test_display( - &[0x22, 0x47], - "bx r4" - ); - test_display( - &[0x23, 0x47], - "bx r4" - ); - test_display( - &[0x24, 0x47], - "bx r4" - ); - test_display( - &[0x25, 0x47], - "bx r4" - ); - test_display( - &[0x26, 0x47], - "bx r4" - ); - test_display( - &[0x27, 0x47], - "bx r4" - ); - test_display( - &[0x28, 0x47], - "bx r5" - ); - test_display( - &[0x29, 0x47], - "bx r5" - ); - test_display( - &[0x2a, 0x47], - "bx r5" - ); - test_display( - &[0x2b, 0x47], - "bx r5" - ); - test_display( - &[0x2c, 0x47], - "bx r5" - ); - test_display( - &[0x2d, 0x47], - "bx r5" - ); - test_display( - &[0x2e, 0x47], - "bx r5" - ); - test_display( - &[0x2f, 0x47], - "bx r5" - ); - test_display( - &[0x30, 0x47], - "bx r6" - ); - test_display( - &[0x31, 0x47], - "bx r6" - ); - test_display( - &[0x32, 0x47], - "bx r6" - ); - test_display( - &[0x33, 0x47], - "bx r6" - ); - test_display( - &[0x34, 0x47], - "bx r6" - ); - test_display( - &[0x35, 0x47], - "bx r6" - ); - test_display( - &[0x36, 0x47], - "bx r6" - ); - test_display( - &[0x37, 0x47], - "bx r6" - ); - test_display( - &[0x38, 0x47], - "bx r7" - ); - test_display( - &[0x39, 0x47], - "bx r7" - ); - test_display( - &[0x3a, 0x47], - "bx r7" - ); - test_display( - &[0x3b, 0x47], - "bx r7" - ); - test_display( - &[0x3c, 0x47], - "bx r7" - ); - test_display( - &[0x3d, 0x47], - "bx r7" - ); - test_display( - &[0x3e, 0x47], - "bx r7" - ); - test_display( - &[0x3f, 0x47], - "bx r7" - ); - test_display( - &[0x40, 0x47], - "bx r8" - ); - test_display( - &[0x41, 0x47], - "bx r8" - ); - test_display( - &[0x42, 0x47], - "bx r8" - ); - test_display( - &[0x43, 0x47], - "bx r8" - ); - test_display( - &[0x44, 0x47], - "bx r8" - ); - test_display( - &[0x45, 0x47], - "bx r8" - ); - test_display( - &[0x46, 0x47], - "bx r8" - ); - test_display( - &[0x47, 0x47], - "bx r8" - ); - test_display( - &[0x48, 0x47], - "bx sb" - ); - test_display( - &[0x49, 0x47], - "bx sb" - ); - test_display( - &[0x4a, 0x47], - "bx sb" - ); - test_display( - &[0x4b, 0x47], - "bx sb" - ); - test_display( - &[0x4c, 0x47], - "bx sb" - ); - test_display( - &[0x4d, 0x47], - "bx sb" - ); - test_display( - &[0x4e, 0x47], - "bx sb" - ); - test_display( - &[0x4f, 0x47], - "bx sb" - ); - test_display( - &[0x50, 0x47], - "bx r10" - ); - test_display( - &[0x51, 0x47], - "bx r10" - ); - test_display( - &[0x52, 0x47], - "bx r10" - ); - test_display( - &[0x53, 0x47], - "bx r10" - ); - test_display( - &[0x54, 0x47], - "bx r10" - ); - test_display( - &[0x55, 0x47], - "bx r10" - ); - test_display( - &[0x56, 0x47], - "bx r10" - ); - test_display( - &[0x57, 0x47], - "bx r10" - ); - test_display( - &[0x58, 0x47], - "bx fp" - ); - test_display( - &[0x59, 0x47], - "bx fp" - ); - test_display( - &[0x5a, 0x47], - "bx fp" - ); - test_display( - &[0x5b, 0x47], - "bx fp" - ); - test_display( - &[0x5c, 0x47], - "bx fp" - ); - test_display( - &[0x5d, 0x47], - "bx fp" - ); - test_display( - &[0x5e, 0x47], - "bx fp" - ); - test_display( - &[0x5f, 0x47], - "bx fp" - ); - test_display( - &[0x60, 0x47], - "bx ip" - ); - test_display( - &[0x61, 0x47], - "bx ip" - ); - test_display( - &[0x62, 0x47], - "bx ip" - ); - test_display( - &[0x63, 0x47], - "bx ip" - ); - test_display( - &[0x64, 0x47], - "bx ip" - ); - test_display( - &[0x65, 0x47], - "bx ip" - ); - test_display( - &[0x66, 0x47], - "bx ip" - ); - test_display( - &[0x67, 0x47], - "bx ip" - ); - test_display( - &[0x68, 0x47], - "bx sp" - ); - test_display( - &[0x69, 0x47], - "bx sp" - ); - test_display( - &[0x6a, 0x47], - "bx sp" - ); - test_display( - &[0x6b, 0x47], - "bx sp" - ); - test_display( - &[0x6c, 0x47], - "bx sp" - ); - test_display( - &[0x6d, 0x47], - "bx sp" - ); - test_display( - &[0x6e, 0x47], - "bx sp" - ); - test_display( - &[0x6f, 0x47], - "bx sp" - ); - test_display( - &[0x70, 0x47], - "bx lr" - ); - test_display( - &[0x71, 0x47], - "bx lr" - ); - test_display( - &[0x72, 0x47], - "bx lr" - ); - test_display( - &[0x73, 0x47], - "bx lr" - ); - test_display( - &[0x74, 0x47], - "bx lr" - ); - test_display( - &[0x75, 0x47], - "bx lr" - ); - test_display( - &[0x76, 0x47], - "bx lr" - ); - test_display( - &[0x77, 0x47], - "bx lr" - ); - test_display( - &[0x78, 0x47], - "bx pc" - ); - test_display( - &[0x79, 0x47], - "bx pc" - ); - test_display( - &[0x7a, 0x47], - "bx pc" - ); - test_display( - &[0x7b, 0x47], - "bx pc" - ); - test_display( - &[0x7c, 0x47], - "bx pc" - ); - test_display( - &[0x7d, 0x47], - "bx pc" - ); - test_display( - &[0x7e, 0x47], - "bx pc" - ); - test_display( - &[0x7f, 0x47], - "bx pc" - ); -} -#[test] -fn test_decode_cbz_cbnz_cases() { - test_display( - &[0x01, 0xb1], - "cbz r1, $+0x2" // original test: 0x4. assume address is 0, so $ is 2, +2 makes 4? - ); - test_display( - &[0x01, 0xb3], - "cbz r1, $+0x42" // original test: 0x4. assume address is 0, so $ is 2, +2 makes 4? - ); - test_display( - &[0x01, 0xb9], - "cbnz r1, $+0x2" // original test: 0x4. assume address is 0, so $ is 2, +2 makes 4? - ); - test_display( - &[0x01, 0xbb], - "cbnz r1, $+0x42" // original test: 0x4. assume address is 0, so $ is 2, +2 makes 4? - ); - test_display( - &[0x07, 0xb1], - "cbz r7, $+0x2" // original test: 0x4. assume address is 0, so $ is 2, +2 makes 4? - ); - test_display( - &[0x07, 0xb3], - "cbz r7, $+0x42" - ); - test_display( - &[0x07, 0xb9], - "cbnz r7, $+0x2" - ); - test_display( - &[0x07, 0xbb], - "cbnz r7, $+0x42" - ); - test_display( - &[0xff, 0xb1], - "cbz r7, $+0x40" - ); - test_display( - &[0xff, 0xb3], - "cbz r7, $+0x80" - ); - test_display( - &[0xff, 0xb9], - "cbnz r7, $+0x40" - ); - test_display( - &[0xff, 0xbb], - "cbnz r7, $+0x80" - ); -} -#[test] -fn test_decode_cmn_test_cases() { - test_display( - &[0x33, 0x42], - "tst r3, r6" - ); - test_display( - &[0xf3, 0x42], - "cmn r3, r6" - ); -} -#[test] -fn test_decode_cmp_cases() { - test_display( - &[0x00, 0x45], - "cmp r0, r0" - ); - test_display( - &[0x01, 0x45], - "cmp r1, r0" - ); - test_display( - &[0x02, 0x28], - "cmp r0, 0x2" - ); - test_display( - &[0x02, 0x29], - "cmp r1, 0x2" - ); - test_display( - &[0x02, 0x2a], - "cmp r2, 0x2" - ); - test_display( - &[0x02, 0x2b], - "cmp r3, 0x2" - ); - test_display( - &[0x02, 0x2c], - "cmp r4, 0x2" - ); - test_display( - &[0x02, 0x2d], - "cmp r5, 0x2" - ); - test_display( - &[0x02, 0x2e], - "cmp r6, 0x2" - ); - test_display( - &[0x02, 0x2f], - "cmp r7, 0x2" - ); - test_display( - &[0xff, 0x28], - "cmp r0, 0xff" - ); - test_display( - &[0xff, 0x29], - "cmp r1, 0xff" - ); - test_display( - &[0xff, 0x2a], - "cmp r2, 0xff" - ); - test_display( - &[0xff, 0x2b], - "cmp r3, 0xff" - ); - test_display( - &[0xff, 0x2c], - "cmp r4, 0xff" - ); - test_display( - &[0xff, 0x2d], - "cmp r5, 0xff" - ); - test_display( - &[0xff, 0x2e], - "cmp r6, 0xff" - ); - test_display( - &[0xff, 0x2f], - "cmp r7, 0xff" - ); - test_display( - &[0x53, 0x45], - "cmp r3, r10" - ); - test_display( - &[0x6c, 0x45], - "cmp r4, sp" - ); - test_display( - &[0x7e, 0x45], - "cmp r6, pc" - ); - test_display( - &[0xfe, 0x45], - "cmp lr, pc" - ); - test_display( - &[0xff, 0x45], - "cmp pc, pc" - ); -} -#[test] -fn test_decode_it_cases() { - test_display( - &[0x01, 0xbf], - "itttt eq" - ); - test_display( - &[0x03, 0xbf], - "ittte eq" - ); - test_display( - &[0x05, 0xbf], - "ittet eq" - ); - test_display( - &[0x07, 0xbf], - "ittee eq" - ); - test_display( - &[0x09, 0xbf], - "itett eq" - ); - test_display( - &[0x0b, 0xbf], - "itete eq" - ); - test_display( - &[0x0d, 0xbf], - "iteet eq" - ); - test_display( - &[0x0f, 0xbf], - "iteee eq" - ); - test_display( - &[0x11, 0xbf], - "iteee ne" - ); - test_display( - &[0x13, 0xbf], - "iteet ne" - ); - test_display( - &[0x15, 0xbf], - "itete ne" - ); - test_display( - &[0x17, 0xbf], - "itett ne" - ); - test_display( - &[0x19, 0xbf], - "ittee ne" - ); - test_display( - &[0x1b, 0xbf], - "ittet ne" - ); - test_display( - &[0x1d, 0xbf], - "ittte ne" - ); - test_display( - &[0x1f, 0xbf], - "itttt ne" - ); - test_display( - &[0x21, 0xbf], - "itttt hs" - ); - test_display( - &[0x23, 0xbf], - "ittte hs" - ); - test_display( - &[0x25, 0xbf], - "ittet hs" - ); - test_display( - &[0x27, 0xbf], - "ittee hs" - ); - test_display( - &[0x29, 0xbf], - "itett hs" - ); - test_display( - &[0x2b, 0xbf], - "itete hs" - ); - test_display( - &[0x2d, 0xbf], - "iteet hs" - ); - test_display( - &[0x2f, 0xbf], - "iteee hs" - ); - test_display( - &[0x31, 0xbf], - "iteee lo" - ); - test_display( - &[0x33, 0xbf], - "iteet lo" - ); - test_display( - &[0x35, 0xbf], - "itete lo" - ); - test_display( - &[0x37, 0xbf], - "itett lo" - ); - test_display( - &[0x39, 0xbf], - "ittee lo" - ); - test_display( - &[0x3b, 0xbf], - "ittet lo" - ); - test_display( - &[0x3d, 0xbf], - "ittte lo" - ); - test_display( - &[0x3f, 0xbf], - "itttt lo" - ); - test_display( - &[0x41, 0xbf], - "itttt mi" - ); - test_display( - &[0x43, 0xbf], - "ittte mi" - ); - test_display( - &[0x45, 0xbf], - "ittet mi" - ); - test_display( - &[0x47, 0xbf], - "ittee mi" - ); - test_display( - &[0x49, 0xbf], - "itett mi" - ); - test_display( - &[0x4b, 0xbf], - "itete mi" - ); - test_display( - &[0x4d, 0xbf], - "iteet mi" - ); - test_display( - &[0x4f, 0xbf], - "iteee mi" - ); - test_display( - &[0x51, 0xbf], - "iteee pl" - ); - test_display( - &[0x53, 0xbf], - "iteet pl" - ); - test_display( - &[0x55, 0xbf], - "itete pl" - ); - test_display( - &[0x57, 0xbf], - "itett pl" - ); - test_display( - &[0x59, 0xbf], - "ittee pl" - ); - test_display( - &[0x5b, 0xbf], - "ittet pl" - ); - test_display( - &[0x5d, 0xbf], - "ittte pl" - ); - test_display( - &[0x5f, 0xbf], - "itttt pl" - ); - test_display( - &[0x61, 0xbf], - "itttt vs" - ); - test_display( - &[0x63, 0xbf], - "ittte vs" - ); - test_display( - &[0x65, 0xbf], - "ittet vs" - ); - test_display( - &[0x67, 0xbf], - "ittee vs" - ); - test_display( - &[0x69, 0xbf], - "itett vs" - ); - test_display( - &[0x6b, 0xbf], - "itete vs" - ); - test_display( - &[0x6d, 0xbf], - "iteet vs" - ); - test_display( - &[0x6f, 0xbf], - "iteee vs" - ); - test_display( - &[0x71, 0xbf], - "iteee vc" - ); - test_display( - &[0x73, 0xbf], - "iteet vc" - ); - test_display( - &[0x75, 0xbf], - "itete vc" - ); - test_display( - &[0x77, 0xbf], - "itett vc" - ); - test_display( - &[0x79, 0xbf], - "ittee vc" - ); - test_display( - &[0x7b, 0xbf], - "ittet vc" - ); - test_display( - &[0x7d, 0xbf], - "ittte vc" - ); - test_display( - &[0x7f, 0xbf], - "itttt vc" - ); - test_display( - &[0x81, 0xbf], - "itttt hi" - ); - test_display( - &[0x83, 0xbf], - "ittte hi" - ); - test_display( - &[0x85, 0xbf], - "ittet hi" - ); - test_display( - &[0x87, 0xbf], - "ittee hi" - ); - test_display( - &[0x89, 0xbf], - "itett hi" - ); - test_display( - &[0x8b, 0xbf], - "itete hi" - ); - test_display( - &[0x8d, 0xbf], - "iteet hi" - ); - test_display( - &[0x8f, 0xbf], - "iteee hi" - ); - test_display( - &[0x91, 0xbf], - "iteee ls" - ); - test_display( - &[0x93, 0xbf], - "iteet ls" - ); - test_display( - &[0x95, 0xbf], - "itete ls" - ); - test_display( - &[0x97, 0xbf], - "itett ls" - ); - test_display( - &[0x99, 0xbf], - "ittee ls" - ); - test_display( - &[0x9b, 0xbf], - "ittet ls" - ); - test_display( - &[0x9d, 0xbf], - "ittte ls" - ); - test_display( - &[0x9f, 0xbf], - "itttt ls" - ); - test_display( - &[0xa1, 0xbf], - "itttt ge" - ); - test_display( - &[0xa3, 0xbf], - "ittte ge" - ); - test_display( - &[0xa5, 0xbf], - "ittet ge" - ); - test_display( - &[0xa7, 0xbf], - "ittee ge" - ); - test_display( - &[0xa9, 0xbf], - "itett ge" - ); - test_display( - &[0xab, 0xbf], - "itete ge" - ); - test_display( - &[0xad, 0xbf], - "iteet ge" - ); - test_display( - &[0xaf, 0xbf], - "iteee ge" - ); - test_display( - &[0xb1, 0xbf], - "iteee lt" - ); - test_display( - &[0xb3, 0xbf], - "iteet lt" - ); - test_display( - &[0xb5, 0xbf], - "itete lt" - ); - test_display( - &[0xb7, 0xbf], - "itett lt" - ); - test_display( - &[0xb9, 0xbf], - "ittee lt" - ); - test_display( - &[0xbb, 0xbf], - "ittet lt" - ); - test_display( - &[0xbd, 0xbf], - "ittte lt" - ); - test_display( - &[0xbf, 0xbf], - "itttt lt" - ); - test_display( - &[0xc1, 0xbf], - "itttt gt" - ); - test_display( - &[0xc3, 0xbf], - "ittte gt" - ); - test_display( - &[0xc5, 0xbf], - "ittet gt" - ); - test_display( - &[0xc7, 0xbf], - "ittee gt" - ); - test_display( - &[0xc9, 0xbf], - "itett gt" - ); - test_display( - &[0xcb, 0xbf], - "itete gt" - ); - test_display( - &[0xcd, 0xbf], - "iteet gt" - ); - test_display( - &[0xcf, 0xbf], - "iteee gt" - ); - test_display( - &[0xd1, 0xbf], - "iteee le" - ); - test_display( - &[0xd3, 0xbf], - "iteet le" - ); - test_display( - &[0xd5, 0xbf], - "itete le" - ); - test_display( - &[0xd7, 0xbf], - "itett le" - ); - test_display( - &[0xd9, 0xbf], - "ittee le" - ); - test_display( - &[0xdb, 0xbf], - "ittet le" - ); - test_display( - &[0xdd, 0xbf], - "ittte le" - ); - test_display( - &[0xdf, 0xbf], - "itttt le" - ); - test_display( - &[0xe1, 0xbf], - "itttt al" - ); - test_display( - &[0xe3, 0xbf], - "ittte al" - ); - test_display( - &[0xe5, 0xbf], - "ittet al" - ); - test_display( - &[0xe7, 0xbf], - "ittee al" - ); - test_display( - &[0xe9, 0xbf], - "itett al" - ); - test_display( - &[0xeb, 0xbf], - "itete al" - ); - test_display( - &[0xed, 0xbf], - "iteet al" - ); - test_display( - &[0xef, 0xbf], - "iteee al" - ); -} -#[test] -fn test_decode_ldm_16b_cases() { - test_display( - &[0x80, 0xc8], - "ldm r0!, {r7}" - ); - test_display( - &[0x80, 0xc9], - "ldm r1!, {r7}" - ); - test_display( - &[0x80, 0xca], - "ldm r2!, {r7}" - ); - test_display( - &[0x80, 0xcb], - "ldm r3!, {r7}" - ); - test_display( - &[0x80, 0xcc], - "ldm r4!, {r7}" - ); - test_display( - &[0x80, 0xcd], - "ldm r5!, {r7}" - ); - test_display( - &[0x80, 0xce], - "ldm r6!, {r7}" - ); - test_display( - &[0x80, 0xcf], - "ldm r7, {r7}" - ); - test_display( - &[0xb0, 0xce], - "ldm r6!, {r4, r5, r7}" - ); - test_display( - &[0xb0, 0xcf], - "ldm r7, {r4, r5, r7}" - ); - test_display( - &[0xc0, 0xcb], - "ldm r3!, {r6, r7}" - ); - test_display( - &[0xfe, 0xc8], - "ldm r0!, {r1, r2, r3, r4, r5, r6, r7}" - ); - test_display( - &[0xed, 0xcc], - "ldm r4!, {r0, r2, r3, r5, r6, r7}" - ); - test_display( - &[0xef, 0xcc], - "ldm r4!, {r0, r1, r2, r3, r5, r6, r7}" - ); - test_display( - &[0xfe, 0xce], - "ldm r6, {r1, r2, r3, r4, r5, r6, r7}" - ); - test_display( - &[0xff, 0xcd], - "ldm r5, {r0, r1, r2, r3, r4, r5, r6, r7}" - ); -} -#[test] -fn test_decode_ldr_16b_cases() { - test_display( - &[0x00, 0x48], - "ldr r0, [pc]" - ); - test_display( - &[0x00, 0x49], - "ldr r1, [pc]" - ); - test_display( - &[0x00, 0x4a], - "ldr r2, [pc]" - ); - test_display( - &[0x00, 0x4b], - "ldr r3, [pc]" - ); - test_display( - &[0x00, 0x4c], - "ldr r4, [pc]" - ); - test_display( - &[0x00, 0x4d], - "ldr r5, [pc]" - ); - test_display( - &[0x00, 0x4e], - "ldr r6, [pc]" - ); - test_display( - &[0x00, 0x4f], - "ldr r7, [pc]" - ); - test_display( - &[0x00, 0x56], - "ldrsb r0, [r0, r0]" - ); - test_display( - &[0x00, 0x57], - "ldrsb r0, [r0, r4]" - ); - test_display( - &[0x00, 0x58], - "ldr r0, [r0, r0]" - ); - test_display( - &[0x00, 0x59], - "ldr r0, [r0, r4]" - ); - test_display( - &[0x00, 0x5a], - "ldrh r0, [r0, r0]" - ); - test_display( - &[0x00, 0x5b], - "ldrh r0, [r0, r4]" - ); - test_display( - &[0x00, 0x5c], - "ldrb r0, [r0, r0]" - ); - test_display( - &[0x00, 0x5d], - "ldrb r0, [r0, r4]" - ); - test_display( - &[0x00, 0x5e], - "ldrsh r0, [r0, r0]" - ); - test_display( - &[0x00, 0x5f], - "ldrsh r0, [r0, r4]" - ); - test_display( - &[0x00, 0x68], - "ldr r0, [r0]" - ); - test_display( - &[0x00, 0x69], - "ldr r0, [r0, 0x10]" - ); - test_display( - &[0x00, 0x6a], - "ldr r0, [r0, 0x20]" - ); - test_display( - &[0x00, 0x6b], - "ldr r0, [r0, 0x30]" - ); - test_display( - &[0x00, 0x6c], - "ldr r0, [r0, 0x40]" - ); - test_display( - &[0x00, 0x6d], - "ldr r0, [r0, 0x50]" - ); - test_display( - &[0x00, 0x6e], - "ldr r0, [r0, 0x60]" - ); - test_display( - &[0x00, 0x6f], - "ldr r0, [r0, 0x70]" - ); - test_display( - &[0x00, 0x78], - "ldrb r0, [r0]" - ); - test_display( - &[0x00, 0x79], - "ldrb r0, [r0, 0x4]" - ); - test_display( - &[0x00, 0x7a], - "ldrb r0, [r0, 0x8]" - ); - test_display( - &[0x00, 0x7b], - "ldrb r0, [r0, 0xc]" - ); - test_display( - &[0x00, 0x7c], - "ldrb r0, [r0, 0x10]" - ); - test_display( - &[0x00, 0x7d], - "ldrb r0, [r0, 0x14]" - ); - test_display( - &[0x00, 0x7e], - "ldrb r0, [r0, 0x18]" - ); - test_display( - &[0x00, 0x7f], - "ldrb r0, [r0, 0x1c]" - ); - test_display( - &[0x00, 0x88], - "ldrh r0, [r0]" - ); - test_display( - &[0x00, 0x89], - "ldrh r0, [r0, 0x8]" - ); - test_display( - &[0x00, 0x8a], - "ldrh r0, [r0, 0x10]" - ); - test_display( - &[0x00, 0x8b], - "ldrh r0, [r0, 0x18]" - ); - test_display( - &[0x00, 0x8c], - "ldrh r0, [r0, 0x20]" - ); - test_display( - &[0x00, 0x8d], - "ldrh r0, [r0, 0x28]" - ); - test_display( - &[0x00, 0x8e], - "ldrh r0, [r0, 0x30]" - ); - test_display( - &[0x00, 0x8f], - "ldrh r0, [r0, 0x38]" - ); - test_display( - &[0x00, 0x98], - "ldr r0, [sp]" - ); - test_display( - &[0x00, 0x99], - "ldr r1, [sp]" - ); - test_display( - &[0x00, 0x9a], - "ldr r2, [sp]" - ); - test_display( - &[0x00, 0x9b], - "ldr r3, [sp]" - ); - test_display( - &[0x00, 0x9c], - "ldr r4, [sp]" - ); - test_display( - &[0x00, 0x9d], - "ldr r5, [sp]" - ); - test_display( - &[0x00, 0x9e], - "ldr r6, [sp]" - ); - test_display( - &[0x00, 0x9f], - "ldr r7, [sp]" - ); - test_display( - &[0x01, 0x48], - "ldr r0, [pc, 0x4]" - ); - test_display( - &[0x01, 0x49], - "ldr r1, [pc, 0x4]" - ); - test_display( - &[0x01, 0x4a], - "ldr r2, [pc, 0x4]" - ); - test_display( - &[0x01, 0x4b], - "ldr r3, [pc, 0x4]" - ); - test_display( - &[0x01, 0x4c], - "ldr r4, [pc, 0x4]" - ); - test_display( - &[0x01, 0x4d], - "ldr r5, [pc, 0x4]" - ); - test_display( - &[0x01, 0x4e], - "ldr r6, [pc, 0x4]" - ); - test_display( - &[0x01, 0x4f], - "ldr r7, [pc, 0x4]" - ); - test_display( - &[0xff, 0x48], - "ldr r0, [pc, 0x3fc]" - ); - test_display( - &[0xff, 0x49], - "ldr r1, [pc, 0x3fc]" - ); - test_display( - &[0xff, 0x4a], - "ldr r2, [pc, 0x3fc]" - ); - test_display( - &[0xff, 0x4b], - "ldr r3, [pc, 0x3fc]" - ); - test_display( - &[0xff, 0x4c], - "ldr r4, [pc, 0x3fc]" - ); - test_display( - &[0xff, 0x4d], - "ldr r5, [pc, 0x3fc]" - ); - test_display( - &[0xff, 0x4e], - "ldr r6, [pc, 0x3fc]" - ); - test_display( - &[0xff, 0x4f], - "ldr r7, [pc, 0x3fc]" - ); - test_display( - &[0xff, 0x56], - "ldrsb r7, [r7, r3]" - ); - test_display( - &[0xff, 0x58], - "ldr r7, [r7, r3]" - ); - test_display( - &[0xff, 0x5a], - "ldrh r7, [r7, r3]" - ); - test_display( - &[0xff, 0x5c], - "ldrb r7, [r7, r3]" - ); - test_display( - &[0xff, 0x5e], - "ldrsh r7, [r7, r3]" - ); - test_display( - &[0xff, 0x68], - "ldr r7, [r7, 0xc]" - ); - test_display( - &[0xff, 0x69], - "ldr r7, [r7, 0x1c]" - ); - test_display( - &[0xff, 0x6a], - "ldr r7, [r7, 0x2c]" - ); - test_display( - &[0xff, 0x6b], - "ldr r7, [r7, 0x3c]" - ); - test_display( - &[0xff, 0x6c], - "ldr r7, [r7, 0x4c]" - ); - test_display( - &[0xff, 0x6d], - "ldr r7, [r7, 0x5c]" - ); - test_display( - &[0xff, 0x6e], - "ldr r7, [r7, 0x6c]" - ); - test_display( - &[0xff, 0x6f], - "ldr r7, [r7, 0x7c]" - ); - test_display( - &[0xff, 0x78], - "ldrb r7, [r7, 0x3]" - ); - test_display( - &[0xff, 0x79], - "ldrb r7, [r7, 0x7]" - ); - test_display( - &[0xff, 0x7a], - "ldrb r7, [r7, 0xb]" - ); - test_display( - &[0xff, 0x7b], - "ldrb r7, [r7, 0xf]" - ); - test_display( - &[0xff, 0x7c], - "ldrb r7, [r7, 0x13]" - ); - test_display( - &[0xff, 0x7d], - "ldrb r7, [r7, 0x17]" - ); - test_display( - &[0xff, 0x7e], - "ldrb r7, [r7, 0x1b]" - ); - test_display( - &[0xff, 0x7f], - "ldrb r7, [r7, 0x1f]" - ); - test_display( - &[0xff, 0x88], - "ldrh r7, [r7, 0x6]" - ); - test_display( - &[0xff, 0x89], - "ldrh r7, [r7, 0xe]" - ); - test_display( - &[0xff, 0x8a], - "ldrh r7, [r7, 0x16]" - ); - test_display( - &[0xff, 0x8b], - "ldrh r7, [r7, 0x1e]" - ); - test_display( - &[0xff, 0x8c], - "ldrh r7, [r7, 0x26]" - ); - test_display( - &[0xff, 0x8d], - "ldrh r7, [r7, 0x2e]" - ); - test_display( - &[0xff, 0x8e], - "ldrh r7, [r7, 0x36]" - ); - test_display( - &[0xff, 0x8f], - "ldrh r7, [r7, 0x3e]" - ); - test_display( - &[0xff, 0x98], - "ldr r0, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x99], - "ldr r1, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x9a], - "ldr r2, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x9b], - "ldr r3, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x9c], - "ldr r4, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x9d], - "ldr r5, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x9e], - "ldr r6, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x9f], - "ldr r7, [sp, 0x3fc]" - ); -} -#[test] -fn test_decode_misc_cases() { - test_display( - &[0x00, 0xbf], - "nop" - ); - test_display( - &[0x10, 0xbf], - "yield" - ); - test_display( - &[0x20, 0xbf], - "wfe" - ); - test_display( - &[0x30, 0xbf], - "wfi" - ); - test_display( - &[0x40, 0xbf], - "sev" - ); - test_display( - &[0x50, 0xb6], - "setend le" - ); - test_display( - &[0x50, 0xbf], - "hint 0x5" - ); - test_display( - &[0x58, 0xb6], - "setend be" - ); - test_display( - &[0x60, 0xbf], - "hint 0x6" - ); - test_display( - &[0x61, 0xb6], - "cpsie f" - ); - test_display( - &[0x62, 0xb6], - "cpsie i" - ); - test_display( - &[0x63, 0xb6], - "cpsie if" - ); - test_display( - &[0x64, 0xb6], - "cpsie a" - ); - test_display( - &[0x65, 0xb6], - "cpsie af" - ); - test_display( - &[0x66, 0xb6], - "cpsie ai" - ); - test_display( - &[0x67, 0xb6], - "cpsie aif" - ); - test_display( - &[0x70, 0xbf], - "hint 0x7" - ); - test_display( - &[0x71, 0xb6], - "cpsid f" - ); - test_display( - &[0x72, 0xb6], - "cpsid i" - ); - test_display( - &[0x73, 0xb6], - "cpsid if" - ); - test_display( - &[0x74, 0xb6], - "cpsid a" - ); - test_display( - &[0x75, 0xb6], - "cpsid af" - ); - test_display( - &[0x76, 0xb6], - "cpsid ai" - ); - test_display( - &[0x77, 0xb6], - "cpsid aif" - ); - test_display( - &[0x80, 0xbf], - "hint 0x8" - ); - test_display( - &[0x90, 0xbf], - "hint 0x9" - ); - test_display( - &[0xa0, 0xbf], - "hint 0xa" - ); - test_display( - &[0xb0, 0xbf], - "hint 0xb" - ); - test_display( - &[0xc0, 0xbf], - "hint 0xc" - ); - test_display( - &[0xd0, 0xbf], - "hint 0xd" - ); - test_display( - &[0xe0, 0xbf], - "hint 0xe" - ); - test_display( - &[0xf0, 0xbf], - "hint 0xf" - ); - test_display( - &[0xfe, 0xde], - "udf 0xfe" - ); -} -#[test] -fn test_decode_mov_cases() { - test_display( - &[0x21, 0x46], - "mov r1, r4" - ); - test_display( - &[0x90, 0x46], - "mov r8, r2" - ); - test_display( - &[0x91, 0x46], - "mov sb, r2" - ); - test_display( - &[0x92, 0x46], - "mov r10, r2" - ); - test_display( - &[0x93, 0x46], - "mov fp, r2" - ); - test_display( - &[0x94, 0x46], - "mov ip, r2" - ); - test_display( - &[0x95, 0x46], - "mov sp, r2" - ); - test_display( - &[0x96, 0x46], - "mov lr, r2" - ); - test_display( - &[0x97, 0x46], - "mov pc, r2" - ); - test_display( - &[0xc0, 0x46], - "mov r8, r8" - ); - test_display( - &[0xc1, 0x46], - "mov sb, r8" - ); - test_display( - &[0xc2, 0x46], - "mov r10, r8" - ); - test_display( - &[0xc3, 0x46], - "mov fp, r8" - ); - test_display( - &[0xc4, 0x46], - "mov ip, r8" - ); - test_display( - &[0xc5, 0x46], - "mov sp, r8" - ); - test_display( - &[0xc6, 0x46], - "mov lr, r8" - ); - test_display( - &[0xc7, 0x46], - "mov pc, r8" - ); - test_display( - &[0xc8, 0x46], - "mov r8, sb" - ); - test_display( - &[0xc9, 0x46], - "mov sb, sb" - ); - test_display( - &[0xca, 0x46], - "mov r10, sb" - ); - test_display( - &[0xcb, 0x46], - "mov fp, sb" - ); - test_display( - &[0xcc, 0x46], - "mov ip, sb" - ); - test_display( - &[0xcd, 0x46], - "mov sp, sb" - ); - test_display( - &[0xce, 0x46], - "mov lr, sb" - ); - test_display( - &[0xcf, 0x46], - "mov pc, sb" - ); - test_display( - &[0xfc, 0x46], - "mov ip, pc" - ); - test_display( - &[0xfd, 0x46], - "mov sp, pc" - ); - test_display( - &[0xfe, 0x46], - "mov lr, pc" - ); - test_display( - &[0xff, 0x46], - "mov pc, pc" - ); -} -#[test] -fn test_decode_op_s_cases() { - test_display( - &[0x00, 0x18], - "adds r0, r0, r0" - ); - test_display( - &[0x00, 0x19], - "adds r0, r0, r4" - ); - test_display( - &[0x00, 0x1c], - "adds r0, r0, 0x0" - ); - test_display( - &[0x00, 0x1d], - "adds r0, r0, 0x4" - ); - test_display( - &[0x00, 0x30], - "adds r0, 0x0" - ); - test_display( - &[0x00, 0x31], - "adds r1, 0x0" - ); - test_display( - &[0x00, 0x32], - "adds r2, 0x0" - ); - test_display( - &[0x00, 0x33], - "adds r3, 0x0" - ); - test_display( - &[0x00, 0x34], - "adds r4, 0x0" - ); - test_display( - &[0x00, 0x35], - "adds r5, 0x0" - ); - test_display( - &[0x00, 0x36], - "adds r6, 0x0" - ); - test_display( - &[0x00, 0x37], - "adds r7, 0x0" - ); - test_display( - &[0x00, 0x40], - "ands r0, r0" - ); - test_display( - &[0x00, 0x43], - "orrs r0, r0" - ); - test_display( - &[0x01, 0x08], - "lsrs r1, r0, 0x20" - ); - test_display( - &[0x01, 0x09], - "lsrs r1, r0, 0x4" - ); - test_display( - &[0x01, 0x0a], - "lsrs r1, r0, 0x8" - ); - test_display( - &[0x01, 0x0b], - "lsrs r1, r0, 0xc" - ); - test_display( - &[0x01, 0x0c], - "lsrs r1, r0, 0x10" - ); - test_display( - &[0x01, 0x0d], - "lsrs r1, r0, 0x14" - ); - test_display( - &[0x01, 0x0e], - "lsrs r1, r0, 0x18" - ); - test_display( - &[0x01, 0x0f], - "lsrs r1, r0, 0x1c" - ); - test_display( - &[0x01, 0x10], - "asrs r1, r0, 0x20" - ); - test_display( - &[0x01, 0x11], - "asrs r1, r0, 0x4" - ); - test_display( - &[0x01, 0x12], - "asrs r1, r0, 0x8" - ); - test_display( - &[0x01, 0x13], - "asrs r1, r0, 0xc" - ); - test_display( - &[0x01, 0x14], - "asrs r1, r0, 0x10" - ); - test_display( - &[0x01, 0x15], - "asrs r1, r0, 0x14" - ); - test_display( - &[0x01, 0x16], - "asrs r1, r0, 0x18" - ); - test_display( - &[0x01, 0x17], - "asrs r1, r0, 0x1c" - ); - test_display( - &[0x01, 0x18], - "adds r1, r0, r0" - ); - test_display( - &[0x01, 0x19], - "adds r1, r0, r4" - ); - test_display( - &[0x01, 0x1c], - "adds r1, r0, 0x0" - ); - test_display( - &[0x01, 0x1d], - "adds r1, r0, 0x4" - ); - test_display( - &[0x01, 0x30], - "adds r0, 0x1" - ); - test_display( - &[0x01, 0x31], - "adds r1, 0x1" - ); - test_display( - &[0x01, 0x32], - "adds r2, 0x1" - ); - test_display( - &[0x01, 0x33], - "adds r3, 0x1" - ); - test_display( - &[0x01, 0x34], - "adds r4, 0x1" - ); - test_display( - &[0x01, 0x35], - "adds r5, 0x1" - ); - test_display( - &[0x01, 0x36], - "adds r6, 0x1" - ); - test_display( - &[0x01, 0x37], - "adds r7, 0x1" - ); - test_display( - &[0x0a, 0x01], - "lsls r2, r1, 0x4" - ); - test_display( - &[0x0a, 0x02], - "lsls r2, r1, 0x8" - ); - test_display( - &[0x0a, 0x03], - "lsls r2, r1, 0xc" - ); - test_display( - &[0x0a, 0x04], - "lsls r2, r1, 0x10" - ); - test_display( - &[0x0a, 0x05], - "lsls r2, r1, 0x14" - ); - test_display( - &[0x0a, 0x06], - "lsls r2, r1, 0x18" - ); - test_display( - &[0x0a, 0x07], - "lsls r2, r1, 0x1c" - ); - test_display( - &[0x13, 0x1a], - "subs r3, r2, r0" - ); - test_display( - &[0x13, 0x1b], - "subs r3, r2, r4" - ); - test_display( - &[0x13, 0x1e], - "subs r3, r2, 0x0" - ); - test_display( - &[0x13, 0x1f], - "subs r3, r2, 0x4" - ); - test_display( - &[0x3d, 0x40], - "ands r5, r7" - ); - test_display( - &[0x3d, 0x43], - "orrs r5, r7" - ); - test_display( - &[0x7d, 0x40], - "eors r5, r7" - ); - test_display( - &[0x7d, 0x41], - "adcs r5, r7" - ); - test_display( - &[0x7d, 0x42], - "rsbs r5, r7, 0x0" - ); - test_display( - &[0x7d, 0x43], - "muls r5, r7, r5" - ); - test_display( - &[0xbd, 0x41], - "sbcs r5, r7" - ); - test_display( - &[0xbd, 0x43], - "bics r5, r7" - ); - test_display( - &[0xd6, 0x41], - "rors r6, r2" - ); - test_display( - &[0xd6, 0x43], - "mvns r6, r2" - ); - test_display( - &[0xfd, 0x20], - "movs r0, 0xfd" - ); - test_display( - &[0xfd, 0x20], - "movs r0, 0xfd" - ); - test_display( - &[0xfd, 0x21], - "movs r1, 0xfd" - ); - test_display( - &[0xfd, 0x21], - "movs r1, 0xfd" - ); - test_display( - &[0xfd, 0x22], - "movs r2, 0xfd" - ); - test_display( - &[0xfd, 0x22], - "movs r2, 0xfd" - ); - test_display( - &[0xfd, 0x23], - "movs r3, 0xfd" - ); - test_display( - &[0xfd, 0x23], - "movs r3, 0xfd" - ); - test_display( - &[0xfd, 0x24], - "movs r4, 0xfd" - ); - test_display( - &[0xfd, 0x24], - "movs r4, 0xfd" - ); - test_display( - &[0xfd, 0x25], - "movs r5, 0xfd" - ); - test_display( - &[0xfd, 0x25], - "movs r5, 0xfd" - ); - test_display( - &[0xfd, 0x26], - "movs r6, 0xfd" - ); - test_display( - &[0xfd, 0x26], - "movs r6, 0xfd" - ); - test_display( - &[0xfd, 0x27], - "movs r7, 0xfd" - ); - test_display( - &[0xfd, 0x27], - "movs r7, 0xfd" - ); - test_display( - &[0xfe, 0x00], - "lsls r6, r7, 0x3" - ); - test_display( - &[0xfe, 0x01], - "lsls r6, r7, 0x7" - ); - test_display( - &[0xfe, 0x02], - "lsls r6, r7, 0xb" - ); - test_display( - &[0xfe, 0x03], - "lsls r6, r7, 0xf" - ); - test_display( - &[0xfe, 0x04], - "lsls r6, r7, 0x13" - ); - test_display( - &[0xfe, 0x05], - "lsls r6, r7, 0x17" - ); - test_display( - &[0xfe, 0x06], - "lsls r6, r7, 0x1b" - ); - test_display( - &[0xfe, 0x07], - "lsls r6, r7, 0x1f" - ); - test_display( - &[0xfe, 0x08], - "lsrs r6, r7, 0x3" - ); - test_display( - &[0xfe, 0x09], - "lsrs r6, r7, 0x7" - ); - test_display( - &[0xfe, 0x0a], - "lsrs r6, r7, 0xb" - ); - test_display( - &[0xfe, 0x0b], - "lsrs r6, r7, 0xf" - ); - test_display( - &[0xfe, 0x0c], - "lsrs r6, r7, 0x13" - ); - test_display( - &[0xfe, 0x0d], - "lsrs r6, r7, 0x17" - ); - test_display( - &[0xfe, 0x0e], - "lsrs r6, r7, 0x1b" - ); - test_display( - &[0xfe, 0x0f], - "lsrs r6, r7, 0x1f" - ); - test_display( - &[0xfe, 0x10], - "asrs r6, r7, 0x3" - ); - test_display( - &[0xfe, 0x11], - "asrs r6, r7, 0x7" - ); - test_display( - &[0xfe, 0x12], - "asrs r6, r7, 0xb" - ); - test_display( - &[0xfe, 0x13], - "asrs r6, r7, 0xf" - ); - test_display( - &[0xfe, 0x14], - "asrs r6, r7, 0x13" - ); - test_display( - &[0xfe, 0x15], - "asrs r6, r7, 0x17" - ); - test_display( - &[0xfe, 0x16], - "asrs r6, r7, 0x1b" - ); - test_display( - &[0xfe, 0x17], - "asrs r6, r7, 0x1f" - ); - test_display( - &[0xfe, 0x40], - "lsrs r6, r7" - ); - test_display( - &[0xfe, 0x41], - "rors r6, r7" - ); - test_display( - &[0xfe, 0x43], - "mvns r6, r7" - ); - test_display( - &[0xff, 0x18], - "adds r7, r7, r3" - ); - test_display( - &[0xff, 0x19], - "adds r7, r7, r7" - ); - test_display( - &[0xff, 0x1c], - "adds r7, r7, 0x3" - ); - test_display( - &[0xff, 0x1d], - "adds r7, r7, 0x7" - ); - test_display( - &[0xff, 0x30], - "adds r0, 0xff" - ); - test_display( - &[0xff, 0x31], - "adds r1, 0xff" - ); - test_display( - &[0xff, 0x32], - "adds r2, 0xff" - ); - test_display( - &[0xff, 0x33], - "adds r3, 0xff" - ); - test_display( - &[0xff, 0x34], - "adds r4, 0xff" - ); - test_display( - &[0xff, 0x35], - "adds r5, 0xff" - ); - test_display( - &[0xff, 0x36], - "adds r6, 0xff" - ); - test_display( - &[0xff, 0x37], - "adds r7, 0xff" - ); -} -#[test] -fn test_decode_pop_cases() { - test_display( - &[0x00, 0xbd], - "pop {pc}" - ); - test_display( - &[0x01, 0xbc], - "pop {r0}" - ); - test_display( - &[0x7f, 0xbd], - "pop {r0, r1, r2, r3, r4, r5, r6, pc}" - ); - test_display( - &[0xff, 0xbd], - "pop {r0, r1, r2, r3, r4, r5, r6, r7, pc}" - ); -} -#[test] -fn test_decode_push_cases() { - test_display( - &[0x00, 0xb5], - "push {lr}" - ); - test_display( - &[0x01, 0xb4], - "push {r0}" - ); - test_display( - &[0xff, 0xb5], - "push {r0, r1, r2, r3, r4, r5, r6, r7, lr}" - ); -} -#[test] -fn test_decode_rev_cases() { - test_display( - &[0x0a, 0xba], - "rev r2, r1" - ); - test_display( - &[0x4a, 0xba], - "rev16 r2, r1" - ); - test_display( - &[0xca, 0xba], - "revsh r2, r1" - ); -} -#[test] -fn test_decode_stm_16b_cases() { - test_display( - &[0x01, 0xc0], - "stmia r0!, {r0}" - ); - test_display( - &[0x01, 0xc1], - "stmia r1!, {r0}" - ); - test_display( - &[0x01, 0xc2], - "stmia r2!, {r0}" - ); - test_display( - &[0x01, 0xc3], - "stmia r3!, {r0}" - ); - test_display( - &[0x01, 0xc4], - "stmia r4!, {r0}" - ); - test_display( - &[0x01, 0xc5], - "stmia r5!, {r0}" - ); - test_display( - &[0x01, 0xc6], - "stmia r6!, {r0}" - ); - test_display( - &[0x01, 0xc7], - "stmia r7!, {r0}" - ); - test_display( - &[0xff, 0xc3], - "stmia r3!, {r0, r1, r2, r3, r4, r5, r6, r7}" - ); -} -#[test] -fn test_decode_str_16b_cases() { - test_display( - &[0x00, 0x50], - "str r0, [r0, r0]" - ); - test_display( - &[0x00, 0x51], - "str r0, [r0, r4]" - ); - test_display( - &[0x00, 0x52], - "strh r0, [r0, r0]" - ); - test_display( - &[0x00, 0x53], - "strh r0, [r0, r4]" - ); - test_display( - &[0x00, 0x54], - "strb r0, [r0, r0]" - ); - test_display( - &[0x00, 0x55], - "strb r0, [r0, r4]" - ); - test_display( - &[0xfe, 0x60], - "str r6, [r7, 0xc]" - ); - test_display( - &[0xfe, 0x61], - "str r6, [r7, 0x1c]" - ); - test_display( - &[0xfe, 0x62], - "str r6, [r7, 0x2c]" - ); - test_display( - &[0xfe, 0x63], - "str r6, [r7, 0x3c]" - ); - test_display( - &[0xfe, 0x64], - "str r6, [r7, 0x4c]" - ); - test_display( - &[0xfe, 0x65], - "str r6, [r7, 0x5c]" - ); - test_display( - &[0xfe, 0x66], - "str r6, [r7, 0x6c]" - ); - test_display( - &[0xfe, 0x67], - "str r6, [r7, 0x7c]" - ); - test_display( - &[0xfe, 0x70], - "strb r6, [r7, 0x3]" - ); - test_display( - &[0xfe, 0x71], - "strb r6, [r7, 0x7]" - ); - test_display( - &[0xfe, 0x72], - "strb r6, [r7, 0xb]" - ); - test_display( - &[0xfe, 0x73], - "strb r6, [r7, 0xf]" - ); - test_display( - &[0xfe, 0x74], - "strb r6, [r7, 0x13]" - ); - test_display( - &[0xfe, 0x75], - "strb r6, [r7, 0x17]" - ); - test_display( - &[0xfe, 0x76], - "strb r6, [r7, 0x1b]" - ); - test_display( - &[0xfe, 0x77], - "strb r6, [r7, 0x1f]" - ); - test_display( - &[0xfe, 0x80], - "strh r6, [r7, 0x6]" - ); - test_display( - &[0xfe, 0x81], - "strh r6, [r7, 0xe]" - ); - test_display( - &[0xfe, 0x82], - "strh r6, [r7, 0x16]" - ); - test_display( - &[0xfe, 0x83], - "strh r6, [r7, 0x1e]" - ); - test_display( - &[0xfe, 0x84], - "strh r6, [r7, 0x26]" - ); - test_display( - &[0xfe, 0x85], - "strh r6, [r7, 0x2e]" - ); - test_display( - &[0xfe, 0x86], - "strh r6, [r7, 0x36]" - ); - test_display( - &[0xfe, 0x87], - "strh r6, [r7, 0x3e]" - ); - test_display( - &[0xfe, 0x90], - "str r0, [sp, 0x3f8]" - ); - test_display( - &[0xfe, 0x91], - "str r1, [sp, 0x3f8]" - ); - test_display( - &[0xfe, 0x92], - "str r2, [sp, 0x3f8]" - ); - test_display( - &[0xfe, 0x93], - "str r3, [sp, 0x3f8]" - ); - test_display( - &[0xfe, 0x94], - "str r4, [sp, 0x3f8]" - ); - test_display( - &[0xfe, 0x95], - "str r5, [sp, 0x3f8]" - ); - test_display( - &[0xfe, 0x96], - "str r6, [sp, 0x3f8]" - ); - test_display( - &[0xfe, 0x97], - "str r7, [sp, 0x3f8]" - ); - test_display( - &[0xff, 0x50], - "str r7, [r7, r3]" - ); - test_display( - &[0xff, 0x90], - "str r0, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x91], - "str r1, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x92], - "str r2, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x93], - "str r3, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x94], - "str r4, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x95], - "str r5, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x96], - "str r6, [sp, 0x3fc]" - ); - test_display( - &[0xff, 0x97], - "str r7, [sp, 0x3fc]" - ); -} -#[test] -fn test_decode_sub_cases() { - test_display( - &[0xd8, 0xb0], - "sub sp, sp, 0x160" - ); -} -#[test] -fn test_decode_svc_cases() { - test_display( - &[0x27, 0xdf], - "svc 0x27" - ); - test_display( - &[0xad, 0xdf], - "svc 0xad" - ); -} -#[test] -fn test_decode_udf_cases() { - test_display( - &[0x27, 0xde], - "udf 0x27" - ); - test_display( - &[0xad, 0xde], - "udf 0xad" - ); -} -#[test] -fn test_decode_ux_sx_cases() { - test_display( - &[0x0a, 0xb2], - "sxth r2, r1" - ); - test_display( - &[0x4a, 0xb2], - "sxtb r2, r1" - ); - test_display( - &[0x8a, 0xb2], - "uxth r2, r1" - ); - test_display( - &[0xca, 0xb2], - "uxtb r2, r1" - ); -} - -#[test] -fn test_decode_ldr_32b_cases() { - test_display( - &[0x73, 0xe8, 0x7e, 0x5a], - "ldrd r5, r10, [r3], -0x1f8" - ); - test_display( - &[0x93, 0xf8, 0x7e, 0x5a], - "ldrb.w r5, [r3, 0xa7e]" - ); - test_display( - &[0xb3, 0xf8, 0x7e, 0x5a], - "ldrh.w r5, [r3, 0xa7e]" - ); - test_display( - &[0xd3, 0xf8, 0x7e, 0x5a], - "ldr.w r5, [r3, 0xa7e]" - ); - test_display( - &[0xf3, 0xe8, 0x7e, 0x5a], - "ldrd r5, r10, [r3], 0x1f8" - ); - test_display( - &[0x53, 0xe9, 0x7e, 0x5a], - "ldrd r5, r10, [r3, -0x1f8]" - ); - test_display( - &[0x73, 0xe9, 0x7e, 0x5a], - "ldrd r5, r10, [r3, -0x1f8]!" - ); - test_display( - &[0x93, 0xf9, 0x7e, 0x5a], - "ldrsb.w r5, [r3, 0xa7e]" - ); - test_display( - &[0xb3, 0xf9, 0x7e, 0x5a], - "ldrsh.w r5, [r3, 0xa7e]" - ); - test_display( - &[0xd3, 0xe9, 0x7e, 0x5a], - "ldrd r5, r10, [r3, 0x1f8]" - ); - test_display( - &[0xf3, 0xe9, 0x7e, 0x5a], - "ldrd r5, r10, [r3, 0x1f8]!" - ); -} - -#[test] -fn test_decode_coproc_ld_32b_cases() { - test_display( - &[0x33, 0xfc, 0x7e, 0x54], - "ldc2 p4, c5, [r3], -0x1f8" - ); - test_display( - &[0x73, 0xfc, 0x7e, 0x54], - "ldc2l p4, c5, [r3], -0x1f8" - ); - test_display( - &[0x93, 0xfc, 0x7e, 0x54], - "ldc2 p4, c5, [r3], {0x7e}" - ); - test_display( - &[0xb3, 0xfc, 0x7e, 0x54], - "ldc2 p4, c5, [r3], 0x1f8" - ); - test_display( - &[0xd3, 0xfc, 0x7e, 0x54], - "ldc2l p4, c5, [r3], {0x7e}" - ); - test_display( - &[0xf3, 0xfc, 0x7e, 0x54], - "ldc2l p4, c5, [r3], 0x1f8" - ); - test_display( - &[0x13, 0xfd, 0x7e, 0x54], - "ldc2 p4, c5, [r3, -0x1f8]" - ); - test_display( - &[0x33, 0xfd, 0x7e, 0x54], - "ldc2 p4, c5, [r3, -0x1f8]!" - ); - test_display( - &[0x53, 0xfd, 0x7e, 0x54], - "ldc2l p4, c5, [r3, -0x1f8]" - ); - test_display( - &[0x73, 0xfd, 0x7e, 0x54], - "ldc2l p4, c5, [r3, -0x1f8]!" - ); - test_display( - &[0x93, 0xfd, 0x7e, 0x54], - "ldc2 p4, c5, [r3, 0x1f8]" - ); - test_display( - &[0xb3, 0xfd, 0x7e, 0x54], - "ldc2 p4, c5, [r3, 0x1f8]!" - ); - test_display( - &[0xd3, 0xfd, 0x7e, 0x54], - "ldc2l p4, c5, [r3, 0x1f8]" - ); - test_display( - &[0xf3, 0xfd, 0x7e, 0x54], - "ldc2l p4, c5, [r3, 0x1f8]!" - ); -} -#[test] -fn test_decode_str_32b_cases() { - test_display( - &[0x43, 0xe8, 0x7e, 0x5a], - "strex r10, r5, [r3, 0x1f8]" - ); - test_display( - &[0x63, 0xe8, 0x7e, 0x5a], - "strd r5, r10, [r3], -0x1f8" - ); - test_display( - &[0x83, 0xf8, 0x7e, 0x5a], - "strb.w r5, [r3, 0xa7e]" - ); - test_display( - &[0xa3, 0xf8, 0x7e, 0x5a], - "strh.w r5, [r3, 0xa7e]" - ); - test_display( - &[0xc3, 0xe8, 0x7e, 0x5a], - "strexd lr, r5, r10, [r3]" - ); - test_display( - &[0xc3, 0xf8, 0x7e, 0x5a], - "str.w r5, [r3, 0xa7e]" - ); - test_display( - &[0xe3, 0xe8, 0x7e, 0x5a], - "strd r5, r10, [r3], 0x1f8" - ); - test_display( - &[0x43, 0xe9, 0x7e, 0x5a], - "strd r5, r10, [r3, -0x1f8]" - ); - test_display( - &[0x63, 0xe9, 0x7e, 0x5a], - "strd r5, r10, [r3, -0x1f8]!" - ); - test_display( - &[0xc3, 0xe9, 0x7e, 0x5a], - "strd r5, r10, [r3, 0x1f8]" - ); - test_display( - &[0xe3, 0xe9, 0x7e, 0x5a], - "strd r5, r10, [r3, 0x1f8]!" - ); - test_display( - &[0x41, 0xf8, 0x04, 0x2b], - "str.w r2, [r1], 0x4" - ); - test_display( - &[0x41, 0xf8, 0x00, 0x2b], - "str.w r2, [r1]" - ); -} - -#[test] -fn test_decode_coproc_st_32b_cases() { - test_display( - &[0x23, 0xfc, 0x7e, 0x54], - "stc2 p4, c5, [r3], -0x1f8" - ); - test_display( - &[0x63, 0xfc, 0x7e, 0x54], - "stc2l p4, c5, [r3], -0x1f8" - ); - test_display( - &[0x83, 0xfc, 0x7e, 0x54], - "stc2 p4, c5, [r3], {0x7e}" - ); - test_display( - &[0xa3, 0xfc, 0x7e, 0x54], - "stc2 p4, c5, [r3], 0x1f8" - ); - test_display( - &[0xc3, 0xfc, 0x7e, 0x54], - "stc2l p4, c5, [r3], {0x7e}" - ); - test_display( - &[0xe3, 0xfc, 0x7e, 0x54], - "stc2l p4, c5, [r3], 0x1f8" - ); - test_display( - &[0x03, 0xfd, 0x7e, 0x54], - "stc2 p4, c5, [r3, -0x1f8]" - ); - test_display( - &[0x23, 0xfd, 0x7e, 0x54], - "stc2 p4, c5, [r3, -0x1f8]!" - ); - test_display( - &[0x43, 0xfd, 0x7e, 0x54], - "stc2l p4, c5, [r3, -0x1f8]" - ); - test_display( - &[0x63, 0xfd, 0x7e, 0x54], - "stc2l p4, c5, [r3, -0x1f8]!" - ); - test_display( - &[0x83, 0xfd, 0x7e, 0x54], - "stc2 p4, c5, [r3, 0x1f8]" - ); - test_display( - &[0xa3, 0xfd, 0x7e, 0x54], - "stc2 p4, c5, [r3, 0x1f8]!" - ); - test_display( - &[0xc3, 0xfd, 0x7e, 0x54], - "stc2l p4, c5, [r3, 0x1f8]" - ); - test_display( - &[0xe3, 0xfd, 0x7e, 0x54], - "stc2l p4, c5, [r3, 0x1f8]!" - ); -} -#[test] -fn test_decode_stm_ldm_32b_cases() { - test_display( - &[0x83, 0xe8, 0x7e, 0x5a], - "stm.w r3, {r1, r2, r3, r4, r5, r6, sb, fp, ip, lr}" - ); - test_display( - &[0xa3, 0xe8, 0x7e, 0x5a], - "stm.w r3!, {r1, r2, r3, r4, r5, r6, sb, fp, ip, lr}" - ); - test_display( - &[0x03, 0xe9, 0x7e, 0x5a], - "stmdb r3, {r1, r2, r3, r4, r5, r6, sb, fp, ip, lr}" - ); - test_display( - &[0x23, 0xe9, 0x7e, 0x5a], - "stmdb r3!, {r1, r2, r3, r4, r5, r6, sb, fp, ip, lr}" - ); - - test_display( - &[0x93, 0xe8, 0x7e, 0x5a], - "ldm.w r3, {r1, r2, r3, r4, r5, r6, sb, fp, ip, lr}" - ); - test_display( - &[0xb3, 0xe8, 0x7e, 0x5a], - "ldm.w r3!, {r1, r2, r3, r4, r5, r6, sb, fp, ip, lr}" - ); - test_display( - &[0x13, 0xe9, 0x7e, 0x5a], - "ldmdb r3, {r1, r2, r3, r4, r5, r6, sb, fp, ip, lr}" - ); - test_display( - &[0x33, 0xe9, 0x7e, 0x5a], - "ldmdb r3!, {r1, r2, r3, r4, r5, r6, sb, fp, ip, lr}" - ); -} -#[test] -fn test_decode_sat_ext_32b_cases() { - test_display( - &[0x43, 0xf3, 0x7e, 0x5a], - "sbfx r10, r3, 0x15, 0x1f" - ); - test_display( - &[0xc3, 0xf3, 0x7e, 0x5a], - "ubfx r10, r3, 0x15, 0x1f" - ); - test_display( - &[0x43, 0xf7, 0x7e, 0x5a], - "sbfx r10, r3, 0x15, 0x1f" - ); - test_display( - &[0xc3, 0xf7, 0x7e, 0x5a], - "ubfx r10, r3, 0x15, 0x1f" - ); - - test_display( - &[0x83, 0xf3, 0x7e, 0x5a], - "usat r10, 0x1e, r3, lsl 21" - ); - test_display( - &[0xa3, 0xf3, 0x7e, 0x5a], - "usat r10, 0x1e, r3, asr 21" - ); - test_display( - &[0x83, 0xf7, 0x7e, 0x5a], - "usat r10, 0x1e, r3, lsl 21" - ); - test_display( - &[0xa3, 0xf7, 0x7e, 0x5a], - "usat r10, 0x1e, r3, asr 21" - ); -} -#[test] -fn test_decode_bitwise_32b_cases() { - test_display( - &[0x23, 0xf0, 0x7e, 0x5a], - "bic r10, r3, 0x3f800000" - ); - test_display( - &[0x33, 0xf0, 0x7e, 0x5a], - "bics r10, r3, 0x3f800000" - ); - test_display( - &[0x23, 0xea, 0x7e, 0x5a], - "bic.w r10, r3, lr, ror 21" - ); - test_display( - &[0x33, 0xea, 0x7e, 0x5a], - "bics.w r10, r3, lr, ror 21" - ); - test_display( - &[0x23, 0xf4, 0x7e, 0x5a], - "bic r10, r3, 0x3f80" - ); - test_display( - &[0x33, 0xf4, 0x7e, 0x5a], - "bics r10, r3, 0x3f80" - ); - - test_display( - &[0x03, 0xf0, 0x7e, 0x5a], - "and r10, r3, 0x3f800000" - ); - test_display( - &[0x13, 0xf0, 0x7e, 0x5a], - "ands r10, r3, 0x3f800000" - ); - test_display( - &[0x03, 0xea, 0x7e, 0x5a], - "and.w r10, r3, lr, ror 21" - ); - test_display( - &[0x13, 0xea, 0x7e, 0x5a], - "ands.w r10, r3, lr, ror 21" - ); - test_display( - &[0x03, 0xf4, 0x7e, 0x5a], - "and r10, r3, 0x3f80" - ); - test_display( - &[0x13, 0xf4, 0x7e, 0x5a], - "ands r10, r3, 0x3f80" - ); - - test_display( - &[0x43, 0xf0, 0x7e, 0x5a], - "orr r10, r3, 0x3f800000" - ); - test_display( - &[0x53, 0xf0, 0x7e, 0x5a], - "orrs r10, r3, 0x3f800000" - ); - test_display( - &[0x43, 0xea, 0x7e, 0x5a], - "orr.w r10, r3, lr, ror 21" - ); - test_display( - &[0x53, 0xea, 0x7e, 0x5a], - "orrs.w r10, r3, lr, ror 21" - ); - test_display( - &[0x43, 0xf4, 0x7e, 0x5a], - "orr r10, r3, 0x3f80" - ); - test_display( - &[0x53, 0xf4, 0x7e, 0x5a], - "orrs r10, r3, 0x3f80" - ); - - test_display( - &[0x83, 0xf0, 0x7e, 0x5a], - "eor r10, r3, 0x3f800000" - ); - test_display( - &[0x93, 0xf0, 0x7e, 0x5a], - "eors r10, r3, 0x3f800000" - ); - test_display( - &[0x83, 0xea, 0x7e, 0x5a], - "eor.w r10, r3, lr, ror 21" - ); - test_display( - &[0x93, 0xea, 0x7e, 0x5a], - "eors.w r10, r3, lr, ror 21" - ); - test_display( - &[0x83, 0xf4, 0x7e, 0x5a], - "eor r10, r3, 0x3f80" - ); - test_display( - &[0x93, 0xf4, 0x7e, 0x5a], - "eors r10, r3, 0x3f80" - ); - - test_display( - &[0x63, 0xf0, 0x7e, 0x5a], - "orn r10, r3, 0x3f800000" - ); - test_display( - &[0x73, 0xf0, 0x7e, 0x5a], - "orns r10, r3, 0x3f800000" - ); - test_display( - &[0x63, 0xea, 0x7e, 0x5a], - "orn r10, r3, lr, ror 21" - ); - test_display( - &[0x73, 0xea, 0x7e, 0x5a], - "orns r10, r3, lr, ror 21" - ); - test_display( - &[0x63, 0xf4, 0x7e, 0x5a], - "orn r10, r3, 0x3f80" - ); - test_display( - &[0x73, 0xf4, 0x7e, 0x5a], - "orns r10, r3, 0x3f80" - ); -} -#[test] -fn test_decode_arithmetic_32b_cases() { - test_display( - &[0xa3, 0xf1, 0x7e, 0x5a], - "sub.w r10, r3, 0x3f800000" - ); - test_display( - &[0xb3, 0xf1, 0x7e, 0x5a], - "subs.w r10, r3, 0x3f800000" - ); - test_display( - &[0xa3, 0xf2, 0x7e, 0x5a], - "sub.w r10, r3, 0x57e" - ); - test_display( - &[0xa3, 0xeb, 0x7e, 0x5a], - "sub.w r10, r3, lr, ror 21" - ); - test_display( - &[0xb3, 0xeb, 0x7e, 0x5a], - "subs.w r10, r3, lr, ror 21" - ); - test_display( - &[0xa3, 0xf6, 0x7e, 0x5a], - "sub.w r10, r3, 0xd7e" - ); - test_display( - &[0xa3, 0xf5, 0x7e, 0x5a], - "sub.w r10, r3, 0x3f80" - ); - test_display( - &[0xb3, 0xf5, 0x7e, 0x5a], - "subs.w r10, r3, 0x3f80" - ); - - test_display( - &[0x03, 0xf1, 0x7e, 0x5a], - "add.w r10, r3, 0x3f800000" - ); - test_display( - &[0x13, 0xf1, 0x7e, 0x5a], - "adds.w r10, r3, 0x3f800000" - ); - test_display( - &[0x03, 0xf2, 0x7e, 0x5a], - "add.w r10, r3, 0x57e" - ); - test_display( - &[0x03, 0xeb, 0x7e, 0x5a], - "add.w r10, r3, lr, ror 21" - ); - test_display( - &[0x13, 0xeb, 0x7e, 0x5a], - "adds.w r10, r3, lr, ror 21" - ); - test_display( - &[0x03, 0xf5, 0x7e, 0x5a], - "add.w r10, r3, 0x3f80" - ); - test_display( - &[0x13, 0xf5, 0x7e, 0x5a], - "adds.w r10, r3, 0x3f80" - ); - test_display( - &[0x03, 0xf6, 0x7e, 0x5a], - "add.w r10, r3, 0xd7e" - ); - - test_display( - &[0x43, 0xf1, 0x7e, 0x5a], - "adc r10, r3, 0x3f800000" - ); - test_display( - &[0x53, 0xf1, 0x7e, 0x5a], - "adcs r10, r3, 0x3f800000" - ); - test_display( - &[0x43, 0xeb, 0x7e, 0x5a], - "adc.w r10, r3, lr, ror 21" - ); - test_display( - &[0x53, 0xeb, 0x7e, 0x5a], - "adcs.w r10, r3, lr, ror 21" - ); - test_display( - &[0x43, 0xf5, 0x7e, 0x5a], - "adc r10, r3, 0x3f80" - ); - test_display( - &[0x53, 0xf5, 0x7e, 0x5a], - "adcs r10, r3, 0x3f80" - ); - - test_display( - &[0x63, 0xf1, 0x7e, 0x5a], - "sbc r10, r3, 0x3f800000" - ); - test_display( - &[0x73, 0xf1, 0x7e, 0x5a], - "sbcs r10, r3, 0x3f800000" - ); - test_display( - &[0x63, 0xeb, 0x7e, 0x5a], - "sbc.w r10, r3, lr, ror 21" - ); - test_display( - &[0x73, 0xeb, 0x7e, 0x5a], - "sbcs.w r10, r3, lr, ror 21" - ); - test_display( - &[0x63, 0xf5, 0x7e, 0x5a], - "sbc r10, r3, 0x3f80" - ); - test_display( - &[0x73, 0xf5, 0x7e, 0x5a], - "sbcs r10, r3, 0x3f80" - ); - - test_display( - &[0xc3, 0xf1, 0x7e, 0x5a], - "rsb.w r10, r3, 0x3f800000" - ); - test_display( - &[0xd3, 0xf1, 0x7e, 0x5a], - "rsbs.w r10, r3, 0x3f800000" - ); - test_display( - &[0xc3, 0xeb, 0x7e, 0x5a], - "rsb r10, r3, lr, ror 21" - ); - test_display( - &[0xd3, 0xeb, 0x7e, 0x5a], - "rsbs r10, r3, lr, ror 21" - ); - test_display( - &[0xc3, 0xf5, 0x7e, 0x5a], - "rsb.w r10, r3, 0x3f80" - ); - test_display( - &[0xd3, 0xf5, 0x7e, 0x5a], - "rsbs.w r10, r3, 0x3f80" - ); -} -#[ignore] -#[test] -fn test_decode_simd_32b_cases() { - test_display( - &[0x13, 0xed, 0x7e, 0x5a], - "vldr s10, [r3, -0x1f8]" - ); - test_display( - &[0x53, 0xed, 0x7e, 0x5a], - "vldr s11, [r3, -0x1f8]" - ); - test_display( - &[0x93, 0xed, 0x7e, 0x5a], - "vldr s10, [r3, 0x1f8]" - ); - test_display( - &[0xd3, 0xed, 0x7e, 0x5a], - "vldr s11, [r3, 0x1f8]" - ); - - test_display( - &[0x03, 0xed, 0x7e, 0x5a], - "vstr s10, [r3, -0x1f8]" - ); - test_display( - &[0x43, 0xed, 0x7e, 0x5a], - "vstr s11, [r3, -0x1f8]" - ); - test_display( - &[0x83, 0xed, 0x7e, 0x5a], - "vstr s10, [r3, 0x1f8]" - ); - test_display( - &[0xc3, 0xed, 0x7e, 0x5a], - "vstr s11, [r3, 0x1f8]" - ); - - test_display( - &[0x93, 0xec, 0x7e, 0x5a], - "vldmia r3, {s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0xb3, 0xec, 0x7e, 0x5a], - "vldmia r3!, {s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0xd3, 0xec, 0x7e, 0x5a], - "vldmia r3, {s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0xf3, 0xec, 0x7e, 0x5a], - "vldmia r3!, {s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0x33, 0xed, 0x7e, 0x5a], - "vldmdb r3!, {s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0x73, 0xed, 0x7e, 0x5a], - "vldmdb r3!, {s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - - test_display( - &[0x83, 0xec, 0x7e, 0x5a], - "vstmia r3, {s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0xa3, 0xec, 0x7e, 0x5a], - "vstmia r3!, {s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0xc3, 0xec, 0x7e, 0x5a], - "vstmia r3, {s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0xe3, 0xec, 0x7e, 0x5a], - "vstmia r3!, {s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0x23, 0xed, 0x7e, 0x5a], - "vstmdb r3!, {s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); - test_display( - &[0x63, 0xed, 0x7e, 0x5a], - "vstmdb r3!, {s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31}" - ); -} diff --git a/test/armv8/a64.rs b/test/armv8/a64.rs deleted file mode 100644 index cdb1265..0000000 --- a/test/armv8/a64.rs +++ /dev/null @@ -1,4879 +0,0 @@ -use yaxpeax_arch::{Arch, Decoder}; -use yaxpeax_arm::armv8::a64::{ARMv8, Instruction, Operand, Opcode, SizeCode, ShiftStyle}; -use yaxpeax_arm::armv8::a64::DecodeError; - -use std::fmt; - -fn test_decode(data: [u8; 4], expected: Instruction) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - let instr = ::Decoder::default().decode(&mut reader).unwrap(); - assert!( - instr == expected, - "decode error for {:02x}{:02x}{:02x}{:02x}:\n decoded: {:?}\n expected: {:?}\n", - data[0], data[1], data[2], data[3], - instr, expected - ); -} - -fn test_err(data: [u8; 4], err: DecodeError) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - let result = ::Decoder::default().decode(&mut reader); - assert_eq!( - result, Err(err), - "expected IncompleteDecoder error for {:02x}{:02x}{:02x}{:02x}:\n decoded: {:?}\n", - data[0], data[1], data[2], data[3], - result, - ); -} - -fn test_display(data: [u8; 4], expected: &'static str) { - let mut reader = yaxpeax_arch::U8Reader::new(&data[..]); - let instr = ::Decoder::default().decode(&mut reader).unwrap(); - let text = format!("{}", instr); - assert!( - text == expected, - "display error for {:02x}{:02x}{:02x}{:02x}:\n decoded: {:?}\n displayed: {}\n expected: {}\n", - data[0], data[1], data[2], data[3], - instr, - text, expected - ); -} - -#[test] -fn test_neon() { - test_display([0x00, 0x01, 0x27, 0x1e], "fmov s0, w8"); - test_display([0xe0, 0x03, 0x13, 0xaa], "mov x0, x19"); -} - -#[test] -fn test_sve() { - test_err([0x00, 0x00, 0x00, 0x04], DecodeError::IncompleteDecoder); -} - -#[test] -fn test_unpredictable() { - // could be stx/ldx but Lo1 is `x1` and invalid. - test_err([0x00, 0x00, 0x20, 0x08], DecodeError::InvalidOperand); - test_err([0x00, 0xfc, 0x00, 0x12], DecodeError::InvalidOperand); -} - -#[test] -fn test_display_misc() { - test_display( - [0xc0, 0x03, 0x5f, 0xd6], - "ret" - ); - test_display( - [0x1f, 0x20, 0x03, 0xd5], - "esb" - ); -} - -#[test] -fn test_decode_str_ldr() { - test_decode( - [0x31, 0x03, 0x40, 0xf9], - Instruction { - opcode: Opcode::LDR, - operands: [ - Operand::Register(SizeCode::X, 17), - Operand::RegPreIndex(25, 0, false), - Operand::Nothing, - Operand::Nothing, - ] - } - ); - test_decode( - [0xf5, 0x5b, 0x00, 0xf9], - Instruction { - opcode: Opcode::STR, - operands: [ - Operand::Register(SizeCode::X, 21), - Operand::RegPreIndex(31, 0xb0, false), - Operand::Nothing, - Operand::Nothing, - ] - } - ); - test_decode( - [0x60, 0x02, 0x0a, 0x39], - Instruction { - opcode: Opcode::STRB, - operands: [ - Operand::Register(SizeCode::W, 0), - Operand::RegPreIndex(19, 0x280, false), - Operand::Nothing, - Operand::Nothing, - ] - } - ); - test_decode( - [0xfd, 0x7b, 0xbe, 0xa9], - Instruction { - opcode: Opcode::STP, - operands: [ - Operand::Register(SizeCode::X, 29), - Operand::Register(SizeCode::X, 30), - Operand::RegPreIndex(31, -0x20, true), - Operand::Nothing, - ] - } - ); -} - -#[test] -fn test_decode_misc() { - test_decode( - [0x22, 0x39, 0x04, 0xb0], - Instruction { - opcode: Opcode::ADRP, - operands: [ - Operand::Register(SizeCode::X, 2), - Operand::PCOffset(0x8725000), - Operand::Nothing, - Operand::Nothing - ] - } - ); - test_display( - [0x1d, 0x00, 0x80, 0xd2], - "mov x29, #0x0" - ); - test_display( - [0x13, 0x00, 0x80, 0xd2], - "mov x19, #0x0" - ); - test_display( - [0x1d, 0xff, 0xff, 0xd2], - "mov x29, #0xfff8000000000000" - ); - test_display( - [0x22, 0x39, 0x04, 0xb0], - "adrp x2, $+0x8725000" - ); -} - -#[ignore] -#[test] -fn test_display_ldr() { - test_display( - [0xff, 0xff, 0x00, 0x1c], - "ldr s31, $+0x1ffc" - ); - test_display( - [0xff, 0xff, 0x00, 0x5c], - "ldr d31, $+0x1ffc" - ); - test_display( - [0xff, 0xff, 0x00, 0x9c], - "ldr q31, $+0x1ffc" - ); - test_display( - [0xff, 0xff, 0x00, 0xdc], - "invalid" - ); - test_display( - [0x88, 0xff, 0x00, 0x18], - "ldr w8, $+0x1ff0" - ); - test_display( - [0x88, 0xff, 0x00, 0x58], - "ldr x8, $+0x1ff0" - ); - test_display( - [0x88, 0xff, 0x00, 0x98], - "ldrsw x8, $+0x1ff0" - ); - test_display( - [0x88, 0xff, 0x00, 0xd8], - "prfm plil1keep, #0x1ff0" - ); -} - -#[test] -fn test_decode_mov() { - test_decode( - [0x20, 0x00, 0x80, 0x52], - Instruction { - opcode: Opcode::MOVZ, - operands: [ - Operand::Register(SizeCode::W, 0), - Operand::ImmShift(1, 0), - Operand::Nothing, - Operand::Nothing - ] - } - ); -} - -#[test] -fn test_decode_branch() { - test_decode( - [0x41, 0x00, 0x00, 0xb4], - Instruction { - opcode: Opcode::CBZ, - operands: [ - Operand::Register(SizeCode::X, 1), - Operand::PCOffset(8), - Operand::Nothing, - Operand::Nothing - ] - } - ); - test_decode( - [0x62, 0x00, 0x00, 0xb4], - Instruction { - opcode: Opcode::CBZ, - operands: [ - Operand::Register(SizeCode::X, 2), - Operand::PCOffset(12), - Operand::Nothing, - Operand::Nothing - ] - } - ); - test_decode( - [0x40, 0x00, 0x1f, 0xd6], - Instruction { - opcode: Opcode::BR, - operands: [ - Operand::Register(SizeCode::X, 2), - Operand::Nothing, - Operand::Nothing, - Operand::Nothing - ] - } - ); -} - -#[test] -fn test_decode_arithmetic() { - test_decode( - [0x21, 0xfc, 0x41, 0x8b], - Instruction { - opcode: Opcode::ADD, - operands: [ - Operand::Register(SizeCode::X, 1), - Operand::Register(SizeCode::X, 1), - Operand::RegShift(ShiftStyle::LSR, 63, SizeCode::X, 1), - Operand::Nothing - ] - } - ); - test_decode( - [0x21, 0xfc, 0x43, 0x93], - Instruction { - opcode: Opcode::SBFM, - operands: [ - Operand::Register(SizeCode::X, 1), - Operand::Register(SizeCode::X, 1), - Operand::Immediate(3), - Operand::Immediate(63) - ] - } - ); - test_decode( - [0x3f, 0x38, 0x00, 0xf1], - Instruction { - opcode: Opcode::SUBS, - operands: [ - Operand::Register(SizeCode::X, 31), - Operand::RegisterOrSP(SizeCode::X, 1), - Operand::Immediate(0xe), - Operand::Nothing, - ] - } - ); -} - -#[test] -fn test_decode_mul() { -} - -#[test] -fn test_decode_ccm() { - test_display([0x00, 0xa8, 0x42, 0x3a], "ccmn w0, #0x2, #0x0, ge"); - test_display([0x00, 0xa8, 0x42, 0xfa], "ccmp x0, #0x2, #0x0, ge"); - test_display([0x00, 0xa0, 0x42, 0xfa], "ccmp x0, x2, #0x0, ge"); - test_display([0x85, 0x80, 0x42, 0xfa], "ccmp x4, x2, #0x5, hi"); -} - -#[test] -fn test_decode_data_processing_one_source() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x14, 0x02, 0xc0, 0x5a], "rbit w20, w16"), - ([0x14, 0x06, 0xc0, 0x5a], "rev16 w20, w16"), - ([0x14, 0x12, 0xc0, 0x5a], "clz w20, w16"), - ([0x14, 0x12, 0xc0, 0x5a], "clz w20, w16"), - ([0x14, 0x16, 0xc0, 0x5a], "cls w20, w16"), - ([0x14, 0x16, 0xc0, 0xda], "cls x20, x16"), - ([0x14, 0x0a, 0xc0, 0xda], "rev32 x20, x16"), - ]; - - for (bytes, instr) in TESTS { - test_display(*bytes, instr); - } - - test_err([0x14, 0x0e, 0xc0, 0x5a], DecodeError::InvalidOpcode); -} - -#[test] -fn test_decode_data_processing_three_source() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x11, 0x01, 0x0f, 0x1b], "madd w17, w8, w15, w0"), - ([0x11, 0x81, 0x0f, 0x1b], "msub w17, w8, w15, w0"), - ([0x11, 0x81, 0x0f, 0x9b], "msub x17, x8, x15, x0"), - ([0x11, 0x89, 0x0f, 0x9b], "msub x17, x8, x15, x2"), - - ([0x11, 0x09, 0x2f, 0x9b], "smaddl x17, w8, w15, x2"), - ([0x11, 0x89, 0x2f, 0x9b], "smsubl x17, w8, w15, x2"), - ([0x11, 0x09, 0x4f, 0x9b], "smulh x17, x8, x15"), - ([0x11, 0x09, 0xaf, 0x9b], "umaddl x17, w8, w15, x2"), - ([0x11, 0x89, 0xaf, 0x9b], "umsubl x17, w8, w15, x2"), - ([0x11, 0x09, 0xcf, 0x9b], "umulh x17, x8, x15"), - ]; - - for (bytes, instr) in TESTS { - test_display(*bytes, instr); - } - - test_err([0x11, 0x81, 0x0f, 0x3b], DecodeError::InvalidOpcode); -} - -#[test] -fn test_decode_chrome_entrypoint() { - // 1400 instructions from the entrypoint of a chrome binary, sorted by - // instruction word for no good reason. - - test_display( - [0x00, 0x00, 0x20, 0xd4], - "brk #0x0" - ); - test_display( - [0x00, 0x00, 0x80, 0x12], - "mov w0, #0xffffffff" - ); - test_display( - [0x00, 0x01, 0x3f, 0xd6], - "blr x8" - ); - test_display( - [0x00, 0x02, 0x00, 0x36], - "tbz w0, #0x0, $+0x40" - ); - test_display( - [0x00, 0x03, 0x00, 0x35], - "cbnz w0, $+0x60" - ); - test_display( - [0x00, 0x04, 0x00, 0x36], - "tbz w0, #0x0, $+0x80" - ); - test_display( - [0x00, 0x04, 0x40, 0xf9], - "ldr x0, [x0, #0x8]" - ); - test_display( - [0x00, 0x07, 0x00, 0x34], - "cbz w0, $+0xe0" - ); - test_display( - [0x00, 0x08, 0x47, 0xf9], - "ldr x0, [x0, #0xe10]" - ); - test_display( - [0x00, 0x0b, 0x80, 0x52], - "mov w0, #0x58" - ); - test_display( - [0x00, 0x14, 0x42, 0xf9], - "ldr x0, [x0, #0x428]" - ); - test_display( - [0x00, 0x1b, 0x80, 0x52], - "mov w0, #0xd8" - ); - test_display( - [0x00, 0x20, 0x40, 0xf9], - "ldr x0, [x0, #0x40]" - ); - test_display( - [0x00, 0x24, 0x47, 0xf9], - "ldr x0, [x0, #0xe48]" - ); - test_display( - [0x00, 0x2b, 0x03, 0x90], - "adrp x0, $+0x6560000" - ); - test_display( - [0x00, 0x34, 0x42, 0xf9], - "ldr x0, [x0, #0x468]" - ); - test_display( - [0x00, 0x39, 0x04, 0xb0], - "adrp x0, $+0x8721000" - ); - test_display( - [0x00, 0x3b, 0x04, 0xb0], - "adrp x0, $+0x8761000" - ); - test_display( - [0x00, 0x3c, 0x43, 0xf9], - "ldr x0, [x0, #0x678]" - ); - test_display( - [0x00, 0x44, 0x44, 0xf9], - "ldr x0, [x0, #0x888]" - ); - test_display( - [0x00, 0x50, 0x14, 0x91], - "add x0, x0, #0x514" - ); - test_display( - [0x00, 0x54, 0x44, 0xf9], - "ldr x0, [x0, #0x8a8]" - ); - test_display( - [0x00, 0x58, 0x42, 0xf9], - "ldr x0, [x0, #0x4b0]" - ); - test_display( - [0x00, 0x5c, 0x44, 0xf9], - "ldr x0, [x0, #0x8b8]" - ); - test_display( - [0x00, 0x60, 0x1e, 0x91], - "add x0, x0, #0x798" - ); - test_display( - [0x00, 0x70, 0x47, 0xf9], - "ldr x0, [x0, #0xee0]" - ); - test_display( - [0x00, 0x80, 0x1e, 0x91], - "add x0, x0, #0x7a0" - ); - test_display( - [0x00, 0x80, 0x44, 0xf9], - "ldr x0, [x0, #0x900]" - ); - test_display( - [0x00, 0x84, 0x47, 0xf9], - "ldr x0, [x0, #0xf08]" - ); - test_display( - [0x00, 0xac, 0x40, 0xf9], - "ldr x0, [x0, #0x158]" - ); - test_display( - [0x00, 0xc0, 0x09, 0x91], - "add x0, x0, #0x270" - ); - test_display( - [0x00, 0xc4, 0x45, 0xf9], - "ldr x0, [x0, #0xb88]" - ); - test_display( - [0x00, 0xcc, 0x41, 0xf9], - "ldr x0, [x0, #0x398]" - ); - test_display( - [0x00, 0xdc, 0x35, 0x91], - "add x0, x0, #0xd77" - ); - test_display( - [0x00, 0xf4, 0x47, 0xf9], - "ldr x0, [x0, #0xfe8]" - ); - test_display( - [0x01, 0x00, 0x00, 0x14], - "b $+0x4" - ); - test_display( - [0x01, 0x00, 0x40, 0xf9], - "ldr x1, [x0]" - ); - test_display( - [0x01, 0x05, 0x40, 0xf9], - "ldr x1, [x8, #0x8]" - ); - test_display( - [0x01, 0xfb, 0x4b, 0x95], - "bl $+0x52fec04" - ); - test_display( - [0x02, 0x00, 0x00, 0x14], - "b $+0x8" - ); - test_display( - [0x02, 0x00, 0x00, 0x90], - "adrp x2, $+0x0" - ); - test_display( - [0x02, 0x00, 0x80, 0x92], - "mov x2, #0xffffffffffffffff" - ); - test_display( - [0x02, 0x04, 0xf8, 0x97], - "bl $-0x1feff8" - ); - test_display( - [0x02, 0x2c, 0x80, 0x52], - "mov w2, #0x160" - ); - test_display( - [0x08, 0x00, 0x40, 0xf9], - "ldr x8, [x0]" - ); - test_display( - [0x08, 0x01, 0x40, 0xf9], - "ldr x8, [x8]" - ); - test_display( - [0x08, 0x05, 0x40, 0xf9], - "ldr x8, [x8, #0x8]" - ); - test_display( - [0x08, 0x06, 0xf8, 0x97], - "bl $-0x1fe7e0" - ); - test_display( - [0x08, 0x09, 0x40, 0xf9], - "ldr x8, [x8, #0x10]" - ); - test_display( - [0x08, 0x1d, 0x40, 0x92], - "and x8, x8, #0xff" - ); - test_display( - [0x08, 0x1f, 0x00, 0x13], - "sxtb w8, w24" - ); - test_display( - [0x08, 0x21, 0x0a, 0x91], - "add x8, x8, #0x288" - ); - test_display( - [0x08, 0x41, 0x00, 0x91], - "add x8, x8, #0x10" - ); - test_display( - [0x08, 0x41, 0x40, 0xf9], - "ldr x8, [x8, #0x80]" - ); - test_display( - [0x08, 0x81, 0x0a, 0x91], - "add x8, x8, #0x2a0" - ); - test_display( - [0x08, 0xa1, 0x11, 0x91], - "add x8, x8, #0x468" - ); - test_display( - [0x08, 0xc1, 0x1e, 0x91], - "add x8, x8, #0x7b0" - ); - test_display( - [0x08, 0xdd, 0x46, 0xf9], - "ldr x8, [x8, #0xdb8]" - ); - test_display( - [0x08, 0xe1, 0x0e, 0x91], - "add x8, x8, #0x3b8" - ); - test_display( - [0x08, 0xf2, 0xff, 0x36], - "tbz w8, #0x1f, $-0x1c0" - ); - test_display( - [0x09, 0x1f, 0x00, 0x13], - "sxtb w9, w24" - ); - test_display( - [0x09, 0x5d, 0xc0, 0x39], - "ldrsb w9, [x8, #0x17]" - ); - test_display( - [0x0a, 0x2d, 0x40, 0xa9], - "ldp x10, x11, [x8]" - ); - test_display( - [0x0a, 0xf0, 0x8e, 0x94], - "bl $+0x23bc028" - ); - test_display( - [0x13, 0x3b, 0x04, 0xb0], - "adrp x19, $+0x8761000" - ); - test_display( - [0x13, 0xfd, 0xdf, 0xc8], - "ldar x19, [x8]" - ); - test_display( - [0x14, 0x05, 0x00, 0xb4], - "cbz x20, $+0xa0" - ); - test_display( - [0x15, 0x05, 0x88, 0x1a], - "cinc w21, w8, ne" - ); - test_display( - [0x17, 0xed, 0x7c, 0x92], - "and x23, x8, #0xfffffffffffffff0" - ); - test_display( - [0x1d, 0x00, 0x80, 0xd2], - "mov x29, #0x0" - ); - test_display( - [0x1e, 0x00, 0x80, 0xd2], - "mov x30, #0x0" - ); - test_display( - [0x1f, 0x00, 0x00, 0x71], - "cmp w0, #0x0" - ); - test_display( - [0x1f, 0x00, 0x14, 0xeb], - "cmp x0, x20" - ); - test_display( - [0x1f, 0x01, 0x00, 0x71], - "cmp w8, #0x0" - ); - test_display( - [0x1f, 0x01, 0x00, 0xf1], - "cmp x8, #0x0" - ); - test_display( - [0x1f, 0x01, 0x09, 0xeb], - "cmp x8, x9" - ); - test_display( - [0x1f, 0x01, 0x0c, 0xeb], - "cmp x8, x12" - ); - test_display( - [0x1f, 0x03, 0x00, 0x71], - "cmp w24, #0x0" - ); - test_display( - [0x1f, 0x0d, 0x00, 0xf1], - "cmp x8, #0x3" - ); - test_display( - [0x1f, 0x20, 0x03, 0xd5], - "esb" - ); - test_display( - [0x20, 0x00, 0x1f, 0xd6], - "br x1" - ); - test_display( - [0x20, 0x00, 0x3f, 0xd6], - "blr x1" - ); - test_display( - [0x20, 0x00, 0x80, 0x52], - "mov w0, #0x1" - ); - test_display( - [0x20, 0xb1, 0x8a, 0x9a], - "csel x0, x9, x10, lt" - ); - test_display( - [0x20, 0xb1, 0x94, 0x9a], - "csel x0, x9, x20, lt" - ); - test_display( - [0x20, 0xb1, 0x95, 0x9a], - "csel x0, x9, x21, lt" - ); - test_display( - [0x21, 0x00, 0x00, 0xcb], - "sub x1, x1, x0" - ); - test_display( - [0x21, 0x01, 0x00, 0x54], - "b.ne $+0x24" - ); - test_display( - [0x21, 0x01, 0x00, 0x54], - "b.ne $+0x24" - ); - test_display( - [0x21, 0x04, 0x36, 0x91], - "add x1, x1, #0xd81" - ); - test_display( - [0x21, 0x10, 0x34, 0x91], - "add x1, x1, #0xd04" - ); - test_display( - [0x21, 0x1c, 0x00, 0x91], - "add x1, x1, #0x7" - ); - test_display( - [0x21, 0x1c, 0x45, 0xf9], - "ldr x1, [x1, #0xa38]" - ); - test_display( - [0x21, 0x1c, 0x46, 0xf9], - "ldr x1, [x1, #0xc38]" - ); - test_display( - [0x21, 0x34, 0x42, 0xf9], - "ldr x1, [x1, #0x468]" - ); - test_display( - [0x21, 0x3c, 0x36, 0x91], - "add x1, x1, #0xd8f" - ); - test_display( - [0x21, 0x90, 0x36, 0x91], - "add x1, x1, #0xda4" - ); - test_display( - [0x21, 0x98, 0x41, 0xf9], - "ldr x1, [x1, #0x330]" - ); - test_display( - [0x21, 0xb4, 0x34, 0x91], - "add x1, x1, #0xd2d" - ); - test_display( - [0x21, 0xc4, 0x40, 0xf9], - "ldr x1, [x1, #0x188]" - ); - test_display( - [0x21, 0xc4, 0x45, 0xf9], - "ldr x1, [x1, #0xb88]" - ); - test_display( - [0x21, 0xd8, 0x40, 0xf9], - "ldr x1, [x1, #0x1b0]" - ); - test_display( - [0x21, 0xd8, 0x47, 0xf9], - "ldr x1, [x1, #0xfb0]" - ); - test_display( - [0x21, 0xe4, 0x40, 0xf9], - "ldr x1, [x1, #0x1c8]" - ); - test_display( - [0x21, 0xf4, 0x36, 0x91], - "add x1, x1, #0xdbd" - ); - test_display( - [0x21, 0xfc, 0x41, 0x8b], - "add x1, x1, x1, lsr #63" - ); - test_display( - [0x21, 0xfc, 0x41, 0x93], - "asr x1, x1, #0x1" - ); - test_display( - [0x21, 0xfc, 0x43, 0x93], - "asr x1, x1, #0x3" - ); - test_display( - [0x21, 0xfc, 0x44, 0xf9], - "ldr x1, [x1, #0x9f8]" - ); - test_display( - [0x22, 0x09, 0x80, 0x52], - "mov w2, #0x49" - ); - test_display( - [0x22, 0xb1, 0x96, 0x9a], - "csel x2, x9, x22, lt" - ); - test_display( - [0x23, 0xb1, 0x96, 0x9a], - "csel x3, x9, x22, lt" - ); - test_display( - [0x24, 0x01, 0x80, 0x52], - "mov w4, #0x9" - ); - test_display( - [0x26, 0x00, 0x00, 0x14], - "b $+0x98" - ); - test_display( - [0x28, 0x02, 0x00, 0x54], - "b.hi $+0x44" - ); - test_display( - [0x28, 0x11, 0x08, 0x8b], - "add x8, x9, x8, lsl #4" - ); - test_display( - [0x28, 0xb1, 0x88, 0x9a], - "csel x8, x9, x8, lt" - ); - test_display( - [0x29, 0x01, 0x40, 0xf9], - "ldr x9, [x9]" - ); - test_display( - [0x29, 0x1d, 0x40, 0x92], - "and x9, x9, #0xff" - ); - test_display( - [0x29, 0xa1, 0x21, 0x91], - "add x9, x9, #0x868" - ); - test_display( - [0x29, 0xc5, 0x46, 0xf9], - "ldr x9, [x9, #0xd88]" - ); - test_display( - [0x29, 0xdd, 0x46, 0xf9], - "ldr x9, [x9, #0xdb8]" - ); - test_display( - [0x2b, 0x1d, 0x00, 0x13], - "sxtb w11, w9" - ); - test_display( - [0x2b, 0xb1, 0x88, 0x9a], - "csel x11, x9, x8, lt" - ); - test_display( - [0x34, 0xb1, 0x94, 0x9a], - "csel x20, x9, x20, lt" - ); - test_display( - [0x35, 0x01, 0x40, 0xb9], - "ldr w21, [x9]" - ); - test_display( - [0x35, 0x03, 0x00, 0xb5], - "cbnz x21, $+0x64" - ); - test_display( - [0x35, 0xb1, 0x95, 0x9a], - "csel x21, x9, x21, lt" - ); - test_display( - [0x3f, 0x01, 0x00, 0x71], - "cmp w9, #0x0" - ); - test_display( - [0x3f, 0x01, 0x08, 0xeb], - "cmp x9, x8" - ); - test_display( - [0x3f, 0x38, 0x00, 0xf1], - "cmp x1, #0xe" - ); - test_display( - [0x40, 0x00, 0x1f, 0xd6], - "br x2" - ); - test_display( - [0x40, 0x21, 0x00, 0x91], - "add x0, x10, #0x8" - ); - test_display( - [0x40, 0x7d, 0x80, 0x52], - "mov w0, #0x3ea" - ); - test_display( - [0x41, 0x01, 0x00, 0x54], - "b.ne $+0x28" - ); - test_display( - [0x41, 0xb1, 0x88, 0x9a], - "csel x1, x10, x8, lt" - ); - test_display( - [0x42, 0x00, 0x1b, 0x91], - "add x2, x2, #0x6c0" - ); - test_display( - [0x42, 0x40, 0x1a, 0x91], - "add x2, x2, #0x690" - ); - test_display( - [0x42, 0x50, 0x41, 0xf9], - "ldr x2, [x2, #0x2a0]" - ); - test_display( - [0x42, 0x7d, 0x80, 0x52], - "mov w2, #0x3ea" - ); - test_display( - [0x42, 0xc0, 0x1b, 0x91], - "add x2, x2, #0x6f0" - ); - test_display( - [0x42, 0xe4, 0x44, 0xf9], - "ldr x2, [x2, #0x9c8]" - ); - test_display( - [0x48, 0xb1, 0x89, 0x9a], - "csel x8, x10, x9, lt" - ); - test_display( - [0x49, 0xb1, 0x89, 0x9a], - "csel x9, x10, x9, lt" - ); - test_display( - [0x4a, 0x1d, 0x00, 0x13], - "sxtb w10, w10" - ); - test_display( - [0x4c, 0xb1, 0x89, 0x9a], - "csel x12, x10, x9, lt" - ); - test_display( - [0x5f, 0x01, 0x00, 0x71], - "cmp w10, #0x0" - ); - test_display( - [0x60, 0x02, 0x00, 0xb9], - "str w0, [x19]" - ); - test_display( - [0x60, 0x02, 0x0a, 0x39], - "strb w0, [x19, #0x280]" - ); - test_display( - [0x60, 0x02, 0x4a, 0x39], - "ldrb w0, [x19, #0x280]" - ); - test_display( - [0x60, 0x22, 0x00, 0x91], - "add x0, x19, #0x8" - ); - test_display( - [0x60, 0x36, 0x40, 0xf9], - "ldr x0, [x19, #0x68]" - ); - test_display( - [0x60, 0x3e, 0x40, 0xf9], - "ldr x0, [x19, #0x78]" - ); - test_display( - [0x61, 0x02, 0x00, 0x12], - "and w1, w19, #0x1" - ); - test_display( - [0x61, 0xb1, 0x88, 0x9a], - "csel x1, x11, x8, lt" - ); - test_display( - [0x62, 0xb1, 0x89, 0x9a], - "csel x2, x11, x9, lt" - ); - test_display( - [0x63, 0x14, 0x42, 0xf9], - "ldr x3, [x3, #0x428]" - ); - test_display( - [0x63, 0x18, 0x16, 0x91], - "add x3, x3, #0x586" - ); - test_display( - [0x63, 0x24, 0x47, 0xf9], - "ldr x3, [x3, #0xe48]" - ); - test_display( - [0x63, 0x44, 0x44, 0xf9], - "ldr x3, [x3, #0x888]" - ); - test_display( - [0x63, 0x5c, 0x21, 0x91], - "add x3, x3, #0x857" - ); - test_display( - [0x63, 0x5c, 0x44, 0xf9], - "ldr x3, [x3, #0x8b8]" - ); - test_display( - [0x63, 0x80, 0x44, 0xf9], - "ldr x3, [x3, #0x900]" - ); - test_display( - [0x63, 0x84, 0x47, 0xf9], - "ldr x3, [x3, #0xf08]" - ); - test_display( - [0x63, 0x88, 0x09, 0x91], - "add x3, x3, #0x262" - ); - test_display( - [0x63, 0xbc, 0x44, 0xf9], - "ldr x3, [x3, #0x978]" - ); - test_display( - [0x63, 0xc4, 0x45, 0xf9], - "ldr x3, [x3, #0xb88]" - ); - test_display( - [0x63, 0xcc, 0x41, 0xf9], - "ldr x3, [x3, #0x398]" - ); - test_display( - [0x63, 0xf4, 0x47, 0xf9], - "ldr x3, [x3, #0xfe8]" - ); - test_display( - [0x68, 0x00, 0xf8, 0x36], - "tbz w8, #0x1f, $+0xc" - ); - test_display( - [0x68, 0x01, 0xf8, 0x37], - "tbnz w8, #0x1f, $+0x2c" - ); - test_display( - [0x68, 0x02, 0x00, 0xf9], - "str x8, [x19]" - ); - test_display( - [0x68, 0x1d, 0x00, 0x13], - "sxtb w8, w11" - ); - test_display( - [0x74, 0x3a, 0x00, 0xf9], - "str x20, [x19, #0x70]" - ); - test_display( - [0x74, 0x3a, 0x40, 0xf9], - "ldr x20, [x19, #0x70]" - ); - test_display( - [0x74, 0x5e, 0x40, 0x39], - "ldrb w20, [x19, #0x17]" - ); - test_display( - [0x75, 0x06, 0x40, 0xf9], - "ldr x21, [x19, #0x8]" - ); - test_display( - [0x75, 0x36, 0x00, 0xf9], - "str x21, [x19, #0x68]" - ); - test_display( - [0x75, 0x36, 0x40, 0xf9], - "ldr x21, [x19, #0x68]" - ); - test_display( - [0x75, 0x3a, 0x40, 0xf9], - "ldr x21, [x19, #0x70]" - ); - test_display( - [0x76, 0x5e, 0x40, 0x39], - "ldrb w22, [x19, #0x17]" - ); - test_display( - [0x7f, 0x01, 0x00, 0x71], - "cmp w11, #0x0" - ); - test_display( - [0x7f, 0x06, 0x00, 0xf1], - "cmp x19, #0x1" - ); - test_display( - [0x7f, 0x1d, 0x00, 0xf1], - "cmp x11, #0x7" - ); - test_display( - [0x80, 0x22, 0x00, 0x91], - "add x0, x20, #0x8" - ); - test_display( - [0x80, 0x3a, 0x40, 0xf9], - "ldr x0, [x20, #0x70]" - ); - test_display( - [0x81, 0x01, 0x00, 0x54], - "b.ne $+0x30" - ); - test_display( - [0x82, 0x02, 0x80, 0x52], - "mov w2, #0x14" - ); - test_display( - [0x84, 0x48, 0x46, 0xf9], - "ldr x4, [x4, #0xc90]" - ); - test_display( - [0x88, 0x02, 0x00, 0xf9], - "str x8, [x20]" - ); - test_display( - [0x88, 0x02, 0x40, 0xf9], - "ldr x8, [x20]" - ); - test_display( - [0x89, 0x5e, 0x40, 0x39], - "ldrb w9, [x20, #0x17]" - ); - test_display( - [0x8a, 0x06, 0x40, 0xf9], - "ldr x10, [x20, #0x8]" - ); - test_display( - [0x93, 0x22, 0x00, 0x91], - "add x19, x20, #0x8" - ); - test_display( - [0x93, 0xfe, 0xdf, 0xc8], - "ldar x19, [x20]" - ); - test_display( - [0x94, 0x00, 0xf8, 0x36], - "tbz w20, #0x1f, $+0x10" - ); - test_display( - [0x94, 0x22, 0x0a, 0x91], - "add x20, x20, #0x288" - ); - test_display( - [0x94, 0x82, 0x0a, 0x91], - "add x20, x20, #0x2a0" - ); - test_display( - [0x94, 0xa2, 0x11, 0x91], - "add x20, x20, #0x468" - ); - test_display( - [0x96, 0x1e, 0x00, 0x13], - "sxtb w22, w20" - ); - test_display( - [0xa0, 0x03, 0x19, 0xf8], - "stur x0, [x29, #-0x70]" - ); - test_display( - [0xa0, 0x03, 0x1a, 0xf8], - "stur x0, [x29, #-0x60]" - ); - test_display( - [0xa0, 0x03, 0x58, 0xf8], - "ldur x0, [x29, #-0x80]" - ); - test_display( - [0xa0, 0x03, 0x5a, 0xf8], - "ldur x0, [x29, #-0x60]" - ); - test_display( - [0xa0, 0x09, 0x40, 0xd4], - "hlt #0x4d" - ); - test_display( - [0xa0, 0x22, 0x00, 0x91], - "add x0, x21, #0x8" - ); - test_display( - [0xa0, 0x23, 0x01, 0xd1], - "sub x0, x29, #0x48" - ); - test_display( - [0xa0, 0x3e, 0x40, 0xf9], - "ldr x0, [x21, #0x78]" - ); - test_display( - [0xa0, 0x83, 0x1a, 0xf8], - "stur x0, [x29, #-0x58]" - ); - test_display( - [0xa0, 0x83, 0x58, 0xf8], - "ldur x0, [x29, #-0x78]" - ); - test_display( - [0xa0, 0x83, 0x5b, 0xf8], - "ldur x0, [x29, #-0x48]" - ); - test_display( - [0xa0, 0xe3, 0x01, 0xd1], - "sub x0, x29, #0x78" - ); - test_display( - [0xa1, 0x23, 0x01, 0xd1], - "sub x1, x29, #0x48" - ); - test_display( - [0xa1, 0x7e, 0x80, 0x52], - "mov w1, #0x3f5" - ); - test_display( - [0xa1, 0x83, 0x01, 0xd1], - "sub x1, x29, #0x60" - ); - test_display( - [0xa1, 0xe3, 0x01, 0xd1], - "sub x1, x29, #0x78" - ); - test_display( - [0xa2, 0x00, 0x00, 0x54], - "b.hs $+0x14" - ); - test_display( - [0xa2, 0x01, 0x80, 0x52], - "mov w2, #0xd" - ); - test_display( - [0xa2, 0x04, 0x80, 0x52], - "mov w2, #0x25" - ); - test_display( - [0xa2, 0x23, 0x01, 0xd1], - "sub x2, x29, #0x48" - ); - test_display( - [0xa2, 0x23, 0x80, 0x52], - "mov w2, #0x11d" - ); - test_display( - [0xa3, 0xe3, 0x01, 0xd1], - "sub x3, x29, #0x78" - ); - test_display( - [0xa8, 0x03, 0x02, 0xd1], - "sub x8, x29, #0x80" - ); - test_display( - [0xa8, 0x23, 0x01, 0xd1], - "sub x8, x29, #0x48" - ); - test_display( - [0xa8, 0x3e, 0x00, 0xf9], - "str x8, [x21, #0x78]" - ); - test_display( - [0xa8, 0x42, 0x00, 0x91], - "add x8, x21, #0x10" - ); - test_display( - [0xa8, 0x73, 0x5b, 0x38], - "ldurb w8, [x29, #-0x49]" - ); - test_display( - [0xa8, 0x73, 0xdb, 0x38], - "ldursb w8, [x29, #-0x49]" - ); - test_display( - [0xa8, 0x83, 0x01, 0xd1], - "sub x8, x29, #0x60" - ); - test_display( - [0xa8, 0x83, 0x19, 0xf8], - "stur x8, [x29, #-0x68]" - ); - test_display( - [0xa8, 0x83, 0x1b, 0xf8], - "stur x8, [x29, #-0x48]" - ); - test_display( - [0xa8, 0x83, 0x1c, 0xf8], - "stur x8, [x29, #-0x38]" - ); - test_display( - [0xa8, 0x83, 0x1d, 0xf8], - "stur x8, [x29, #-0x28]" - ); - test_display( - [0xa8, 0x83, 0x5b, 0xf8], - "ldur x8, [x29, #-0x48]" - ); - test_display( - [0xa8, 0x83, 0x5c, 0xf8], - "ldur x8, [x29, #-0x38]" - ); - test_display( - [0xa8, 0x83, 0x5d, 0xf8], - "ldur x8, [x29, #-0x28]" - ); - test_display( - [0xa8, 0xf3, 0x5c, 0x38], - "ldurb w8, [x29, #-0x31]" - ); - test_display( - [0xa8, 0xf3, 0xd9, 0x38], - "ldursb w8, [x29, #-0x61]" - ); - test_display( - [0xa8, 0xf3, 0xdc, 0x38], - "ldursb w8, [x29, #-0x31]" - ); - test_display( - [0xa9, 0x03, 0x5c, 0xf8], - "ldur x9, [x29, #-0x40]" - ); - test_display( - [0xa9, 0x83, 0x5a, 0xf8], - "ldur x9, [x29, #-0x58]" - ); - test_display( - [0xa9, 0xab, 0x78, 0xa9], - "ldp x9, x10, [x29, #-0x78]" - ); - test_display( - [0xa9, 0xaf, 0x78, 0xa9], - "ldp x9, x11, [x29, #-0x78]" - ); - test_display( - [0xa9, 0x00, 0x00, 0x54], - "b.ls $+0x14" - ); - test_display( - [0xaa, 0xe3, 0x01, 0xd1], - "sub x10, x29, #0x78" - ); - test_display( - [0xa9, 0xb2, 0x94, 0x9a], - "csel x9, x21, x20, lt" - ); - test_display( - [0xb4, 0x22, 0x03, 0x51], - "sub w20, w21, #0xc8" - ); - test_display( - [0xb4, 0x92, 0x01, 0x51], - "sub w20, w21, #0x64" - ); - test_display( - [0xb5, 0x56, 0x44, 0xf9], - "ldr x21, [x21, #0x8a8]" - ); - test_display( - [0xb5, 0x83, 0x18, 0xf8], - "stur x21, [x29, #-0x78]" - ); - test_display( - [0xb5, 0xda, 0x47, 0xf9], - "ldr x21, [x21, #0xfb0]" - ); - test_display( - [0xb5, 0xe3, 0x01, 0xd1], - "sub x21, x29, #0x78" - ); - test_display( - [0xb5, 0xf3, 0x19, 0x38], - "sturb w21, [x29, #-0x61]" - ); - test_display( - [0xb6, 0xd7, 0x38, 0xa9], - "stp x22, x21, [x29, #-0x78]" - ); - test_display( - [0xb6, 0xe3, 0x01, 0xd1], - "sub x22, x29, #0x78" - ); - test_display( - [0xbf, 0x5e, 0x00, 0xf1], - "cmp x21, #0x17" - ); - test_display( - [0xc0, 0x03, 0x5f, 0xd6], - "ret" - ); - test_display( - [0xc0, 0x09, 0x40, 0xd4], - "hlt #0x4e" - ); - test_display( - [0xc0, 0x42, 0x00, 0x91], - "add x0, x22, #0x10" - ); - test_display( - [0xc0, 0x7e, 0x80, 0x52], - "mov w0, #0x3f6" - ); - test_display( - [0xc0, 0x80, 0x80, 0x52], - "mov w0, #0x406" - ); - test_display( - [0xc2, 0x47, 0x80, 0x52], - "mov w2, #0x23e" - ); - test_display( - [0xc9, 0x1e, 0x00, 0x13], - "sxtb w9, w22" - ); - test_display( - [0xd6, 0x16, 0x43, 0xf9], - "ldr x22, [x22, #0x628]" - ); - test_display( - [0xdf, 0x6a, 0x35, 0x38], - "strb wzr, [x22, x21]" - ); - test_display( - [0xe0, 0x03, 0x00, 0x32], - "mov w0, #0x1" - ); - test_display( - [0xe0, 0x03, 0x00, 0x91], - "mov x0, sp" - ); - test_display( - [0xe0, 0x03, 0x1f, 0x32], - "mov w0, #0x2" - ); - test_display( - [0xe0, 0x07, 0x00, 0x32], - "mov w0, #0x3" - ); - test_display( - [0xe0, 0x07, 0x00, 0xf9], - "str x0, [sp, #0x8]" - ); - test_display( - [0xe0, 0x07, 0x40, 0xf9], - "ldr x0, [sp, #0x8]" - ); - test_display( - [0xe0, 0x09, 0x40, 0xd4], - "hlt #0x4f" - ); - test_display( - [0xe0, 0x0b, 0x00, 0xf9], - "str x0, [sp, #0x10]" - ); - test_display( - [0xe0, 0x0f, 0x00, 0x32], - "mov w0, #0xf" - ); - test_display( - [0xe0, 0x0f, 0x40, 0xf9], - "ldr x0, [sp, #0x18]" - ); - test_display( - [0xe0, 0x13, 0x40, 0xf9], - "ldr x0, [sp, #0x20]" - ); - test_display( - [0xe0, 0x17, 0x00, 0xf9], - "str x0, [sp, #0x28]" - ); - test_display( - [0xe0, 0x17, 0x9f, 0x1a], - "cset w0, eq" - ); - test_display( - [0xe0, 0x1b, 0x40, 0xf9], - "ldr x0, [sp, #0x30]" - ); - test_display( - [0xe0, 0x1f, 0x40, 0xf9], - "ldr x0, [sp, #0x38]" - ); - test_display( - [0xe0, 0x22, 0x00, 0x91], - "add x0, x23, #0x8" - ); - test_display( - [0xe0, 0x23, 0x00, 0x91], - "add x0, sp, #0x8" - ); - test_display( - [0xe0, 0x23, 0x00, 0xf9], - "str x0, [sp, #0x40]" - ); - test_display( - [0xe0, 0x27, 0x40, 0xf9], - "ldr x0, [sp, #0x48]" - ); - test_display( - [0xe0, 0x33, 0x40, 0xf9], - "ldr x0, [sp, #0x60]" - ); - test_display( - [0xe0, 0x63, 0x00, 0x91], - "add x0, sp, #0x18" - ); - test_display( - [0xe0, 0x83, 0x00, 0x91], - "add x0, sp, #0x20" - ); - test_display( - [0xe0, 0x83, 0x01, 0x91], - "add x0, sp, #0x60" - ); - test_display( - [0xe0, 0xa3, 0x00, 0x91], - "add x0, sp, #0x28" - ); - test_display( - [0xe0, 0xe3, 0x00, 0x91], - "add x0, sp, #0x38" - ); - test_display( - [0xe0, 0xe3, 0x01, 0x91], - "add x0, sp, #0x78" - ); - test_display( - [0xe1, 0x03, 0x1f, 0x32], - "mov w1, #0x2" - ); - test_display( - [0xe1, 0x03, 0x40, 0xf9], - "ldr x1, [sp]" - ); - test_display( - [0xe1, 0x23, 0x00, 0x91], - "add x1, sp, #0x8" - ); - test_display( - [0xe1, 0x63, 0x00, 0x91], - "add x1, sp, #0x18" - ); - test_display( - [0xe1, 0x83, 0x00, 0x91], - "add x1, sp, #0x20" - ); - test_display( - [0xe1, 0xe3, 0x00, 0x91], - "add x1, sp, #0x38" - ); - test_display( - [0xe1, 0xe3, 0x01, 0x91], - "add x1, sp, #0x78" - ); - test_display( - [0xe2, 0x07, 0x1d, 0x32], - "mov w2, #0x18" - ); - test_display( - [0xe2, 0x23, 0x00, 0x91], - "add x2, sp, #0x8" - ); - test_display( - [0xe2, 0xe3, 0x00, 0x91], - "add x2, sp, #0x38" - ); - test_display( - [0xe3, 0x03, 0x00, 0x32], - "mov w3, #0x1" - ); - test_display( - [0xe3, 0x03, 0x1f, 0x32], - "mov w3, #0x2" - ); - test_display( - [0xe4, 0x07, 0x00, 0x32], - "mov w4, #0x3" - ); - test_display( - [0xe4, 0x0b, 0x00, 0x32], - "mov w4, #0x7" - ); - test_display( - [0xe6, 0x03, 0x00, 0x91], - "mov x6, sp" - ); - test_display( - [0xe8, 0x01, 0xf8, 0x37], - "tbnz w8, #0x1f, $+0x3c" - ); - test_display( - [0xe8, 0x02, 0x41, 0xb2], - "orr x8, x23, #0x8000000000000000" - ); - test_display( - [0xe8, 0x03, 0x00, 0x32], - "mov w8, #0x1" - ); - test_display( - [0xe8, 0x0f, 0x00, 0xf9], - "str x8, [sp, #0x18]" - ); - test_display( - [0xe8, 0x1f, 0x40, 0xf9], - "ldr x8, [sp, #0x38]" - ); - test_display( - [0xe8, 0x1f, 0xc1, 0x39], - "ldrsb w8, [sp, #0x47]" - ); - test_display( - [0xe8, 0x23, 0x00, 0x91], - "add x8, sp, #0x8" - ); - test_display( - [0xe8, 0x3f, 0x41, 0x39], - "ldrb w8, [sp, #0x4f]" - ); - test_display( - [0xe8, 0x3f, 0xc1, 0x39], - "ldrsb w8, [sp, #0x4f]" - ); - test_display( - [0xe8, 0x63, 0x00, 0x91], - "add x8, sp, #0x18" - ); - test_display( - [0xe8, 0x7f, 0xc0, 0x39], - "ldrsb w8, [sp, #0x1f]" - ); - test_display( - [0xe8, 0x7f, 0xc1, 0x39], - "ldrsb w8, [sp, #0x5f]" - ); - test_display( - [0xe8, 0x83, 0x00, 0x91], - "add x8, sp, #0x20" - ); - test_display( - [0xe8, 0x83, 0x01, 0x91], - "add x8, sp, #0x60" - ); - test_display( - [0xe8, 0xbf, 0xc0, 0x39], - "ldrsb w8, [sp, #0x2f]" - ); - test_display( - [0xe8, 0xdf, 0x41, 0x39], - "ldrb w8, [sp, #0x77]" - ); - test_display( - [0xe8, 0xdf, 0xc0, 0x39], - "ldrsb w8, [sp, #0x37]" - ); - test_display( - [0xe8, 0xdf, 0xc1, 0x39], - "ldrsb w8, [sp, #0x77]" - ); - test_display( - [0xe8, 0xe3, 0x00, 0x91], - "add x8, sp, #0x38" - ); - test_display( - [0xe8, 0xe3, 0x01, 0x91], - "add x8, sp, #0x78" - ); - test_display( - [0xe9, 0x03, 0x01, 0x32], - "mov w9, #0x80000000" - ); - test_display( - [0xe9, 0x07, 0x40, 0xf9], - "ldr x9, [sp, #0x8]" - ); - test_display( - [0xe9, 0x13, 0x40, 0xf9], - "ldr x9, [sp, #0x20]" - ); - test_display( - [0xe9, 0x1f, 0x40, 0xf9], - "ldr x9, [sp, #0x38]" - ); - test_display( - [0xe9, 0x23, 0x40, 0xf9], - "ldr x9, [sp, #0x40]" - ); - test_display( - [0xe9, 0x37, 0x40, 0xf9], - "ldr x9, [sp, #0x68]" - ); - test_display( - [0xe9, 0xa3, 0x00, 0xb9], - "str w9, [sp, #0xa0]" - ); - test_display( - [0xe9, 0xb2, 0x96, 0x9a], - "csel x9, x23, x22, lt" - ); - test_display( - [0xe9, 0xdf, 0x41, 0x39], - "ldrb w9, [sp, #0x77]" - ); - test_display( - [0xea, 0x37, 0x40, 0xf9], - "ldr x10, [sp, #0x68]" - ); - test_display( - [0xea, 0x63, 0x00, 0x91], - "add x10, sp, #0x18" - ); - test_display( - [0xf3, 0x03, 0x00, 0x91], - "mov x19, sp" - ); - test_display( - [0xf3, 0x0b, 0x40, 0xf9], - "ldr x19, [sp, #0x10]" - ); - test_display( - [0xf3, 0x1b, 0x00, 0xf9], - "str x19, [sp, #0x30]" - ); - test_display( - [0xf3, 0x5b, 0x00, 0xf9], - "str x19, [sp, #0xb0]" - ); - test_display( - [0xf3, 0x5b, 0x40, 0xf9], - "ldr x19, [sp, #0xb0]" - ); - test_display( - [0xf4, 0x07, 0x9f, 0x1a], - "cset w20, ne" - ); - test_display( - [0xf4, 0x0b, 0x00, 0xb9], - "str w20, [sp, #0x8]" - ); - test_display( - [0xf4, 0x4f, 0x01, 0xa9], - "stp x20, x19, [sp, #0x10]" - ); - test_display( - [0xf4, 0x4f, 0x02, 0xa9], - "stp x20, x19, [sp, #0x20]" - ); - test_display( - [0xf4, 0x4f, 0x0c, 0xa9], - "stp x20, x19, [sp, #0xc0]" - ); - test_display( - [0xf4, 0x4f, 0x10, 0xa9], - "stp x20, x19, [sp, #0x100]" - ); - test_display( - [0xf4, 0x4f, 0x16, 0xa9], - "stp x20, x19, [sp, #0x160]" - ); - test_display( - [0xf4, 0x4f, 0x19, 0xa9], - "stp x20, x19, [sp, #0x190]" - ); - test_display( - [0xf4, 0x4f, 0x41, 0xa9], - "ldp x20, x19, [sp, #0x10]" - ); - test_display( - [0xf4, 0x4f, 0x42, 0xa9], - "ldp x20, x19, [sp, #0x20]" - ); - test_display( - [0xf4, 0x4f, 0x4c, 0xa9], - "ldp x20, x19, [sp, #0xc0]" - ); - test_display( - [0xf4, 0x4f, 0x50, 0xa9], - "ldp x20, x19, [sp, #0x100]" - ); - test_display( - [0xf4, 0x4f, 0x56, 0xa9], - "ldp x20, x19, [sp, #0x160]" - ); - test_display( - [0xf4, 0x4f, 0x59, 0xa9], - "ldp x20, x19, [sp, #0x190]" - ); - test_display( - [0xf4, 0x4f, 0xbe, 0xa9], - "stp x20, x19, [sp, #-0x20]!" - ); - test_display( - [0xf4, 0x4f, 0xc2, 0xa8], - "ldp x20, x19, [sp], #0x20" - ); - test_display( - [0xf4, 0xb2, 0x96, 0x9a], - "csel x20, x23, x22, lt" - ); - test_display( - [0xf4, 0xe3, 0x00, 0x91], - "add x20, sp, #0x38" - ); - test_display( - [0xf5, 0x03, 0x00, 0x32], - "mov w21, #0x1" - ); - test_display( - [0xf5, 0x03, 0x00, 0xf9], - "str x21, [sp]" - ); - test_display( - [0xf5, 0x03, 0x1f, 0x32], - "mov w21, #0x2" - ); - test_display( - [0xf5, 0x07, 0x00, 0xf9], - "str x21, [sp, #0x8]" - ); - test_display( - [0xf5, 0x07, 0x43, 0xf8], - "ldr x21, [sp], #0x30" - ); - test_display( - [0xf5, 0x0f, 0x1d, 0xf8], - "str x21, [sp, #-0x30]!" - ); - test_display( - [0xf5, 0x13, 0x00, 0xf9], - "str x21, [sp, #0x20]" - ); - test_display( - [0xf5, 0x5b, 0x00, 0xf9], - "str x21, [sp, #0xb0]" - ); - test_display( - [0xf5, 0x5b, 0x40, 0xf9], - "ldr x21, [sp, #0xb0]" - ); - test_display( - [0xf5, 0x83, 0x00, 0x91], - "add x21, sp, #0x20" - ); - test_display( - [0xf5, 0xa3, 0x00, 0x91], - "add x21, sp, #0x28" - ); - test_display( - [0xf6, 0x1f, 0x00, 0xf9], - "str x22, [sp, #0x38]" - ); - test_display( - [0xf6, 0x23, 0x00, 0x91], - "add x22, sp, #0x8" - ); - test_display( - [0xf6, 0x57, 0x0f, 0xa9], - "stp x22, x21, [sp, #0xf0]" - ); - test_display( - [0xf6, 0x57, 0x15, 0xa9], - "stp x22, x21, [sp, #0x150]" - ); - test_display( - [0xf6, 0x57, 0x18, 0xa9], - "stp x22, x21, [sp, #0x180]" - ); - test_display( - [0xf6, 0x57, 0x4f, 0xa9], - "ldp x22, x21, [sp, #0xf0]" - ); - test_display( - [0xf6, 0x57, 0x55, 0xa9], - "ldp x22, x21, [sp, #0x150]" - ); - test_display( - [0xf6, 0x57, 0x58, 0xa9], - "ldp x22, x21, [sp, #0x180]" - ); - test_display( - [0xf6, 0x57, 0xbd, 0xa9], - "stp x22, x21, [sp, #-0x30]!" - ); - test_display( - [0xf6, 0x57, 0xc3, 0xa8], - "ldp x22, x21, [sp], #0x30" - ); - test_display( - [0xf6, 0xe3, 0x00, 0x91], - "add x22, sp, #0x38" - ); - test_display( - [0xf7, 0xe3, 0x00, 0x91], - "add x23, sp, #0x38" - ); - test_display( - [0xf8, 0x5f, 0x14, 0xa9], - "stp x24, x23, [sp, #0x140]" - ); - test_display( - [0xf8, 0x5f, 0x54, 0xa9], - "ldp x24, x23, [sp, #0x140]" - ); - test_display( - [0xfc, 0x5f, 0x0e, 0xa9], - "stp x28, x23, [sp, #0xe0]" - ); - test_display( - [0xfc, 0x5f, 0x17, 0xa9], - "stp x28, x23, [sp, #0x170]" - ); - test_display( - [0xfc, 0x5f, 0x4e, 0xa9], - "ldp x28, x23, [sp, #0xe0]" - ); - test_display( - [0xfc, 0x5f, 0x57, 0xa9], - "ldp x28, x23, [sp, #0x170]" - ); - test_display( - [0xfc, 0x9b, 0x00, 0xf9], - "str x28, [sp, #0x130]" - ); - test_display( - [0xfd, 0x03, 0x00, 0x91], - "mov x29, sp" - ); - test_display( - [0xfd, 0x03, 0x03, 0x91], - "add x29, sp, #0xc0" - ); - test_display( - [0xfd, 0x43, 0x00, 0x91], - "add x29, sp, #0x10" - ); - test_display( - [0xfd, 0x43, 0x03, 0x91], - "add x29, sp, #0xd0" - ); - test_display( - [0xfd, 0x43, 0x04, 0x91], - "add x29, sp, #0x110" - ); - test_display( - [0xfd, 0x7b, 0x01, 0xa9], - "stp x29, x30, [sp, #0x10]" - ); - test_display( - [0xfd, 0x7b, 0x02, 0xa9], - "stp x29, x30, [sp, #0x20]" - ); - test_display( - [0xfd, 0x7b, 0x03, 0xa9], - "stp x29, x30, [sp, #0x30]" - ); - test_display( - [0xfd, 0x7b, 0x0c, 0xa9], - "stp x29, x30, [sp, #0xc0]" - ); - test_display( - [0xfd, 0x7b, 0x0d, 0xa9], - "stp x29, x30, [sp, #0xd0]" - ); - test_display( - [0xfd, 0x7b, 0x11, 0xa9], - "stp x29, x30, [sp, #0x110]" - ); - test_display( - [0xfd, 0x7b, 0x17, 0xa9], - "stp x29, x30, [sp, #0x170]" - ); - test_display( - [0xfd, 0x7b, 0x1a, 0xa9], - "stp x29, x30, [sp, #0x1a0]" - ); - test_display( - [0xfd, 0x7b, 0x41, 0xa9], - "ldp x29, x30, [sp, #0x10]" - ); - test_display( - [0xfd, 0x7b, 0x42, 0xa9], - "ldp x29, x30, [sp, #0x20]" - ); - test_display( - [0xfd, 0x7b, 0x43, 0xa9], - "ldp x29, x30, [sp, #0x30]" - ); - test_display( - [0xfd, 0x7b, 0x4c, 0xa9], - "ldp x29, x30, [sp, #0xc0]" - ); - test_display( - [0xfd, 0x7b, 0x4d, 0xa9], - "ldp x29, x30, [sp, #0xd0]" - ); - test_display( - [0xfd, 0x7b, 0x51, 0xa9], - "ldp x29, x30, [sp, #0x110]" - ); - test_display( - [0xfd, 0x7b, 0x57, 0xa9], - "ldp x29, x30, [sp, #0x170]" - ); - test_display( - [0xfd, 0x7b, 0x5a, 0xa9], - "ldp x29, x30, [sp, #0x1a0]" - ); - test_display( - [0xfd, 0x7b, 0xbe, 0xa9], - "stp x29, x30, [sp, #-0x20]!" - ); - test_display( - [0xfd, 0x7b, 0xbf, 0xa9], - "stp x29, x30, [sp, #-0x10]!" - ); - test_display( - [0xfd, 0x7b, 0xc1, 0xa8], - "ldp x29, x30, [sp], #0x10" - ); - test_display( - [0xfd, 0x7b, 0xc2, 0xa8], - "ldp x29, x30, [sp], #0x20" - ); - test_display( - [0xfd, 0x83, 0x00, 0x91], - "add x29, sp, #0x20" - ); - test_display( - [0xfd, 0x83, 0x06, 0x91], - "add x29, sp, #0x1a0" - ); - test_display( - [0xfd, 0xc3, 0x00, 0x91], - "add x29, sp, #0x30" - ); - test_display( - [0xfd, 0xc3, 0x05, 0x91], - "add x29, sp, #0x170" - ); - test_display( - [0xff, 0x1f, 0x00, 0xf9], - "str xzr, [sp, #0x38]" - ); - test_display( - [0xe3, 0x07, 0x00, 0x32], - "mov w3, #0x3" - ); - test_display( - [0xff, 0xff, 0x01, 0xa9], - "stp xzr, xzr, [sp, #0x18]" - ); - test_display( - [0x7f, 0x02, 0x00, 0xb9], - "str wzr, [x19]" - ); - test_display( - [0x7f, 0x36, 0x00, 0xf9], - "str xzr, [x19, #0x68]" - ); - test_display( - [0x7f, 0x3a, 0x00, 0xf9], - "str xzr, [x19, #0x70]" - ); - test_display( - [0x7f, 0x3e, 0x00, 0xf9], - "str xzr, [x19, #0x78]" - ); - test_display( - [0x9f, 0x3e, 0x00, 0xf9], - "str xzr, [x20, #0x78]" - ); - test_display( - [0x9f, 0xfe, 0x06, 0xa9], - "stp xzr, xzr, [x20, #0x68]" - ); - test_display( - [0xbf, 0x03, 0x18, 0xf8], - "stur xzr, [x29, #-0x80]" - ); - test_display( - [0xbf, 0x42, 0x00, 0xb1], - "cmn x21, #0x10" - ); - test_display( - [0xbf, 0x83, 0x19, 0xf8], - "stur xzr, [x29, #-0x68]" - ); - test_display( - [0xbf, 0xff, 0x38, 0xa9], - "stp xzr, xzr, [x29, #-0x78]" - ); - test_display( - [0xff, 0x03, 0x01, 0x91], - "add sp, sp, #0x40" - ); - test_display( - [0xff, 0x03, 0x01, 0xd1], - "sub sp, sp, #0x40" - ); - test_display( - [0xff, 0x03, 0x06, 0x91], - "add sp, sp, #0x180" - ); - test_display( - [0xff, 0x03, 0x06, 0xd1], - "sub sp, sp, #0x180" - ); - test_display( - [0xff, 0x43, 0x01, 0xd1], - "sub sp, sp, #0x50" - ); - test_display( - [0xff, 0x43, 0x03, 0x91], - "add sp, sp, #0xd0" - ); - test_display( - [0xff, 0x43, 0x03, 0xd1], - "sub sp, sp, #0xd0" - ); - test_display( - [0xff, 0x83, 0x03, 0x91], - "add sp, sp, #0xe0" - ); - test_display( - [0xff, 0x83, 0x03, 0xd1], - "sub sp, sp, #0xe0" - ); - test_display( - [0xff, 0x83, 0x04, 0x91], - "add sp, sp, #0x120" - ); - test_display( - [0xff, 0x83, 0x04, 0xd1], - "sub sp, sp, #0x120" - ); - test_display( - [0xff, 0xc3, 0x00, 0x91], - "add sp, sp, #0x30" - ); - test_display( - [0xff, 0xc3, 0x00, 0xd1], - "sub sp, sp, #0x30" - ); - test_display( - [0xff, 0xc3, 0x06, 0x91], - "add sp, sp, #0x1b0" - ); - test_display( - [0xff, 0xc3, 0x06, 0xd1], - "sub sp, sp, #0x1b0" - ); - test_display( - [0xe0, 0x03, 0x01, 0xaa], - "mov x0, x1" - ); - test_display( - [0xf4, 0x03, 0x00, 0x2a], - "mov w20, w0" - ); - test_display( - [0xe1, 0x03, 0x1f, 0xaa], - "mov x1, xzr" - ); - test_display( - [0xe2, 0x03, 0x1f, 0xaa], - "mov x2, xzr" - ); - test_display( - [0xe3, 0x03, 0x1f, 0xaa], - "mov x3, xzr" - ); - test_display( - [0xe0, 0x03, 0x13, 0x2a], - "mov w0, w19" - ); - test_display( - [0xe0, 0x03, 0x13, 0xaa], - "mov x0, x19" - ); - test_display( - [0xe0, 0x03, 0x14, 0x2a], - "mov w0, w20" - ); - test_display( - [0xe0, 0x03, 0x14, 0xaa], - "mov x0, x20" - ); - test_display( - [0xe0, 0x03, 0x15, 0xaa], - "mov x0, x21" - ); - test_display( - [0xe0, 0x03, 0x16, 0xaa], - "mov x0, x22" - ); - test_display( - [0xe0, 0x03, 0x17, 0xaa], - "mov x0, x23" - ); - test_display( - [0xe0, 0x03, 0x1f, 0x2a], - "mov w0, wzr" - ); - test_display( - [0xe1, 0x03, 0x00, 0xaa], - "mov x1, x0" - ); - test_display( - [0xe1, 0x03, 0x13, 0xaa], - "mov x1, x19" - ); - test_display( - [0xe1, 0x03, 0x14, 0x2a], - "mov w1, w20" - ); - test_display( - [0xe1, 0x03, 0x14, 0xaa], - "mov x1, x20" - ); - test_display( - [0xe1, 0x03, 0x15, 0x2a], - "mov w1, w21" - ); - test_display( - [0xe1, 0x03, 0x15, 0xaa], - "mov x1, x21" - ); - test_display( - [0xe1, 0x03, 0x16, 0xaa], - "mov x1, x22" - ); - test_display( - [0xe2, 0x03, 0x1f, 0x2a], - "mov w2, wzr" - ); - test_display( - [0xe4, 0x03, 0x00, 0x2a], - "mov w4, w0" - ); - test_display( - [0xe8, 0x03, 0x1f, 0xaa], - "mov x8, xzr" - ); - test_display( - [0xea, 0x03, 0x08, 0x2a], - "mov w10, w8" - ); - test_display( - [0xeb, 0x03, 0x09, 0x2a], - "mov w11, w9" - ); - test_display( - [0xf3, 0x03, 0x00, 0x2a], - "mov w19, w0" - ); - test_display( - [0xf4, 0x03, 0x15, 0x2a], - "mov w20, w21" - ); - test_display( - [0xf4, 0x03, 0x1f, 0x2a], - "mov w20, wzr" - ); - test_display( - [0xf5, 0x03, 0x1f, 0x2a], - "mov w21, wzr" - ); - test_display( - [0xf6, 0x03, 0x14, 0x2a], - "mov w22, w20" - ); - test_display( - [0xf8, 0x03, 0x16, 0x2a], - "mov w24, w22" - ); - test_display( - [0xe2, 0x03, 0x15, 0xaa], - "mov x2, x21" - ); - test_display( - [0xe3, 0x03, 0x14, 0xaa], - "mov x3, x20" - ); - test_display( - [0xe4, 0x03, 0x08, 0xaa], - "mov x4, x8" - ); - test_display( - [0xe4, 0x03, 0x14, 0xaa], - "mov x4, x20" - ); - test_display( - [0xe5, 0x03, 0x00, 0xaa], - "mov x5, x0" - ); - test_display( - [0xe8, 0x03, 0x00, 0xaa], - "mov x8, x0" - ); - test_display( - [0xf3, 0x03, 0x00, 0xaa], - "mov x19, x0" - ); - test_display( - [0xf3, 0x03, 0x01, 0x2a], - "mov w19, w1" - ); - test_display( - [0xf3, 0x03, 0x01, 0xaa], - "mov x19, x1" - ); - test_display( - [0xf3, 0x03, 0x02, 0xaa], - "mov x19, x2" - ); - test_display( - [0xf3, 0x0b, 0x00, 0xf9], - "str x19, [sp, #0x10]" - ); - test_display( - [0xf4, 0x03, 0x00, 0xaa], - "mov x20, x0" - ); - test_display( - [0xf4, 0x03, 0x01, 0xaa], - "mov x20, x1" - ); - test_display( - [0xf5, 0x03, 0x00, 0xaa], - "mov x21, x0" - ); - test_display( - [0xf6, 0x03, 0x00, 0xaa], - "mov x22, x0" - ); - test_display( - [0xf7, 0x03, 0x00, 0xaa], - "mov x23, x0" - ); -} - -static INSTRUCTION_BYTES: [u8; 4 * 61] = [ - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x20, 0xd4, - 0x00, 0x00, 0x80, 0x12, - 0x00, 0x01, 0x3f, 0xd6, - 0x00, 0x02, 0x00, 0x36, - 0x00, 0x03, 0x00, 0x35, - 0x00, 0x04, 0x00, 0x36, - 0x00, 0x04, 0x40, 0xf9, - 0x00, 0x07, 0x00, 0x34, - 0x00, 0x08, 0x47, 0xf9, - 0x00, 0x0b, 0x80, 0x52, - 0x00, 0x14, 0x42, 0xf9, - 0x00, 0x1b, 0x80, 0x52, - 0x00, 0x20, 0x40, 0xf9, - 0x00, 0x24, 0x47, 0xf9, - 0x00, 0x2b, 0x03, 0x90, - 0x00, 0x34, 0x42, 0xf9, - 0x00, 0x39, 0x04, 0xb0, - 0x00, 0x3b, 0x04, 0xb0, - 0x00, 0x3c, 0x43, 0xf9, - 0x00, 0x44, 0x44, 0xf9, - 0x00, 0x50, 0x14, 0x91, - 0x00, 0x54, 0x44, 0xf9, - 0x00, 0x58, 0x42, 0xf9, - 0x00, 0x5c, 0x44, 0xf9, - 0x00, 0x60, 0x1e, 0x91, - 0x00, 0x70, 0x47, 0xf9, - 0x00, 0x80, 0x1e, 0x91, - 0x00, 0x80, 0x44, 0xf9, - 0x00, 0x84, 0x47, 0xf9, - 0x00, 0xac, 0x40, 0xf9, - 0x00, 0xc0, 0x09, 0x91, - 0x00, 0xc4, 0x45, 0xf9, - 0x00, 0xcc, 0x41, 0xf9, - 0x00, 0xdc, 0x35, 0x91, - 0x00, 0xf4, 0x47, 0xf9, - 0x01, 0x00, 0x00, 0x14, - 0x01, 0x00, 0x40, 0xf9, - 0x01, 0x05, 0x40, 0xf9, - 0x01, 0xfb, 0x4b, 0x95, - 0x02, 0x00, 0x00, 0x14, - 0x02, 0x00, 0x00, 0x90, - 0x02, 0x00, 0x80, 0x92, - 0x02, 0x04, 0xf8, 0x97, - 0x02, 0x2c, 0x80, 0x52, - 0x08, 0x00, 0x40, 0xf9, - 0x08, 0x01, 0x40, 0xf9, - 0x08, 0x05, 0x40, 0xf9, - 0x08, 0x06, 0xf8, 0x97, - 0x08, 0x09, 0x40, 0xf9, - 0x08, 0x1d, 0x40, 0x92, - 0x08, 0x1f, 0x00, 0x13, - 0x08, 0x21, 0x0a, 0x91, - 0x08, 0x41, 0x00, 0x91, - 0x08, 0x41, 0x40, 0xf9, - 0x08, 0x81, 0x0a, 0x91, - 0x08, 0xa1, 0x11, 0x91, - 0x08, 0xc1, 0x1e, 0x91, - 0x08, 0xdd, 0x46, 0xf9, - 0x08, 0xe1, 0x0e, 0x91, - 0x08, 0xf2, 0xff, 0x36, -]; - -#[test] -fn test_decode_span() { - let mut i = 0u64; - while i < INSTRUCTION_BYTES.len() as u64 { - let mut reader = yaxpeax_arch::U8Reader::new(&INSTRUCTION_BYTES[i as usize..]); - let res = ::Decoder::default().decode(&mut reader); - if let Err(DecodeError::IncompleteDecoder) = res { - i += 4; - continue; - } - let instr = res.unwrap(); - println!( - "Decoded {:02x}{:02x}{:02x}{:02x}: {}", //{:?}\n {}", - INSTRUCTION_BYTES[i as usize], - INSTRUCTION_BYTES[i as usize + 1], - INSTRUCTION_BYTES[i as usize + 2], - INSTRUCTION_BYTES[i as usize + 3], -// instr, - instr); - i += 4; - } -} - -/* -use test::Bencher; -#[bench] -pub fn bench_60000_instrs(b: &mut Bencher) { - b.iter(|| { - for i in (0..1000) { - let mut iter = INSTRUCTION_BYTES.iter().map(|x| *x); - let decoder = ::Decoder::default(); - let mut result = Instruction::default(); - loop { - match decoder.decode_into(&mut result, &mut iter) { - Ok(result) => { - test::black_box(&result); - }, - Err(_) => { - break; - } - } - } - } - }); -} -*/ - -enum ErrorDesc { - IncorrectDecode([u8; 4], String, String), - FailedDecode([u8; 4], String, DecodeError), -} - -impl fmt::Display for ErrorDesc { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ErrorDesc::IncorrectDecode(bytes, expected, actual) => { - writeln!(f, " decoded incorrect instruction from {:02x}{:02x}{:02x}{:02x}", bytes[0], bytes[1], bytes[2], bytes[3])?; - writeln!(f, " expected \"{}\"", expected)?; - writeln!(f, " got \"{}\"", actual)?; - }, - ErrorDesc::FailedDecode(bytes, expected, err) => { - writeln!(f, " decode error for {:02x}{:02x}{:02x}{:02x}", bytes[0], bytes[1], bytes[2], bytes[3])?; - writeln!(f, " expected \"{}\"", expected)?; - writeln!(f, " got \"{:?}\"", err)?; - }, - } - - Ok(()) - } -} - -fn run_tests(cases: &[([u8; 4], &'static str)]) -> Vec { - let decoder = ::Decoder::default(); - - let mut errors = Vec::new(); - - for (bytes, text) in cases { - let mut reader = yaxpeax_arch::U8Reader::new(&bytes[..]); - match decoder.decode(&mut reader) { - Ok(result) => { - if &result.to_string() != text { - errors.push(ErrorDesc::IncorrectDecode(*bytes, text.to_string(), result.to_string())); - } - }, - Err(err) => { - errors.push(ErrorDesc::FailedDecode(*bytes, text.to_string(), err)); - } - } - } - - errors -} - -#[test] -fn test_openblas_arithmetic() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x61, 0x06, 0x13, 0x0b], "add w1, w19, w19, lsl #1"), - ([0x05, 0x07, 0x13, 0x0b], "add w5, w24, w19, lsl #1"), - ([0x08, 0x7d, 0x48, 0x0b], "add w8, w8, w8, lsr #31"), - ([0x00, 0x04, 0x00, 0x11], "add w0, w0, #0x1"), - ([0x00, 0x04, 0x01, 0x11], "add w0, w0, #0x41"), - ([0x5b, 0xff, 0x01, 0x11], "add w27, w26, #0x7f"), - ([0x02, 0xfc, 0x3f, 0x11], "add w2, w0, #0xfff"), - ([0x00, 0x00, 0x60, 0x11], "add w0, w0, #0x800, lsl #12"), - ([0x0a, 0x0c, 0x00, 0x31], "adds w10, w0, #0x3"), - ([0x82, 0x00, 0x00, 0x8b], "add x2, x4, x0"), - ([0x00, 0x35, 0x00, 0x8b], "add x0, x8, x0, lsl #13"), - ([0x00, 0x00, 0x01, 0x8b], "add x0, x0, x1"), - ([0xde, 0x03, 0x12, 0x8b], "add x30, x30, x18"), - ([0x03, 0x04, 0x12, 0x8b], "add x3, x0, x18, lsl #1"), - ([0x56, 0x06, 0x12, 0x8b], "add x22, x18, x18, lsl #1"), - ([0x12, 0x08, 0x12, 0x8b], "add x18, x0, x18, lsl #2"), - ([0x32, 0x08, 0x12, 0x8b], "add x18, x1, x18, lsl #2"), - ([0x92, 0x13, 0x12, 0x8b], "add x18, x28, x18, lsl #4"), - ([0x4f, 0x14, 0x12, 0x8b], "add x15, x2, x18, lsl #5"), - ([0x42, 0x18, 0x12, 0x8b], "add x2, x2, x18, lsl #6"), - ([0xc6, 0x1c, 0x12, 0x8b], "add x6, x6, x18, lsl #7"), - ([0x62, 0xce, 0x21, 0x8b], "add x2, x19, w1, sxtw #3"), - ([0x87, 0xd3, 0x21, 0x8b], "add x7, x28, w1, sxtw #4"), - ([0x2a, 0x41, 0x22, 0x8b], "add x10, x9, w2"), - ([0x18, 0x4f, 0x22, 0x8b], "add x24, x24, w2, lsl #3"), - ([0x82, 0x4f, 0x22, 0x8b], "add x2, x28, w2, lsl #3"), - ([0xe2, 0x50, 0x22, 0x8b], "add x2, x7, w2, lsl #4"), - ([0x20, 0x04, 0x84, 0x8b], "add x0, x1, x4, asr #1"), - ([0x14, 0x04, 0x94, 0x8b], "add x20, x0, x20, asr #1"), - ([0xe6, 0x62, 0x00, 0x91], "add x6, x23, #0x18"), - ([0x00, 0x80, 0x04, 0x91], "add x0, x0, #0x120"), - ([0xf8, 0x63, 0x06, 0x91], "add x24, sp, #0x198"), - ([0xb7, 0xfc, 0x3f, 0x91], "add x23, x5, #0xfff"), - ([0x5a, 0xff, 0x3f, 0x91], "add x26, x26, #0xfff"), - ([0x7b, 0xff, 0x3f, 0x91], "add x27, x27, #0xfff"), - ([0x9c, 0xff, 0x3f, 0x91], "add x28, x28, #0xfff"), - ([0xc6, 0x08, 0x40, 0x91], "add x6, x6, #0x2, lsl #12"), - ([0xe8, 0x13, 0x40, 0x91], "add x8, sp, #0x4, lsl #12"), - ([0xe2, 0x43, 0x40, 0x91], "add x2, sp, #0x10, lsl #12"), - ([0xff, 0x0f, 0x42, 0x91], "add sp, sp, #0x83, lsl #12"), - ([0xe1, 0x13, 0x42, 0x91], "add x1, sp, #0x84, lsl #12"), - ([0xff, 0x13, 0x42, 0x91], "add sp, sp, #0x84, lsl #12"), - ([0x63, 0x02, 0x60, 0x91], "add x3, x19, #0x800, lsl #12"), - ([0x03, 0x03, 0x60, 0x91], "add x3, x24, #0x800, lsl #12"), - ([0x14, 0x00, 0x13, 0xab], "adds x20, x0, x19"), - ([0x37, 0x01, 0x1c, 0xab], "adds x23, x9, x28"), - ([0x0b, 0x08, 0x00, 0x4b], "sub w11, w0, w0, lsl #2"), - ([0x00, 0x00, 0x01, 0x4b], "sub w0, w0, w1"), - ([0xfc, 0x03, 0x08, 0x4b], "neg w28, w8"), - ([0x00, 0x04, 0x08, 0x4b], "sub w0, w0, w8, lsl #1"), - ([0x81, 0x09, 0x0c, 0x4b], "sub w1, w12, w12, lsl #2"), - ([0xe0, 0x02, 0x0d, 0x4b], "sub w0, w23, w13"), - ([0xfb, 0x03, 0x15, 0x4b], "neg w27, w21"), - ([0x63, 0x04, 0x15, 0x4b], "sub w3, w3, w21, lsl #1"), - ([0xfc, 0x03, 0x1c, 0x4b], "neg w28, w28"), - ([0x00, 0x04, 0x1c, 0x4b], "sub w0, w0, w28, lsl #1"), - ([0x00, 0x7c, 0x81, 0x4b], "sub w0, w0, w1, asr #31"), - ([0x6e, 0x7c, 0x8e, 0x4b], "sub w14, w3, w14, asr #31"), - ([0x4c, 0x04, 0x00, 0x51], "sub w12, w2, #0x1"), - ([0x67, 0x0f, 0x00, 0x51], "sub w7, w27, #0x3"), - ([0x04, 0x11, 0x00, 0x51], "sub w4, w8, #0x4"), - ([0x42, 0x1c, 0x00, 0x51], "sub w2, w2, #0x7"), - ([0xc5, 0x20, 0x00, 0x51], "sub w5, w6, #0x8"), - ([0x08, 0x25, 0x00, 0x51], "sub w8, w8, #0x9"), - ([0x00, 0x2c, 0x00, 0x51], "sub w0, w0, #0xb"), - ([0x00, 0x30, 0x00, 0x51], "sub w0, w0, #0xc"), - ([0x2d, 0x30, 0x00, 0x51], "sub w13, w1, #0xc"), - ([0x21, 0x34, 0x00, 0x51], "sub w1, w1, #0xd"), - ([0xb8, 0x46, 0x00, 0x51], "sub w24, w21, #0x11"), - ([0xe0, 0x84, 0x01, 0x51], "sub w0, w7, #0x61"), - ([0x0c, 0x01, 0x00, 0x6b], "subs w12, w8, w0"), - ([0xe2, 0x03, 0x00, 0x6b], "negs w2, w0"), - ([0x21, 0x04, 0x00, 0x71], "subs w1, w1, #0x1"), - ([0x25, 0x04, 0x00, 0x71], "subs w5, w1, #0x1"), - ([0x2c, 0x04, 0x00, 0x71], "subs w12, w1, #0x1"), - ([0x3a, 0x04, 0x00, 0x71], "subs w26, w1, #0x1"), - ([0xe3, 0x13, 0x02, 0xcb], "neg x3, x2, lsl #4"), - ([0xeb, 0x0f, 0x03, 0xcb], "neg x11, x3, lsl #3"), - ([0x75, 0x08, 0x02, 0xcb], "sub x21, x3, x2, lsl #2"), - ([0xa3, 0x00, 0x03, 0xcb], "sub x3, x5, x3"), - ([0x81, 0x08, 0x03, 0xcb], "sub x1, x4, x3, lsl #2"), - ([0x70, 0x12, 0x15, 0xcb], "sub x16, x19, x21, lsl #4"), - ([0xc6, 0x40, 0x20, 0xcb], "sub x6, x6, w0"), - ([0x24, 0x50, 0x20, 0xcb], "sub x4, x1, w0, lsl #4"), - ([0x8a, 0xc1, 0x20, 0xcb], "sub x10, x12, w0, sxtw"), - ([0xbb, 0xcc, 0x20, 0xcb], "sub x27, x5, w0, sxtw #3"), - ([0xd6, 0x04, 0x00, 0xd1], "sub x22, x6, #0x1"), - ([0xc7, 0x40, 0x10, 0xd1], "sub x7, x6, #0x410"), - ([0x7b, 0x43, 0x10, 0xd1], "sub x27, x27, #0x410"), - ([0xff, 0xc3, 0x27, 0xd1], "sub sp, sp, #0x9f0"), - ([0xec, 0x03, 0x42, 0xd1], "sub x12, sp, #0x80, lsl #12"), - ([0x97, 0x02, 0x1b, 0xeb], "subs x23, x20, x27"), - ([0x98, 0x02, 0x1b, 0xeb], "subs x24, x20, x27"), - ([0x6b, 0x05, 0x00, 0xf1], "subs x11, x11, #0x1"), - ([0x5a, 0x07, 0x00, 0xf1], "subs x26, x26, #0x1"), - ([0x08, 0x09, 0x00, 0xf1], "subs x8, x8, #0x2"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_bitwise() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x94, 0x7c, 0x01, 0x13], "asr w20, w4, #0x1"), - ([0x0a, 0x7d, 0x02, 0x13], "asr w10, w8, #0x2"), - ([0x00, 0x7c, 0x0c, 0x13], "asr w0, w0, #0xc"), - ([0x20, 0x04, 0x81, 0x13], "ror w0, w1, #0x1"), - ([0x61, 0x21, 0xc0, 0x1a], "lsl w1, w11, w0"), - ([0x00, 0x20, 0xc1, 0x1a], "lsl w0, w0, w1"), - ([0x94, 0x22, 0xc1, 0x1a], "lsl w20, w20, w1"), - ([0x63, 0x20, 0xc2, 0x1a], "lsl w3, w3, w2"), - ([0x03, 0x7c, 0x01, 0x53], "lsr w3, w0, #0x1"), - ([0x23, 0x7c, 0x02, 0x53], "lsr w3, w1, #0x2"), - ([0x00, 0x7c, 0x06, 0x53], "lsr w0, w0, #0x6"), - ([0x42, 0x7c, 0x07, 0x53], "lsr w2, w2, #0x7"), - ([0x00, 0x4c, 0x14, 0x53], "lsl w0, w0, #0xc"), - ([0xe0, 0x56, 0x16, 0x53], "lsl w0, w23, #0xa"), - ([0x20, 0x7c, 0x18, 0x53], "lsr w0, w1, #0x18"), - ([0x35, 0x6c, 0x1c, 0x53], "lsl w21, w1, #0x4"), - ([0x2c, 0x70, 0x1d, 0x53], "lsl w12, w1, #0x3"), - ([0xa8, 0x74, 0x1e, 0x53], "lsl w8, w5, #0x2"), - ([0x23, 0x7b, 0x1f, 0x53], "lsl w3, w25, #0x1"), - ([0x04, 0x7f, 0x1f, 0x53], "lsr w4, w24, #0x1f"), - ([0x05, 0xfe, 0x41, 0xd3], "lsr x5, x16, #0x1"), - ([0x22, 0x3c, 0x44, 0xd3], "ubfx x2, x1, #0x4, #0xc"), - ([0xb5, 0xfe, 0x46, 0xd3], "lsr x21, x21, #0x6"), - ([0xe7, 0xfc, 0x60, 0xd3], "lsr x7, x7, #0x20"), - ([0x21, 0xfc, 0x61, 0xd3], "lsr x1, x1, #0x21"), - ([0x00, 0xfc, 0x63, 0xd3], "lsr x0, x0, #0x23"), - ([0xa6, 0xd4, 0x76, 0xd3], "lsl x6, x5, #0xa"), - ([0x03, 0x08, 0x7a, 0xd3], "ubfiz x3, x0, #0x6, #0x3"), - ([0xa1, 0x7e, 0x79, 0x93], "sbfiz x1, x21, #0x7, #0x20"), - ([0x01, 0x7c, 0x7a, 0x93], "sbfiz x1, x0, #0x6, #0x20"), - ([0x9a, 0x7c, 0x7d, 0x93], "sbfiz x26, x4, #0x3, #0x20"), - ([0xc3, 0x0f, 0x7a, 0xd3], "ubfiz x3, x30, #0x6, #0x4"), - ([0x01, 0xe4, 0x7a, 0xd3], "lsl x1, x0, #0x6"), - ([0x65, 0xe8, 0x7b, 0xd3], "lsl x5, x3, #0x5"), - ([0x79, 0xf3, 0x7d, 0xd3], "lsl x25, x27, #0x3"), - ([0x81, 0x7d, 0x7f, 0xd3], "ubfiz x1, x12, #0x1, #0x20"), - ([0x0e, 0xf8, 0x7f, 0xd3], "lsl x14, x0, #0x1"), - ([0xe9, 0x22, 0xce, 0x9a], "lsl x9, x23, x14"), - ([0xca, 0xff, 0x7f, 0xd3], "lsr x10, x30, #0x3f"), - ([0xd3, 0x7f, 0x40, 0x93], "sxtw x19, w30"), - ([0x00, 0xfc, 0x62, 0x93], "asr x0, x0, #0x22"), - ([0x20, 0x00, 0x00, 0x0a], "and w0, w1, w0"), - ([0x28, 0x00, 0x00, 0x0a], "and w8, w1, w0"), - ([0x29, 0x00, 0x00, 0x0a], "and w9, w1, w0"), - ([0xb5, 0x02, 0x22, 0x0a], "bic w21, w21, w2"), - ([0x00, 0x2c, 0x00, 0x12], "and w0, w0, #0xfff"), - ([0x42, 0x2c, 0x00, 0x12], "and w2, w2, #0xfff"), - ([0x00, 0x00, 0x01, 0x12], "and w0, w0, #0x80000000"), - ([0x21, 0x00, 0x01, 0x12], "and w1, w1, #0x80000000"), - ([0x10, 0x00, 0x18, 0x12], "and w16, w0, #0x100"), - ([0x11, 0x00, 0x18, 0x12], "and w17, w0, #0x100"), - ([0x06, 0x79, 0x1a, 0x12], "and w6, w8, #0xffffffdf"), - ([0x08, 0x79, 0x1a, 0x12], "and w8, w8, #0xffffffdf"), - ([0x02, 0x70, 0x1d, 0x12], "and w2, w0, #0xfffffff8"), - ([0x00, 0x74, 0x1e, 0x12], "and w0, w0, #0xfffffffc"), - ([0x02, 0x74, 0x1e, 0x12], "and w2, w0, #0xfffffffc"), - ([0x00, 0x78, 0x1e, 0x12], "and w0, w0, #0xfffffffd"), - ([0x02, 0x78, 0x1e, 0x12], "and w2, w0, #0xfffffffd"), - ([0xc6, 0x78, 0x1e, 0x12], "and w6, w6, #0xfffffffd"), - ([0x10, 0x7a, 0x1e, 0x12], "and w16, w16, #0xfffffffd"), - ([0x39, 0x7b, 0x1f, 0x12], "and w25, w25, #0xfffffffe"), - ([0x63, 0x00, 0x05, 0x6a], "ands w3, w3, w5"), - ([0x00, 0x04, 0x00, 0x72], "ands w0, w0, #0x3"), - ([0xc6, 0x04, 0x00, 0x72], "ands w6, w6, #0x3"), - ([0x00, 0x78, 0x1e, 0x72], "ands w0, w0, #0xfffffffd"), - ([0x21, 0x78, 0x1e, 0x72], "ands w1, w1, #0xfffffffd"), - ([0x40, 0x00, 0x00, 0x8a], "and x0, x2, x0"), - ([0x84, 0x00, 0x1c, 0x8a], "and x4, x4, x28"), - ([0x01, 0x00, 0x40, 0x92], "and x1, x0, #0x1"), - ([0x02, 0x00, 0x40, 0x92], "and x2, x0, #0x1"), - ([0xa5, 0xf0, 0x7d, 0x92], "and x5, x5, #0xfffffffffffffff8"), - ([0x00, 0x03, 0x7e, 0x92], "and x0, x24, #0x4"), - ([0xc1, 0x06, 0x7e, 0x92], "and x1, x22, #0xc"), - ([0x42, 0xf4, 0x7e, 0x92], "and x2, x2, #0xfffffffffffffffc"), - ([0x01, 0x00, 0x7f, 0x92], "and x1, x0, #0x2"), - ([0xe0, 0x01, 0x7f, 0x92], "and x0, x15, #0x2"), - ([0x75, 0x02, 0x7f, 0x92], "and x21, x19, #0x2"), - ([0x76, 0x02, 0x7f, 0x92], "and x22, x19, #0x2"), - ([0x8e, 0x02, 0x7f, 0x92], "and x14, x20, #0x2"), - ([0x9a, 0x02, 0x7f, 0x92], "and x26, x20, #0x2"), - ([0x9b, 0x02, 0x7f, 0x92], "and x27, x20, #0x2"), - ([0xc1, 0x06, 0x7f, 0x92], "and x1, x22, #0x6"), - ([0x00, 0x07, 0x7f, 0x92], "and x0, x24, #0x6"), - ([0x01, 0x08, 0x7f, 0x92], "and x1, x0, #0xe"), - ([0xc1, 0x0a, 0x7f, 0x92], "and x1, x22, #0xe"), - ([0x6b, 0xfa, 0x7f, 0x92], "and x11, x19, #0xfffffffffffffffe"), - ([0x80, 0xfb, 0x7f, 0x92], "and x0, x28, #0xfffffffffffffffe"), - ([0x0c, 0x04, 0x40, 0xf2], "ands x12, x0, #0x3"), - ([0x88, 0x0a, 0x40, 0xf2], "ands x8, x20, #0x7"), - ([0x01, 0x10, 0x40, 0xf2], "ands x1, x0, #0x1f"), - ([0x05, 0x10, 0x40, 0xf2], "ands x5, x0, #0x1f"), - ([0x0c, 0x10, 0x40, 0xf2], "ands x12, x0, #0x1f"), - ([0x48, 0x10, 0x40, 0xf2], "ands x8, x2, #0x1f"), - ([0x05, 0x14, 0x40, 0xf2], "ands x5, x0, #0x3f"), - ([0x48, 0x18, 0x40, 0xf2], "ands x8, x2, #0x7f"), - ([0x02, 0xe8, 0x7b, 0xf2], "ands x2, x0, #0xffffffffffffffe0"), - ([0x07, 0xf4, 0x7e, 0xf2], "ands x7, x0, #0xfffffffffffffffc"), - ([0x20, 0x00, 0x00, 0x4a], "eor w0, w1, w0"), - ([0x99, 0x02, 0x04, 0x4a], "eor w25, w20, w4"), - ([0xa6, 0x00, 0x00, 0x52], "eor w6, w5, #0x1"), - ([0x48, 0x01, 0x08, 0xca], "eor x8, x10, x8"), - ([0xe7, 0xf0, 0x7d, 0xd2], "eor x7, x7, #0xfffffffffffffff8"), - ([0x81, 0x12, 0x17, 0x2a], "orr w1, w20, w23, lsl #4"), - ([0x29, 0x03, 0x1c, 0x2a], "orr w9, w25, w28"), - ([0x73, 0x7d, 0x4d, 0x2a], "orr w19, w11, w13, lsr #31"), - ([0x00, 0x7c, 0x54, 0x2a], "orr w0, w0, w20, lsr #31"), - ([0x20, 0x00, 0x00, 0x32], "orr w0, w1, #0x1"), - ([0x80, 0x02, 0x00, 0x32], "orr w0, w20, #0x1"), - ([0x12, 0x00, 0x11, 0x32], "orr w18, w0, #0x8000"), - ([0x1e, 0x00, 0x11, 0x32], "orr w30, w0, #0x8000"), - ([0x08, 0x01, 0x1c, 0x32], "orr w8, w8, #0x10"), - ([0x81, 0x02, 0x1c, 0x32], "orr w1, w20, #0x10"), - ([0x82, 0x02, 0x1c, 0x32], "orr w2, w20, #0x10"), - ([0x94, 0x02, 0x1c, 0x32], "orr w20, w20, #0x10"), - ([0x20, 0x00, 0x1e, 0x32], "orr w0, w1, #0x4"), - ([0x73, 0x02, 0x1e, 0x32], "orr w19, w19, #0x4"), - ([0x80, 0x02, 0x1e, 0x32], "orr w0, w20, #0x4"), - ([0x94, 0x02, 0x1e, 0x32], "orr w20, w20, #0x4"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_simd_loadstore() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0xd8, 0x21, 0x5e], "scvtf s0, s0"), - ([0x82, 0xd8, 0x61, 0x5e], "scvtf d2, d4"), - ([0x01, 0x00, 0x62, 0x9e], "scvtf d1, x0"), - ([0x03, 0x00, 0x62, 0x9e], "scvtf d3, x0"), - ([0x69, 0x03, 0x62, 0x9e], "scvtf d9, x27"), - ([0x88, 0x03, 0x62, 0x9e], "scvtf d8, x28"), - ([0x22, 0x00, 0x22, 0x1e], "scvtf s2, w1"), - ([0xac, 0x02, 0x22, 0x1e], "scvtf s12, w21"), - ([0x00, 0x00, 0x62, 0x1e], "scvtf d0, w0"), - ([0x8a, 0x03, 0x62, 0x1e], "scvtf d10, w28"), - ([0x03, 0xe4, 0x00, 0x2f], "movi d3, #0x0"), - ([0x88, 0x28, 0x00, 0x0c], "st1 {v8.2s, v9.2s, v10.2s, v11.2s}, [x4]"), - ([0x80, 0x2c, 0x00, 0x0c], "st1 {v0.1d, v1.1d, v2.1d, v3.1d}, [x4]"), - ([0x84, 0x2c, 0x00, 0x0c], "st1 {v4.1d, v5.1d, v6.1d, v7.1d}, [x4]"), - ([0x80, 0x2d, 0x00, 0x0c], "st1 {v0.1d, v1.1d, v2.1d, v3.1d}, [x12]"), - ([0x20, 0x2e, 0x00, 0x0c], "st1 {v0.1d, v1.1d, v2.1d, v3.1d}, [x17]"), - ([0x24, 0x2e, 0x00, 0x0c], "st1 {v4.1d, v5.1d, v6.1d, v7.1d}, [x17]"), - ([0x60, 0x78, 0x00, 0x0c], "st1 {v0.2s}, [x3]"), - ([0x62, 0x78, 0x00, 0x0c], "st1 {v2.2s}, [x3]"), - ([0x88, 0x79, 0x00, 0x0c], "st1 {v8.2s}, [x12]"), - ([0xac, 0x79, 0x00, 0x0c], "st1 {v12.2s}, [x13]"), - ([0xc8, 0x79, 0x00, 0x0c], "st1 {v8.2s}, [x14]"), - ([0xa0, 0x89, 0x00, 0x0c], "st2 {v0.2s, v1.2s}, [x13]"), - ([0xa4, 0x89, 0x00, 0x0c], "st2 {v4.2s, v5.2s}, [x13]"), - ([0x88, 0xa9, 0x00, 0x0c], "st1 {v8.2s, v9.2s}, [x12]"), - ([0xa0, 0xa9, 0x00, 0x0c], "st1 {v0.2s, v1.2s}, [x13]"), - ([0xa2, 0xa9, 0x00, 0x0c], "st1 {v2.2s, v3.2s}, [x13]"), - ([0xac, 0xa9, 0x00, 0x0c], "st1 {v12.2s, v13.2s}, [x13]"), - ([0xc4, 0xa9, 0x00, 0x0c], "st1 {v4.2s, v5.2s}, [x14]"), - ([0xc6, 0xa9, 0x00, 0x0c], "st1 {v6.2s, v7.2s}, [x14]"), - ([0xc8, 0xa9, 0x00, 0x0c], "st1 {v8.2s, v9.2s}, [x14]"), - ([0x88, 0x79, 0x40, 0x0c], "ld1 {v8.2s}, [x12]"), - ([0xac, 0x79, 0x40, 0x0c], "ld1 {v12.2s}, [x13]"), - ([0x68, 0x89, 0x40, 0x0c], "ld2 {v8.2s, v9.2s}, [x11]"), - ([0x6a, 0x89, 0x40, 0x0c], "ld2 {v10.2s, v11.2s}, [x11]"), - ([0xa4, 0x89, 0x40, 0x0c], "ld2 {v4.2s, v5.2s}, [x13]"), - ([0xa2, 0xa9, 0x40, 0x0c], "ld1 {v2.2s, v3.2s}, [x13]"), - ([0xac, 0xa9, 0x40, 0x0c], "ld1 {v12.2s, v13.2s}, [x13]"), - ([0xa5, 0x79, 0x9f, 0x0c], "st1 {v5.2s}, [x13], #0x8"), - ([0x45, 0x79, 0xc2, 0x0c], "ld1 {v5.2s}, [x10], x2"), - ([0x20, 0x78, 0xdf, 0x0c], "ld1 {v0.2s}, [x1], #0x8"), - ([0xcc, 0x85, 0x00, 0x0d], "st1 {v12.d}[0], [x14]"), - ([0xa8, 0x91, 0x00, 0x0d], "st1 {v8.s}[1], [x13]"), - ([0xa0, 0x81, 0x20, 0x0d], "st2 {v0.s, v1.s}[0], [x13]"), - ([0x88, 0x81, 0x40, 0x0d], "ld1 {v8.s}[0], [x12]"), - ([0xa8, 0x91, 0x40, 0x0d], "ld1 {v8.s}[1], [x13]"), - ([0xa0, 0x85, 0x60, 0x0d], "ld2 {v0.d, v1.d}[0], [x13]"), - ([0x43, 0x81, 0x82, 0x0d], "st1 {v3.s}[0], [x10], x2"), - ([0x64, 0x90, 0x9f, 0x0d], "st1 {v4.s}[1], [x3], #0x4"), - ([0x22, 0x84, 0xc2, 0x0d], "ld1 {v2.d}[0], [x1], x2"), - ([0x61, 0x80, 0xc4, 0x0d], "ld1 {v1.s}[0], [x3], x4"), - ([0x24, 0xc9, 0xdf, 0x0d], "ld1r {v4.2s}, [x9], #0x4"), // TODO: could use a test for "ld1r {v4.2s}, [x9]" - ([0x88, 0x28, 0x00, 0x4c], "st1 {v8.4s, v9.4s, v10.4s, v11.4s}, [x4]"), - ([0x60, 0x2d, 0x00, 0x4c], "st1 {v0.2d, v1.2d, v2.2d, v3.2d}, [x11]"), - ([0x9c, 0x2e, 0x00, 0x4c], "st1 {v28.2d, v29.2d, v30.2d, v31.2d}, [x20]"), - ([0x60, 0x7c, 0x00, 0x4c], "st1 {v0.2d}, [x3]"), - ([0x62, 0x7c, 0x00, 0x4c], "st1 {v2.2d}, [x3]"), - ([0x88, 0x7d, 0x00, 0x4c], "st1 {v8.2d}, [x12]"), - ([0xac, 0x7d, 0x00, 0x4c], "st1 {v12.2d}, [x13]"), - ([0xc8, 0x7d, 0x00, 0x4c], "st1 {v8.2d}, [x14]"), - ([0xe6, 0x8d, 0x00, 0x4c], "st2 {v6.2d, v7.2d}, [x15]"), - ([0x00, 0xa3, 0x00, 0x4c], "st1 {v0.16b, v1.16b}, [x24]"), - ([0x60, 0xa3, 0x00, 0x4c], "st1 {v0.16b, v1.16b}, [x27]"), - ([0x00, 0xa9, 0x00, 0x4c], "st1 {v0.4s, v1.4s}, [x8]"), - ([0x44, 0xad, 0x00, 0x4c], "st1 {v4.2d, v5.2d}, [x10]"), - ([0x66, 0xad, 0x00, 0x4c], "st1 {v6.2d, v7.2d}, [x11]"), - ([0xc8, 0xad, 0x00, 0x4c], "st1 {v8.2d, v9.2d}, [x14]"), - ([0xec, 0xad, 0x00, 0x4c], "st1 {v12.2d, v13.2d}, [x15]"), - ([0x21, 0x28, 0x40, 0x4c], "ld1 {v1.4s, v2.4s, v3.4s, v4.4s}, [x1]"), - ([0x22, 0x2c, 0x40, 0x4c], "ld1 {v2.2d, v3.2d, v4.2d, v5.2d}, [x1]"), - ([0x61, 0x2c, 0x40, 0x4c], "ld1 {v1.2d, v2.2d, v3.2d, v4.2d}, [x3]"), - ([0xb0, 0x2c, 0x40, 0x4c], "ld1 {v16.2d, v17.2d, v18.2d, v19.2d}, [x5]"), - ([0x80, 0x2d, 0x40, 0x4c], "ld1 {v0.2d, v1.2d, v2.2d, v3.2d}, [x12]"), - ([0xa4, 0x2d, 0x40, 0x4c], "ld1 {v4.2d, v5.2d, v6.2d, v7.2d}, [x13]"), - ([0x68, 0x79, 0x40, 0x4c], "ld1 {v8.4s}, [x11]"), - ([0x6c, 0x79, 0x40, 0x4c], "ld1 {v12.4s}, [x11]"), - ([0x00, 0x7e, 0x40, 0x4c], "ld1 {v0.2d}, [x16]"), - ([0x30, 0x88, 0x40, 0x4c], "ld2 {v16.4s, v17.4s}, [x1]"), - ([0x32, 0x88, 0x40, 0x4c], "ld2 {v18.4s, v19.4s}, [x1]"), - ([0x7e, 0x8c, 0x40, 0x4c], "ld2 {v30.2d, v31.2d}, [x3]"), - ([0x68, 0x8d, 0x40, 0x4c], "ld2 {v8.2d, v9.2d}, [x11]"), - ([0x6a, 0x8d, 0x40, 0x4c], "ld2 {v10.2d, v11.2d}, [x11]"), - ([0x6c, 0x8d, 0x40, 0x4c], "ld2 {v12.2d, v13.2d}, [x11]"), - ([0x6e, 0x8d, 0x40, 0x4c], "ld2 {v14.2d, v15.2d}, [x11]"), - ([0x80, 0x8d, 0x40, 0x4c], "ld2 {v0.2d, v1.2d}, [x12]"), - ([0x82, 0x8d, 0x40, 0x4c], "ld2 {v2.2d, v3.2d}, [x12]"), - ([0xa0, 0x8d, 0x40, 0x4c], "ld2 {v0.2d, v1.2d}, [x13]"), - ([0xa4, 0x8d, 0x40, 0x4c], "ld2 {v4.2d, v5.2d}, [x13]"), - ([0xa6, 0x8d, 0x40, 0x4c], "ld2 {v6.2d, v7.2d}, [x13]"), - ([0xa3, 0x7c, 0x86, 0x4c], "st1 {v3.2d}, [x5], x6"), - ([0x61, 0x2c, 0x9f, 0x4c], "st1 {v1.2d, v2.2d, v3.2d, v4.2d}, [x3], #0x40"), - ([0xb0, 0x2c, 0x9f, 0x4c], "st1 {v16.2d, v17.2d, v18.2d, v19.2d}, [x5], #0x40"), - ([0x24, 0x78, 0x9f, 0x4c], "st1 {v4.4s}, [x1], #0x10"), - ([0xa5, 0x7d, 0x9f, 0x4c], "st1 {v5.2d}, [x13], #0x10"), - ([0xa4, 0x88, 0x9f, 0x4c], "st2 {v4.4s, v5.4s}, [x5], #0x20"), - ([0xc4, 0x88, 0x9f, 0x4c], "st2 {v4.4s, v5.4s}, [x6], #0x20"), - ([0xb0, 0xad, 0x9f, 0x4c], "st1 {v16.2d, v17.2d}, [x13], #0x20"), - ([0x20, 0x7c, 0xc2, 0x4c], "ld1 {v0.2d}, [x1], x2"), - ([0x46, 0x7d, 0xc6, 0x4c], "ld1 {v6.2d}, [x10], x6"), - ([0x20, 0x0c, 0xdf, 0x4c], "ld4 {v0.2d, v1.2d, v2.2d, v3.2d}, [x1], #0x40"), - ([0x51, 0x2d, 0xdf, 0x4c], "ld1 {v17.2d, v18.2d, v19.2d, v20.2d}, [x10], #0x40"), - ([0x20, 0x78, 0xdf, 0x4c], "ld1 {v0.4s}, [x1], #0x10"), - ([0x21, 0x78, 0xdf, 0x4c], "ld1 {v1.4s}, [x1], #0x10"), - ([0x46, 0x7d, 0xdf, 0x4c], "ld1 {v6.2d}, [x10], #0x10"), - ([0x20, 0x88, 0xdf, 0x4c], "ld2 {v0.4s, v1.4s}, [x1], #0x20"), - ([0x50, 0xad, 0xdf, 0x4c], "ld1 {v16.2d, v17.2d}, [x10], #0x20"), - ([0xa8, 0x85, 0x00, 0x4d], "st1 {v8.d}[1], [x13]"), - ([0xac, 0x85, 0x00, 0x4d], "st1 {v12.d}[1], [x13]"), - ([0xec, 0x85, 0x00, 0x4d], "st1 {v12.d}[1], [x15]"), - ([0x62, 0x84, 0x40, 0x4d], "ld1 {v2.d}[1], [x3]"), - ([0xa8, 0x85, 0x40, 0x4d], "ld1 {v8.d}[1], [x13]"), - ([0xec, 0x85, 0x40, 0x4d], "ld1 {v12.d}[1], [x15]"), - ([0x64, 0x84, 0x84, 0x4d], "st1 {v4.d}[1], [x3], x4"), - ([0x64, 0x84, 0x9f, 0x4d], "st1 {v4.d}[1], [x3], #0x8"), - ([0x24, 0xcd, 0xdf, 0x4d], "ld1r {v4.2d}, [x9], #0x8"), - ([0x60, 0x04, 0x81, 0x3c], "str q0, [x3], #0x10"), - ([0x61, 0x00, 0x9f, 0x3c], "stur q1, [x3, #-0x10]"), - ([0xa0, 0x00, 0x9f, 0x3c], "stur q0, [x5, #-0x10]"), - ([0x30, 0x00, 0xc0, 0x3c], "ldur q16, [x1]"), - ([0x68, 0x01, 0xc0, 0x3c], "ldur q8, [x11]"), - ([0x6c, 0x01, 0xc0, 0x3c], "ldur q12, [x11]"), - ([0x04, 0x02, 0xc0, 0x3c], "ldur q4, [x16]"), - ([0x32, 0x00, 0xc1, 0x3c], "ldur q18, [x1, #0x10]"), - ([0x6c, 0x01, 0xc1, 0x3c], "ldur q12, [x11, #0x10]"), - ([0x05, 0x02, 0xc1, 0x3c], "ldur q5, [x16, #0x10]"), - ([0x20, 0x04, 0xc1, 0x3c], "ldr q0, [x1], #0x10"), - ([0x04, 0x06, 0xc1, 0x3c], "ldr q4, [x16], #0x10"), - ([0x05, 0x06, 0xc1, 0x3c], "ldr q5, [x16], #0x10"), - ([0x34, 0x00, 0xc2, 0x3c], "ldur q20, [x1, #0x20]"), - ([0x3c, 0x00, 0xc6, 0x3c], "ldur q28, [x1, #0x60]"), - ([0x06, 0x02, 0xc6, 0x3c], "ldur q6, [x16, #0x60]"), - ([0x3e, 0x00, 0xc7, 0x3c], "ldur q30, [x1, #0x70]"), - ([0x07, 0x02, 0xc7, 0x3c], "ldur q7, [x16, #0x70]"), - ([0x44, 0x00, 0xdf, 0x3c], "ldur q4, [x2, #-0x10]"), - ([0x60, 0x00, 0x80, 0x3d], "str q0, [x3]"), - ([0x61, 0x00, 0x80, 0x3d], "str q1, [x3]"), - ([0xa0, 0x00, 0x80, 0x3d], "str q0, [x5]"), - ([0x60, 0x01, 0x80, 0x3d], "str q0, [x11]"), - ([0x80, 0x01, 0x80, 0x3d], "str q0, [x12]"), - ([0xa1, 0x01, 0x80, 0x3d], "str q1, [x13]"), - ([0xc2, 0x01, 0x80, 0x3d], "str q2, [x14]"), - ([0xe0, 0x01, 0x80, 0x3d], "str q0, [x15]"), - ([0xe3, 0x01, 0x80, 0x3d], "str q3, [x15]"), - ([0x00, 0x02, 0x80, 0x3d], "str q0, [x16]"), - ([0xe0, 0x27, 0x80, 0x3d], "str q0, [sp, #0x90]"), - ([0xe1, 0x2b, 0x80, 0x3d], "str q1, [sp, #0xa0]"), - ([0xe2, 0x2f, 0x80, 0x3d], "str q2, [sp, #0xb0]"), - ([0xe3, 0x33, 0x80, 0x3d], "str q3, [sp, #0xc0]"), - ([0xe4, 0x37, 0x80, 0x3d], "str q4, [sp, #0xd0]"), - ([0xe5, 0x3b, 0x80, 0x3d], "str q5, [sp, #0xe0]"), - ([0xe6, 0x3f, 0x80, 0x3d], "str q6, [sp, #0xf0]"), - ([0xe7, 0x43, 0x80, 0x3d], "str q7, [sp, #0x100]"), - ([0x20, 0x00, 0xc0, 0x3d], "ldr q0, [x1]"), - ([0x21, 0x00, 0xc0, 0x3d], "ldr q1, [x1]"), - ([0x24, 0x00, 0xc0, 0x3d], "ldr q4, [x1]"), - ([0x30, 0x00, 0xc0, 0x3d], "ldr q16, [x1]"), - ([0x60, 0x00, 0xc0, 0x3d], "ldr q0, [x3]"), - ([0x78, 0x00, 0xc0, 0x3d], "ldr q24, [x3]"), - ([0xa1, 0x00, 0xc0, 0x3d], "ldr q1, [x5]"), - ([0xc0, 0x00, 0xc0, 0x3d], "ldr q0, [x6]"), - ([0xe1, 0x00, 0xc0, 0x3d], "ldr q1, [x7]"), - ([0xe4, 0x00, 0xc0, 0x3d], "ldr q4, [x7]"), - ([0x02, 0x01, 0xc0, 0x3d], "ldr q2, [x8]"), - ([0x23, 0x01, 0xc0, 0x3d], "ldr q3, [x9]"), - ([0x44, 0x01, 0xc0, 0x3d], "ldr q4, [x10]"), - ([0xc1, 0x05, 0xc0, 0x3d], "ldr q1, [x14, #0x10]"), - ([0xe5, 0x05, 0xc0, 0x3d], "ldr q5, [x15, #0x10]"), - ([0xc2, 0x09, 0xc0, 0x3d], "ldr q2, [x14, #0x20]"), - ([0xe6, 0x09, 0xc0, 0x3d], "ldr q6, [x15, #0x20]"), - ([0x33, 0x0c, 0xc0, 0x3d], "ldr q19, [x1, #0x30]"), - ([0x85, 0x0c, 0xc0, 0x3d], "ldr q5, [x4, #0x30]"), - ([0x83, 0x0d, 0xc0, 0x3d], "ldr q3, [x12, #0x30]"), - ([0xa7, 0x0d, 0xc0, 0x3d], "ldr q7, [x13, #0x30]"), - ([0xc3, 0x0d, 0xc0, 0x3d], "ldr q3, [x14, #0x30]"), - ([0xe7, 0x0d, 0xc0, 0x3d], "ldr q7, [x15, #0x30]"), - ([0x00, 0x06, 0xc1, 0xac], "ldp q0, q1, [x16], #0x20"), - ([0xbe, 0x7d, 0xc1, 0xac], "ldp q30, q31, [x13], #0x20"), - ([0xb0, 0x44, 0x00, 0xad], "stp q16, q17, [x5]"), - ([0x82, 0x0d, 0x01, 0xad], "stp q2, q3, [x12, #0x20]"), - ([0xc2, 0x0d, 0x01, 0xad], "stp q2, q3, [x14, #0x20]"), - ([0xb8, 0x64, 0x02, 0xad], "stp q24, q25, [x5, #0x40]"), - ([0xba, 0x6c, 0x03, 0xad], "stp q26, q27, [x5, #0x60]"), - ([0xc0, 0x04, 0x40, 0xad], "ldp q0, q1, [x6]"), - ([0xb0, 0x44, 0x40, 0xad], "ldp q16, q17, [x5]"), - ([0x02, 0x0e, 0x41, 0xad], "ldp q2, q3, [x16, #0x20]"), - ([0x68, 0x25, 0x41, 0xad], "ldp q8, q9, [x11, #0x20]"), - ([0x6c, 0x35, 0x41, 0xad], "ldp q12, q13, [x11, #0x20]"), - ([0x7c, 0x74, 0x42, 0xad], "ldp q28, q29, [x3, #0x40]"), - ([0x02, 0x0e, 0x43, 0xad], "ldp q2, q3, [x16, #0x60]"), - ([0x06, 0x1e, 0x43, 0xad], "ldp q6, q7, [x16, #0x60]"), - ([0x30, 0x44, 0x43, 0xad], "ldp q16, q17, [x1, #0x60]"), - ([0x3e, 0x7c, 0x47, 0xad], "ldp q30, q31, [x1, #0xe0]"), - ([0x6e, 0x3d, 0xc1, 0x6c], "ldp d14, d15, [x11], #0x10"), - ([0xe8, 0x27, 0xc4, 0x6c], "ldp d8, d9, [sp], #0x40"), - ([0x81, 0x01, 0x00, 0x6d], "stp d1, d0, [x12]"), - ([0x39, 0x60, 0x00, 0x6d], "stp d25, d24, [x1]"), - ([0xdd, 0x71, 0x01, 0x6d], "stp d29, d28, [x14, #0x10]"), - ([0xfd, 0x70, 0x31, 0x6d], "stp d29, d28, [x7, #-0xf0]"), - ([0x86, 0xd8, 0x3f, 0x6d], "stp d6, d22, [x4, #-0x8]"), - ([0x24, 0x00, 0x40, 0x6d], "ldp d4, d0, [x1]"), - ([0xe1, 0x02, 0x40, 0x6d], "ldp d1, d0, [x23]"), - ([0xb2, 0x45, 0x7f, 0x6d], "ldp d18, d17, [x13, #-0x10]"), - ([0x32, 0xc4, 0x7f, 0x6d], "ldp d18, d17, [x1, #-0x8]"), - ([0x33, 0xd0, 0x7f, 0x6d], "ldp d19, d20, [x1, #-0x8]"), - ([0x00, 0x84, 0x00, 0xfc], "str d0, [x0], #0x8"), - ([0xc2, 0x87, 0x00, 0xfc], "str d2, [x30], #0x8"), - ([0x40, 0x8f, 0x00, 0xfc], "str d0, [x26, #0x8]!"), - ([0x15, 0x04, 0x01, 0xfc], "str d21, [x0], #0x10"), - ([0xc2, 0x07, 0x01, 0xfc], "str d2, [x30], #0x10"), - ([0x20, 0x84, 0x02, 0xfc], "str d0, [x1], #0x28"), - ([0x66, 0x00, 0x15, 0xfc], "stur d6, [x3, #-0xb0]"), - ([0x29, 0x03, 0x1f, 0xfc], "stur d9, [x25, #-0x10]"), - ([0xe8, 0x0f, 0x1f, 0xfc], "str d8, [sp, #-0x10]!"), - ([0x6d, 0x83, 0x1f, 0xfc], "stur d13, [x27, #-0x8]"), - ([0xc3, 0x83, 0x1f, 0xfc], "stur d3, [x30, #-0x8]"), - ([0x0d, 0x84, 0x1f, 0xfc], "str d13, [x0], #-0x8"), - ([0x61, 0x8e, 0x1f, 0xfc], "str d1, [x19, #-0x8]!"), - ([0xa3, 0x68, 0x20, 0xfc], "str d3, [x5, x0]"), - ([0xd2, 0x68, 0x20, 0xfc], "str d18, [x6, x0]"), - ([0x94, 0x6b, 0x20, 0xfc], "str d20, [x28, x0]"), - ([0x48, 0x78, 0x20, 0xfc], "str d8, [x2, x0, lsl #3]"), - ([0x83, 0x7b, 0x77, 0xfc], "ldr d3, [x28, x23, lsl #3]"), - ([0x80, 0xda, 0x77, 0xfc], "ldr d0, [x20, w23, sxtw #3]"), - ([0x22, 0x6b, 0x78, 0xfc], "ldr d2, [x25, x24]"), - ([0x08, 0x78, 0x78, 0xfc], "ldr d8, [x0, x24, lsl #3]"), - ([0xf3, 0x9b, 0x41, 0xfd], "ldr d19, [sp, #0x330]"), - ([0x4a, 0x44, 0x47, 0xfd], "ldr d10, [x2, #0xe88]"), - ([0x01, 0xd0, 0x47, 0xfd], "ldr d1, [x0, #0xfa0]"), - ([0xe8, 0x27, 0xbc, 0x6d], "stp d8, d9, [sp, #-0x40]!"), - ([0xe8, 0x27, 0xbf, 0x6d], "stp d8, d9, [sp, #-0x10]!"), - ([0xa2, 0x0f, 0x32, 0x3d], "str b2, [x29, #0xc83]"), - ([0x97, 0xff, 0xff, 0x1c], "ldr s23, $-0x10"), - ([0x6e, 0x3d, 0xc1, 0x2c], "ldp s14, s15, [x11], #0x8"), - ([0xef, 0x7e, 0x40, 0x2d], "ldp s15, s31, [x23]"), - ([0x41, 0x80, 0x40, 0x2d], "ldp s1, s0, [x2, #0x4]"), - ([0x33, 0xd0, 0x7f, 0x2d], "ldp s19, s20, [x1, #-0x4]"), - ([0x60, 0x47, 0x00, 0xbc], "str s0, [x27], #0x4"), - ([0x81, 0x47, 0x00, 0xbc], "str s1, [x28], #0x4"), - ([0xc2, 0x47, 0x00, 0xbc], "str s2, [x30], #0x4"), - ([0x00, 0x4d, 0x00, 0xbc], "str s0, [x8, #0x4]!"), - ([0x40, 0x4f, 0x00, 0xbc], "str s0, [x26, #0x4]!"), - ([0x15, 0x84, 0x00, 0xbc], "str s21, [x0], #0x8"), - ([0x80, 0x87, 0x00, 0xbc], "str s0, [x28], #0x8"), - ([0xf1, 0x00, 0x1c, 0xbc], "stur s17, [x7, #-0x40]"), - ([0x01, 0x04, 0x1f, 0xbc], "str s1, [x0], #-0x10"), - ([0x8d, 0xc3, 0x1f, 0xbc], "stur s13, [x28, #-0x4]"), - ([0x0d, 0xc4, 0x1f, 0xbc], "str s13, [x0], #-0x4"), - ([0x61, 0xce, 0x1f, 0xbc], "str s1, [x19, #-0x4]!"), - ([0x82, 0x6b, 0x20, 0xbc], "str s2, [x28, x0]"), - ([0xad, 0x7a, 0x20, 0xbc], "str s13, [x21, x0, lsl #2]"), - ([0x88, 0x7b, 0x21, 0xbc], "str s8, [x28, x1, lsl #2]"), - ([0x60, 0xda, 0x21, 0xbc], "str s0, [x19, w1, sxtw #2]"), - ([0xc0, 0x5a, 0x32, 0xbc], "str s0, [x22, w18, uxtw #2]"), - ([0xb3, 0x85, 0x40, 0xbc], "ldr s19, [x13], #0x8"), - ([0x02, 0x8f, 0x40, 0xbc], "ldr s2, [x24, #0x8]!"), - ([0x71, 0x05, 0x41, 0xbc], "ldr s17, [x11], #0x10"), - ([0xe0, 0x42, 0x5d, 0xbc], "ldur s0, [x23, #-0x2c]"), - ([0x27, 0x80, 0x5d, 0xbc], "ldur s7, [x1, #-0x28]"), - ([0x21, 0x84, 0x5f, 0xbc], "ldr s1, [x1], #-0x8"), - ([0x22, 0x87, 0x5f, 0xbc], "ldr s2, [x25], #-0x8"), - ([0xe0, 0x8e, 0x5f, 0xbc], "ldr s0, [x23, #-0x8]!"), - ([0x79, 0x6a, 0x60, 0xbc], "ldr s25, [x19, x0]"), - ([0x6a, 0x78, 0x60, 0xbc], "ldr s10, [x3, x0, lsl #2]"), - ([0xeb, 0x7a, 0x60, 0xbc], "ldr s11, [x23, x0, lsl #2]"), - ([0x96, 0x7b, 0x61, 0xbc], "ldr s22, [x28, x1, lsl #2]"), - ([0x68, 0xdb, 0x61, 0xbc], "ldr s8, [x27, w1, sxtw #2]"), - ([0x49, 0x03, 0x00, 0xbd], "str s9, [x26]"), - ([0x62, 0x78, 0x00, 0xbd], "str s2, [x3, #0x78]"), - ([0x6c, 0x78, 0x00, 0xbd], "str s12, [x3, #0x78]"), - ([0xea, 0x7f, 0x00, 0xbd], "str s10, [sp, #0x7c]"), - ([0xe9, 0x87, 0x04, 0xbd], "str s9, [sp, #0x484]"), - ([0xc0, 0x8a, 0x0a, 0xbd], "str s0, [x22, #0xa88]"), - ([0x41, 0x58, 0x4f, 0xbd], "ldr s1, [x2, #0xf58]"), - ([0x88, 0x7c, 0x00, 0x2d], "stp s8, s31, [x4]"), - ([0x03, 0x84, 0x00, 0x2d], "stp s3, s1, [x0, #0x4]"), - ([0x13, 0xdc, 0x3f, 0x2d], "stp s19, s23, [x0, #-0x4]"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_loadstore() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x83, 0x68, 0x60, 0x38], "ldrb w3, [x4, x0]"), - ([0x63, 0x03, 0x40, 0x29], "ldp w3, w0, [x27]"), - ([0x49, 0x00, 0x40, 0x39], "ldrb w9, [x2]"), - ([0x4a, 0x00, 0x40, 0x39], "ldrb w10, [x2]"), - ([0x82, 0x08, 0x40, 0x39], "ldrb w2, [x4, #0x2]"), - ([0x82, 0x0a, 0x40, 0x39], "ldrb w2, [x20, #0x2]"), - ([0x41, 0x0b, 0x40, 0x39], "ldrb w1, [x26, #0x2]"), - ([0x88, 0x10, 0x40, 0x39], "ldrb w8, [x4, #0x4]"), - ([0xc1, 0x16, 0x40, 0x39], "ldrb w1, [x22, #0x5]"), - ([0xc2, 0x16, 0x40, 0x39], "ldrb w2, [x22, #0x5]"), - ([0x00, 0x40, 0x40, 0x39], "ldrb w0, [x0, #0x10]"), - ([0xe1, 0x43, 0x41, 0x39], "ldrb w1, [sp, #0x50]"), - ([0xe0, 0x83, 0x41, 0x39], "ldrb w0, [sp, #0x60]"), - ([0xe1, 0x8b, 0x41, 0x39], "ldrb w1, [sp, #0x62]"), - ([0xe2, 0x8b, 0x41, 0x39], "ldrb w2, [sp, #0x62]"), - ([0xe2, 0xa3, 0x41, 0x39], "ldrb w2, [sp, #0x68]"), - ([0xe1, 0xb7, 0x41, 0x39], "ldrb w1, [sp, #0x6d]"), - ([0xe2, 0xb7, 0x41, 0x39], "ldrb w2, [sp, #0x6d]"), - ([0xf3, 0xcb, 0x41, 0x39], "ldrb w19, [sp, #0x72]"), - ([0xe2, 0xeb, 0x41, 0x39], "ldrb w2, [sp, #0x7a]"), - ([0xe1, 0x13, 0x42, 0x39], "ldrb w1, [sp, #0x84]"), - ([0xe3, 0x13, 0x42, 0x39], "ldrb w3, [sp, #0x84]"), - ([0xe7, 0x23, 0x42, 0x39], "ldrb w7, [sp, #0x88]"), - ([0xe3, 0x37, 0x42, 0x39], "ldrb w3, [sp, #0x8d]"), - ([0xe1, 0x4f, 0x42, 0x39], "ldrb w1, [sp, #0x93]"), - ([0x60, 0x02, 0x72, 0x39], "ldrb w0, [x19, #0xc80]"), - ([0x22, 0x04, 0x40, 0x69], "ldpsw x2, x1, [x1]"), - ([0x38, 0x15, 0x40, 0x69], "ldpsw x24, x5, [x9]"), - ([0x38, 0x1d, 0x40, 0x69], "ldpsw x24, x7, [x9]"), - ([0x43, 0x80, 0x40, 0x69], "ldpsw x3, x0, [x2, #0x4]"), - ([0x05, 0x90, 0x40, 0x69], "ldpsw x5, x4, [x0, #0x4]"), - ([0x39, 0x90, 0x40, 0x69], "ldpsw x25, x4, [x1, #0x4]"), - ([0x05, 0x98, 0x40, 0x69], "ldpsw x5, x6, [x0, #0x4]"), - ([0xe1, 0x13, 0x5f, 0x69], "ldpsw x1, x4, [sp, #0xf8]"), - ([0xe3, 0x33, 0x45, 0x78], "ldurh w3, [sp, #0x53]"), - ([0xe1, 0x13, 0x46, 0x78], "ldurh w1, [sp, #0x61]"), - ([0xe2, 0x93, 0x46, 0x78], "ldurh w2, [sp, #0x69]"), - ([0xe2, 0xb3, 0x46, 0x78], "ldurh w2, [sp, #0x6b]"), - ([0xe5, 0xb3, 0x48, 0x78], "ldurh w5, [sp, #0x8b]"), - ([0xe5, 0x8b, 0x00, 0x79], "strh w5, [sp, #0x44]"), - ([0xe2, 0xa3, 0x00, 0x79], "strh w2, [sp, #0x50]"), - ([0xe0, 0xab, 0x00, 0x79], "strh w0, [sp, #0x54]"), - ([0xe1, 0xb3, 0x00, 0x79], "strh w1, [sp, #0x58]"), - ([0xe2, 0xc3, 0x00, 0x79], "strh w2, [sp, #0x60]"), - ([0xe5, 0xf3, 0x00, 0x79], "strh w5, [sp, #0x78]"), - ([0x01, 0x00, 0x40, 0x79], "ldrh w1, [x0]"), - ([0x02, 0x00, 0x40, 0x79], "ldrh w2, [x0]"), - ([0x22, 0x00, 0x40, 0x79], "ldrh w2, [x1]"), - ([0x83, 0x02, 0x40, 0x79], "ldrh w3, [x20]"), - ([0x42, 0x03, 0x40, 0x79], "ldrh w2, [x26]"), - ([0x20, 0x08, 0x40, 0x79], "ldrh w0, [x1, #0x4]"), - ([0xe0, 0xa3, 0x40, 0x79], "ldrh w0, [sp, #0x50]"), - ([0xe1, 0xa3, 0x40, 0x79], "ldrh w1, [sp, #0x50]"), - ([0xe0, 0xb3, 0x40, 0x79], "ldrh w0, [sp, #0x58]"), - ([0xe0, 0xc3, 0x40, 0x79], "ldrh w0, [sp, #0x60]"), - ([0xe2, 0xc3, 0x40, 0x79], "ldrh w2, [sp, #0x60]"), - ([0xe3, 0xf3, 0x40, 0x79], "ldrh w3, [sp, #0x78]"), - ([0xfd, 0x7b, 0xc1, 0xa8], "ldp x29, x30, [sp], #0x10"), - ([0xfd, 0x7b, 0xd9, 0xa8], "ldp x29, x30, [sp], #0x190"), - ([0xfd, 0x7b, 0xda, 0xa8], "ldp x29, x30, [sp], #0x1a0"), - ([0x3c, 0x61, 0x00, 0xa9], "stp x28, x24, [x9]"), - ([0xba, 0x61, 0x00, 0xa9], "stp x26, x24, [x13]"), - ([0xed, 0x6f, 0x00, 0xa9], "stp x13, x27, [sp]"), - ([0xea, 0x9f, 0x1c, 0xa9], "stp x10, x7, [sp, #0x1c8]"), - ([0xff, 0x7c, 0x3e, 0xa9], "stp xzr, xzr, [x7, #-0x20]"), - ([0x03, 0x00, 0x40, 0xa9], "ldp x3, x0, [x0]"), - ([0x2a, 0x00, 0x40, 0xa9], "ldp x10, x0, [x1]"), - ([0x5a, 0x28, 0x40, 0xa9], "ldp x26, x10, [x2]"), - ([0x16, 0x87, 0x7f, 0xa9], "ldp x22, x1, [x24, #-0x8]"), - ([0xc1, 0x46, 0x00, 0xb8], "str w1, [x22], #0x4"), - ([0x3f, 0x47, 0x00, 0xb8], "str wzr, [x25], #0x4"), - ([0x7f, 0x4c, 0x00, 0xb8], "str wzr, [x3, #0x4]!"), - ([0x1f, 0x4d, 0x00, 0xb8], "str wzr, [x8, #0x4]!"), - ([0x3f, 0x84, 0x00, 0xb8], "str wzr, [x1], #0x8"), - ([0x7f, 0x0e, 0x04, 0xb8], "str wzr, [x19, #0x40]!"), - ([0x9f, 0x0e, 0x04, 0xb8], "str wzr, [x20, #0x40]!"), - ([0xe9, 0x93, 0x08, 0xb8], "stur w9, [sp, #0x89]"), - ([0x1f, 0x40, 0x10, 0xb8], "stur wzr, [x0, #-0xfc]"), - ([0x1f, 0xc0, 0x11, 0xb8], "stur wzr, [x0, #-0xe4]"), - ([0xff, 0x82, 0x14, 0xb8], "stur wzr, [x23, #-0xb8]"), - ([0x0b, 0x83, 0x14, 0xb8], "stur w11, [x24, #-0xb8]"), - ([0xff, 0x69, 0x20, 0xb8], "str wzr, [x15, x0]"), - ([0x57, 0x78, 0x20, 0xb8], "str w23, [x2, x0, lsl #2]"), - ([0x7f, 0x68, 0x21, 0xb8], "str wzr, [x3, x1]"), - ([0xa8, 0x68, 0x21, 0xb8], "str w8, [x5, x1]"), - ([0xe0, 0xda, 0x34, 0xb8], "str w0, [x23, w20, sxtw #2]"), - ([0x48, 0x7b, 0x35, 0xb8], "str w8, [x26, x21, lsl #2]"), - ([0x23, 0x44, 0x40, 0xb8], "ldr w3, [x1], #0x4"), - ([0xe1, 0x13, 0x45, 0xb8], "ldur w1, [sp, #0x51]"), - ([0xe2, 0xf3, 0x48, 0xb8], "ldur w2, [sp, #0x8f]"), - ([0x27, 0x80, 0x5f, 0xb8], "ldur w7, [x1, #-0x8]"), - ([0xe3, 0x68, 0x61, 0xb8], "ldr w3, [x7, x1]"), - ([0x0e, 0x79, 0x61, 0xb8], "ldr w14, [x8, x1, lsl #2]"), - ([0xf2, 0x6a, 0x62, 0xb8], "ldr w18, [x23, x2]"), - ([0x63, 0x7b, 0x7c, 0xb8], "ldr w3, [x27, x28, lsl #2]"), - ([0xe5, 0x44, 0x80, 0xb8], "ldrsw x5, [x7], #0x4"), - ([0xa3, 0xc0, 0x9f, 0xb8], "ldursw x3, [x5, #-0x4]"), - ([0x04, 0x78, 0xa2, 0xb8], "ldrsw x4, [x0, x2, lsl #2]"), - ([0xe4, 0x68, 0xa3, 0xb8], "ldrsw x4, [x7, x3]"), - ([0xe5, 0x6a, 0xb3, 0xb8], "ldrsw x5, [x23, x19]"), - ([0x65, 0x02, 0x00, 0xb9], "str w5, [x19]"), - ([0xff, 0x03, 0x00, 0xb9], "str wzr, [sp]"), - ([0xe9, 0x23, 0x00, 0xb9], "str w9, [sp, #0x20]"), - ([0x01, 0x3c, 0x0c, 0xb9], "str w1, [x0, #0xc3c]"), - ([0x60, 0x4a, 0x0c, 0xb9], "str w0, [x19, #0xc48]"), - ([0x7f, 0x4a, 0x0c, 0xb9], "str wzr, [x19, #0xc48]"), - ([0x40, 0xf0, 0x0d, 0xb9], "str w0, [x2, #0xdf0]"), - ([0x89, 0x00, 0x40, 0xb9], "ldr w9, [x4]"), - ([0xa0, 0x6f, 0x40, 0xb9], "ldr w0, [x29, #0x6c]"), - ([0xe4, 0x6f, 0x40, 0xb9], "ldr w4, [sp, #0x6c]"), - ([0xea, 0xc3, 0x6e, 0xb9], "ldr w10, [sp, #0x2ec0]"), - ([0xeb, 0xc3, 0x6e, 0xb9], "ldr w11, [sp, #0x2ec0]"), - ([0xea, 0xcb, 0x6e, 0xb9], "ldr w10, [sp, #0x2ec8]"), - ([0xf9, 0x03, 0x6f, 0xb9], "ldr w25, [sp, #0x2f00]"), - ([0xf9, 0x0b, 0x6f, 0xb9], "ldr w25, [sp, #0x2f08]"), - ([0xf7, 0x33, 0x6f, 0xb9], "ldr w23, [sp, #0x2f30]"), - ([0xf7, 0x3b, 0x6f, 0xb9], "ldr w23, [sp, #0x2f38]"), - ([0xec, 0x1b, 0x71, 0xb9], "ldr w12, [sp, #0x3118]"), - ([0xeb, 0x23, 0x71, 0xb9], "ldr w11, [sp, #0x3120]"), - ([0xe0, 0x73, 0x71, 0xb9], "ldr w0, [sp, #0x3170]"), - ([0xe0, 0x7b, 0x71, 0xb9], "ldr w0, [sp, #0x3178]"), - ([0xe0, 0x83, 0x71, 0xb9], "ldr w0, [sp, #0x3180]"), - ([0xe0, 0x8b, 0x71, 0xb9], "ldr w0, [sp, #0x3188]"), - ([0xe9, 0x1b, 0x72, 0xb9], "ldr w9, [sp, #0x3218]"), - ([0xeb, 0x23, 0x72, 0xb9], "ldr w11, [sp, #0x3220]"), - ([0xea, 0x2b, 0x72, 0xb9], "ldr w10, [sp, #0x3228]"), - ([0xeb, 0x33, 0x72, 0xb9], "ldr w11, [sp, #0x3230]"), - ([0x24, 0x03, 0x80, 0xb9], "ldrsw x4, [x25]"), - ([0x34, 0x10, 0x80, 0xb9], "ldrsw x20, [x1, #0x10]"), - ([0xc8, 0x7c, 0x89, 0xb9], "ldrsw x8, [x6, #0x97c]"), - ([0x7f, 0xfe, 0x01, 0xc8], "stlxr w1, xzr, [x19]"), - ([0xbf, 0xfe, 0x01, 0xc8], "stlxr w1, xzr, [x21]"), - ([0x64, 0x7e, 0x03, 0xc8], "stxr w3, x4, [x19]"), - ([0x60, 0xfe, 0x5f, 0xc8], "ldaxr x0, [x19]"), - ([0x62, 0xfe, 0x5f, 0xc8], "ldaxr x2, [x19]"), - ([0x3f, 0xfc, 0x9f, 0xc8], "stlr xzr, [x1]"), - ([0x81, 0xfd, 0x9f, 0xc8], "stlr x1, [x12]"), - ([0x77, 0xfe, 0xdf, 0xc8], "ldar x23, [x19]"), - ([0xff, 0x42, 0x00, 0xf8], "stur xzr, [x23, #0x4]"), - ([0x3f, 0x84, 0x00, 0xf8], "str xzr, [x1], #0x8"), - ([0x3f, 0x87, 0x00, 0xf8], "str xzr, [x25], #0x8"), - ([0x1f, 0x8c, 0x00, 0xf8], "str xzr, [x0, #0x8]!"), - ([0x02, 0x8f, 0x00, 0xf8], "str x2, [x24, #0x8]!"), - ([0x20, 0xc0, 0x00, 0xf8], "stur x0, [x1, #0xc]"), - ([0x3f, 0x04, 0x01, 0xf8], "str xzr, [x1], #0x10"), - ([0xe1, 0xc3, 0x07, 0xf8], "stur x1, [sp, #0x7c]"), - ([0x7f, 0x80, 0x10, 0xf8], "stur xzr, [x3, #-0xf8]"), - ([0xc3, 0x00, 0x1c, 0xf8], "stur x3, [x6, #-0x40]"), - ([0x02, 0x87, 0x1f, 0xf8], "str x2, [x24], #-0x8"), - ([0x1f, 0xc3, 0x1f, 0xf8], "stur xzr, [x24, #-0x4]"), - ([0xbf, 0x68, 0x20, 0xf8], "str xzr, [x5, x0]"), - ([0xff, 0x6a, 0x38, 0xf8], "str xzr, [x23, x24]"), - ([0x7f, 0x7b, 0x3c, 0xf8], "str xzr, [x27, x28, lsl #3]"), - ([0xc7, 0x40, 0x40, 0xf8], "ldur x7, [x6, #0x4]"), - ([0x01, 0x87, 0x40, 0xf8], "ldr x1, [x24], #0x8"), - ([0x98, 0x83, 0x5f, 0xf8], "ldur x24, [x28, #-0x8]"), - ([0x80, 0x86, 0x5f, 0xf8], "ldr x0, [x20], #-0x8"), - ([0xe3, 0x6a, 0x60, 0xf8], "ldr x3, [x23, x0]"), - ([0xc5, 0x6a, 0x7b, 0xf8], "ldr x5, [x22, x27]"), - ([0xa0, 0x7a, 0x7c, 0xf8], "ldr x0, [x21, x28, lsl #3]"), - ([0x08, 0xdb, 0x7c, 0xf8], "ldr x8, [x24, w28, sxtw #3]"), - ([0x5f, 0x00, 0x00, 0xf9], "str xzr, [x2]"), - ([0x2a, 0x6d, 0x04, 0xf9], "str x10, [x9, #0x8d8]"), - ([0xeb, 0x1f, 0x18, 0xf9], "str x11, [sp, #0x3038]"), - ([0xff, 0x7f, 0x18, 0xf9], "str xzr, [sp, #0x30f8]"), - ([0xe9, 0x2f, 0x25, 0xf9], "str x9, [sp, #0x4a58]"), - ([0xe1, 0xd7, 0x26, 0xf9], "str x1, [sp, #0x4da8]"), - ([0x42, 0x01, 0x40, 0xf9], "ldr x2, [x10]"), - ([0xf7, 0xef, 0x66, 0xf9], "ldr x23, [sp, #0x4dd8]"), - ([0x01, 0x00, 0x00, 0xb0], "adrp x1, $+0x1000"), - ([0xea, 0x6e, 0x00, 0xb0], "adrp x10, $+0xddd000"), - ([0x13, 0x70, 0x00, 0xb0], "adrp x19, $+0xe01000"), - ([0x20, 0x00, 0x75, 0x10], "adr x0, $+0xea004"), - ([0x01, 0x00, 0x00, 0x90], "adrp x1, $+0x0"), - ([0xc7, 0x6e, 0x00, 0x90], "adrp x7, $+0xdd8000"), - ([0x01, 0x00, 0x00, 0xd0], "adrp x1, $+0x2000"), - ([0x13, 0x70, 0x00, 0xd0], "adrp x19, $+0xe02000"), - ([0xfc, 0xff, 0xff, 0xf0], "adrp x28, $-0x1000"), - ([0xfd, 0x7b, 0xa1, 0xa9], "stp x29, x30, [sp, #-0x1f0]!"), - ([0xfd, 0x7b, 0xa2, 0xa9], "stp x29, x30, [sp, #-0x1e0]!"), - ([0xfd, 0x7b, 0xbf, 0xa9], "stp x29, x30, [sp, #-0x10]!"), - ([0x23, 0xf0, 0x1f, 0x38], "sturb w3, [x1, #-0x1]"), - ([0x01, 0x00, 0x00, 0x39], "strb w1, [x0]"), - ([0x20, 0x00, 0x00, 0x39], "strb w0, [x1]"), - ([0x80, 0x00, 0x00, 0x39], "strb w0, [x4]"), - ([0x60, 0x02, 0x00, 0x39], "strb w0, [x19]"), - ([0x80, 0x02, 0x00, 0x39], "strb w0, [x20]"), - ([0xa0, 0x02, 0x00, 0x39], "strb w0, [x21]"), - ([0xe0, 0x02, 0x00, 0x39], "strb w0, [x23]"), - ([0x20, 0x03, 0x00, 0x39], "strb w0, [x25]"), - ([0x40, 0x03, 0x00, 0x39], "strb w0, [x26]"), - ([0x68, 0x13, 0x00, 0x39], "strb w8, [x27, #0x4]"), - ([0xe0, 0x03, 0x01, 0x39], "strb w0, [sp, #0x40]"), - ([0xe1, 0x43, 0x01, 0x39], "strb w1, [sp, #0x50]"), - ([0xe1, 0x8b, 0x01, 0x39], "strb w1, [sp, #0x62]"), - ([0xe2, 0xa3, 0x01, 0x39], "strb w2, [sp, #0x68]"), - ([0xe5, 0x03, 0x0c, 0x39], "strb w5, [sp, #0x300]"), - ([0xe0, 0xe3, 0x0d, 0x39], "strb w0, [sp, #0x378]"), - ([0xe1, 0xe3, 0x0d, 0x39], "strb w1, [sp, #0x378]"), - ([0xe2, 0xe3, 0x0d, 0x39], "strb w2, [sp, #0x378]"), - ([0xe0, 0x03, 0x0e, 0x39], "strb w0, [sp, #0x380]"), - ([0xe0, 0x23, 0x0e, 0x39], "strb w0, [sp, #0x388]"), - ([0xe1, 0x23, 0x0e, 0x39], "strb w1, [sp, #0x388]"), - ([0xe2, 0x23, 0x0e, 0x39], "strb w2, [sp, #0x388]"), - ([0xe0, 0x43, 0x0e, 0x39], "strb w0, [sp, #0x390]"), - ([0xe0, 0x23, 0x0f, 0x39], "strb w0, [sp, #0x3c8]"), - ([0xe1, 0x23, 0x0f, 0x39], "strb w1, [sp, #0x3c8]"), - ([0xe2, 0x23, 0x0f, 0x39], "strb w2, [sp, #0x3c8]"), - ([0xe0, 0x43, 0x0f, 0x39], "strb w0, [sp, #0x3d0]"), - ([0xe0, 0xa3, 0x0f, 0x39], "strb w0, [sp, #0x3e8]"), - ([0xe1, 0xa3, 0x0f, 0x39], "strb w1, [sp, #0x3e8]"), - ([0xe2, 0xa3, 0x0f, 0x39], "strb w2, [sp, #0x3e8]"), - ([0xe0, 0xc3, 0x0f, 0x39], "strb w0, [sp, #0x3f0]"), - ([0x60, 0x02, 0x32, 0x39], "strb w0, [x19, #0xc80]"), - ([0x13, 0xb8, 0x00, 0x29], "stp w19, w14, [x0, #0x4]"), - ([0xeb, 0x9f, 0x1f, 0x29], "stp w11, w7, [sp, #0xfc]"), - ([0x7f, 0x7c, 0x3f, 0x29], "stp wzr, wzr, [x3, #-0x8]"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_data_ops() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0xe5, 0x03, 0x1e, 0x2a], "mov w5, w30"), - ([0xe7, 0x03, 0x1e, 0x2a], "mov w7, w30"), - ([0xe0, 0x03, 0x1f, 0x2a], "mov w0, wzr"), - ([0x20, 0x0f, 0x80, 0x52], "mov w0, #0x79"), - ([0x41, 0x0f, 0x80, 0x52], "mov w1, #0x7a"), - ([0x01, 0x10, 0x80, 0x52], "mov w1, #0x80"), - ([0x02, 0x10, 0x80, 0x52], "mov w2, #0x80"), - ([0x08, 0x10, 0x80, 0x52], "mov w8, #0x80"), - ([0x0a, 0x10, 0x80, 0x52], "mov w10, #0x80"), - ([0x13, 0x10, 0x80, 0x52], "mov w19, #0x80"), - ([0x15, 0x10, 0x80, 0x52], "mov w21, #0x80"), - ([0x60, 0x10, 0x80, 0x52], "mov w0, #0x83"), - ([0x81, 0x10, 0x80, 0x52], "mov w1, #0x84"), - ([0x05, 0x16, 0x80, 0x52], "mov w5, #0xb0"), - ([0x06, 0x16, 0x80, 0x52], "mov w6, #0xb0"), - ([0x08, 0x16, 0x80, 0x52], "mov w8, #0xb0"), - ([0x00, 0x18, 0x80, 0x52], "mov w0, #0xc0"), - ([0x82, 0x18, 0x80, 0x52], "mov w2, #0xc4"), - ([0x60, 0x1a, 0x80, 0x52], "mov w0, #0xd3"), - ([0x80, 0x1a, 0x80, 0x52], "mov w0, #0xd4"), - ([0xa0, 0x1a, 0x80, 0x52], "mov w0, #0xd5"), - ([0xc0, 0x1a, 0x80, 0x52], "mov w0, #0xd6"), - ([0x22, 0x1e, 0x80, 0x52], "mov w2, #0xf1"), - ([0x00, 0x20, 0x80, 0x52], "mov w0, #0x100"), - ([0x02, 0x20, 0x80, 0x52], "mov w2, #0x100"), - ([0x20, 0x20, 0x80, 0x52], "mov w0, #0x101"), - ([0x22, 0x20, 0x80, 0x52], "mov w2, #0x101"), - ([0x80, 0x20, 0x80, 0x52], "mov w0, #0x104"), - ([0xa0, 0x20, 0x80, 0x52], "mov w0, #0x105"), - ([0xc2, 0x21, 0x80, 0x52], "mov w2, #0x10e"), - ([0x42, 0x22, 0x80, 0x52], "mov w2, #0x112"), - ([0xc6, 0x31, 0x80, 0x52], "mov w6, #0x18e"), - ([0x25, 0x60, 0x80, 0x52], "mov w5, #0x301"), - ([0x00, 0x82, 0x80, 0x52], "mov w0, #0x410"), - ([0x20, 0x82, 0x80, 0x52], "mov w0, #0x411"), - ([0x80, 0x82, 0x80, 0x52], "mov w0, #0x414"), - ([0xa0, 0x82, 0x80, 0x52], "mov w0, #0x415"), - ([0x60, 0x9e, 0x80, 0x52], "mov w0, #0x4f3"), - ([0x02, 0x00, 0x81, 0x52], "mov w2, #0x800"), - ([0x00, 0x02, 0x81, 0x52], "mov w0, #0x810"), - ([0x20, 0x02, 0x81, 0x52], "mov w0, #0x811"), - ([0x80, 0x02, 0x81, 0x52], "mov w0, #0x814"), - ([0xa0, 0x02, 0x81, 0x52], "mov w0, #0x815"), - ([0x00, 0x82, 0x81, 0x52], "mov w0, #0xc10"), - ([0x20, 0x82, 0x81, 0x52], "mov w0, #0xc11"), - ([0x80, 0x82, 0x81, 0x52], "mov w0, #0xc14"), - ([0xa0, 0x82, 0x81, 0x52], "mov w0, #0xc15"), - ([0x60, 0xfb, 0x81, 0x52], "mov w0, #0xfdb"), - ([0x64, 0xfb, 0x81, 0x52], "mov w4, #0xfdb"), - ([0x01, 0x00, 0x82, 0x52], "mov w1, #0x1000"), - ([0xe2, 0x07, 0x82, 0x52], "mov w2, #0x103f"), - ([0xe3, 0x07, 0x82, 0x52], "mov w3, #0x103f"), - ([0xe4, 0x07, 0x82, 0x52], "mov w4, #0x103f"), - ([0xea, 0x07, 0x82, 0x52], "mov w10, #0x103f"), - ([0xeb, 0x07, 0x82, 0x52], "mov w11, #0x103f"), - ([0x01, 0x08, 0x82, 0x52], "mov w1, #0x1040"), - ([0x02, 0x08, 0x82, 0x52], "mov w2, #0x1040"), - ([0x03, 0x08, 0x82, 0x52], "mov w3, #0x1040"), - ([0x80, 0x46, 0x82, 0x52], "mov w0, #0x1234"), - ([0xe0, 0x4d, 0x82, 0x52], "mov w0, #0x126f"), - ([0xe2, 0xed, 0x82, 0x52], "mov w2, #0x176f"), - ([0x04, 0x00, 0x84, 0x52], "mov w4, #0x2000"), - ([0x05, 0x00, 0x84, 0x52], "mov w5, #0x2000"), - ([0x25, 0x00, 0x84, 0x52], "mov w5, #0x2001"), - ([0x85, 0x00, 0x84, 0x52], "mov w5, #0x2004"), - ([0xa5, 0x00, 0x84, 0x52], "mov w5, #0x2005"), - ([0xa0, 0x18, 0x84, 0x52], "mov w0, #0x20c5"), - ([0xa1, 0x18, 0x84, 0x52], "mov w1, #0x20c5"), - ([0xa2, 0x18, 0x84, 0x52], "mov w2, #0x20c5"), - ([0x03, 0xe2, 0x84, 0x52], "mov w3, #0x2710"), - ([0x05, 0xe2, 0x84, 0x52], "mov w5, #0x2710"), - ([0x06, 0x00, 0x86, 0x52], "mov w6, #0x3000"), - ([0x61, 0x66, 0x86, 0x52], "mov w1, #0x3333"), - ([0x06, 0x00, 0x88, 0x52], "mov w6, #0x4000"), - ([0x80, 0x29, 0x88, 0x52], "mov w0, #0x414c"), - ([0x81, 0x29, 0x88, 0x52], "mov w1, #0x414c"), - ([0xe0, 0x48, 0x88, 0x52], "mov w0, #0x4247"), - ([0x00, 0x4a, 0x88, 0x52], "mov w0, #0x4250"), - ([0xe1, 0xa8, 0x88, 0x52], "mov w1, #0x4547"), - ([0xe2, 0xa8, 0x88, 0x52], "mov w2, #0x4547"), - ([0x00, 0xa9, 0x88, 0x52], "mov w0, #0x4548"), - ([0xe0, 0xe8, 0x88, 0x52], "mov w0, #0x4747"), - ([0xc0, 0xf5, 0x88, 0x52], "mov w0, #0x47ae"), - ([0x21, 0x8a, 0x89, 0x52], "mov w1, #0x4c51"), - ([0xa0, 0xca, 0x89, 0x52], "mov w0, #0x4e55"), - ([0x02, 0xea, 0x89, 0x52], "mov w2, #0x4f50"), - ([0x81, 0x29, 0x8a, 0x52], "mov w1, #0x514c"), - ([0x41, 0x2a, 0x8a, 0x52], "mov w1, #0x5152"), - ([0x41, 0x48, 0x8a, 0x52], "mov w1, #0x5242"), - ([0x01, 0x49, 0x8a, 0x52], "mov w1, #0x5248"), - ([0xe0, 0x49, 0x8a, 0x52], "mov w0, #0x524f"), - ([0x21, 0x4a, 0x8a, 0x52], "mov w1, #0x5251"), - ([0x80, 0x4a, 0x8a, 0x52], "mov w0, #0x5254"), - ([0x81, 0x4a, 0x8a, 0x52], "mov w1, #0x5254"), - ([0x60, 0x8a, 0x8a, 0x52], "mov w0, #0x5453"), - ([0xc0, 0xaa, 0x8a, 0x52], "mov w0, #0x5556"), - ([0xc1, 0xaa, 0x8a, 0x52], "mov w1, #0x5556"), - ([0xc4, 0xaa, 0x8a, 0x52], "mov w4, #0x5556"), - ([0xc6, 0xaa, 0x8a, 0x52], "mov w6, #0x5556"), - ([0xc8, 0xaa, 0x8a, 0x52], "mov w8, #0x5556"), - ([0xca, 0xaa, 0x8a, 0x52], "mov w10, #0x5556"), - ([0xd7, 0xaa, 0x8a, 0x52], "mov w23, #0x5556"), - ([0xd8, 0xaa, 0x8a, 0x52], "mov w24, #0x5556"), - ([0xd9, 0xaa, 0x8a, 0x52], "mov w25, #0x5556"), - ([0x61, 0x2a, 0x8b, 0x52], "mov w1, #0x5953"), - ([0x62, 0x2a, 0x8b, 0x52], "mov w2, #0x5953"), - ([0xc0, 0xcc, 0x8c, 0x52], "mov w0, #0x6666"), - ([0xc1, 0xcc, 0x8c, 0x52], "mov w1, #0x6666"), - ([0xe0, 0xcc, 0x8c, 0x52], "mov w0, #0x6667"), - ([0x00, 0x43, 0x8e, 0x52], "mov w0, #0x7218"), - ([0x02, 0x43, 0x8e, 0x52], "mov w2, #0x7218"), - ([0x40, 0xdf, 0x8f, 0x52], "mov w0, #0x7efa"), - ([0x13, 0x00, 0x90, 0x52], "mov w19, #0x8000"), - ([0x20, 0xc7, 0x91, 0x52], "mov w0, #0x8e39"), - ([0x23, 0xc7, 0x91, 0x52], "mov w3, #0x8e39"), - ([0x3b, 0xc7, 0x91, 0x52], "mov w27, #0x8e39"), - ([0x42, 0x55, 0x95, 0x52], "mov w2, #0xaaaa"), - ([0x64, 0x55, 0x95, 0x52], "mov w4, #0xaaab"), - ([0xe3, 0xce, 0x97, 0x52], "mov w3, #0xbe77"), - ([0xa2, 0x99, 0x99, 0x52], "mov w2, #0xcccd"), - ([0x42, 0xe1, 0x9a, 0x52], "mov w2, #0xd70a"), - ([0x62, 0x0f, 0x9e, 0x52], "mov w2, #0xf07b"), - ([0x05, 0x70, 0xa6, 0x52], "mov w5, #0x33800000"), - ([0x04, 0x30, 0xa7, 0x52], "mov w4, #0x39800000"), - ([0x00, 0x50, 0xa8, 0x52], "mov w0, #0x42800000"), - ([0x02, 0x59, 0xa8, 0x52], "mov w2, #0x42c80000"), - ([0x40, 0x9f, 0xa8, 0x52], "mov w0, #0x44fa0000"), - ([0x04, 0xb0, 0xa8, 0x52], "mov w4, #0x45800000"), - ([0x05, 0x70, 0xa9, 0x52], "mov w5, #0x4b800000"), - ([0x00, 0xf8, 0xaf, 0x52], "mov w0, #0x7fc00000"), - ([0x41, 0x5f, 0xb8, 0x52], "mov w1, #0xc2fa0000"), - ([0x06, 0x00, 0x80, 0x92], "mov x6, #0xffffffffffffffff"), - ([0xfb, 0x01, 0x80, 0x92], "mov x27, #0xfffffffffffffff0"), - ([0xe3, 0x02, 0x80, 0x92], "mov x3, #0xffffffffffffffe8"), - ([0xf8, 0x02, 0x80, 0x92], "mov x24, #0xffffffffffffffe8"), - ([0xfa, 0x03, 0x80, 0x92], "mov x26, #0xffffffffffffffe0"), - ([0x6b, 0x21, 0x88, 0x92], "mov x11, #0xffffffffffffbef4"), - ([0xe7, 0x41, 0x90, 0x92], "mov x7, #0xffffffffffff7df0"), - ([0xe8, 0x41, 0x90, 0x92], "mov x8, #0xffffffffffff7df0"), - ([0x00, 0x02, 0xe0, 0x92], "mov x0, #0xffefffffffffffff"), - ([0x00, 0x02, 0xf0, 0x92], "mov x0, #0x7fefffffffffffff"), - ([0xe0, 0x03, 0x00, 0xb2], "mov x0, #0x100000001"), - ([0xe1, 0x03, 0x00, 0xb2], "mov x1, #0x100000001"), - ([0xe2, 0x03, 0x00, 0xb2], "mov x2, #0x100000001"), - ([0xe4, 0x03, 0x00, 0xb2], "mov x4, #0x100000001"), - ([0xe1, 0xe7, 0x03, 0xb2], "mov x1, #0x6666666666666666"), - ([0xe0, 0x1b, 0x09, 0xb2], "mov x0, #0x3f8000003f800000"), - ([0xe0, 0x7f, 0x60, 0xb2], "mov x0, #0xffffffff00000000"), - ([0x1b, 0x00, 0x80, 0xd2], "mov x27, #0x0"), - ([0x8e, 0x01, 0x80, 0xd2], "mov x14, #0xc"), - ([0x12, 0x10, 0x80, 0xd2], "mov x18, #0x80"), - ([0x05, 0x14, 0x80, 0xd2], "mov x5, #0xa0"), - ([0x60, 0x1d, 0x80, 0xd2], "mov x0, #0xeb"), - ([0x02, 0x20, 0x80, 0xd2], "mov x2, #0x100"), - ([0x15, 0x40, 0x80, 0xd2], "mov x21, #0x200"), - ([0x14, 0xc0, 0x81, 0xd2], "mov x20, #0xe00"), - ([0x00, 0x00, 0x82, 0xd2], "mov x0, #0x1000"), - ([0x0c, 0x3a, 0x82, 0xd2], "mov x12, #0x11d0"), - ([0x00, 0x4a, 0x82, 0xd2], "mov x0, #0x1250"), - ([0x05, 0x4b, 0x82, 0xd2], "mov x5, #0x1258"), - ([0x03, 0x4d, 0x82, 0xd2], "mov x3, #0x1268"), - ([0x00, 0x4f, 0x82, 0xd2], "mov x0, #0x1278"), - ([0x02, 0x4f, 0x82, 0xd2], "mov x2, #0x1278"), - ([0x02, 0x51, 0x82, 0xd2], "mov x2, #0x1288"), - ([0xe1, 0x7f, 0x82, 0xd2], "mov x1, #0x13ff"), - ([0x07, 0x90, 0x82, 0xd2], "mov x7, #0x1480"), - ([0x08, 0xdb, 0x82, 0xd2], "mov x8, #0x16d8"), - ([0xe1, 0xff, 0x82, 0xd2], "mov x1, #0x17ff"), - ([0x09, 0xcf, 0x83, 0xd2], "mov x9, #0x1e78"), - ([0xe5, 0xff, 0x83, 0xd2], "mov x5, #0x1fff"), - ([0x03, 0x00, 0x84, 0xd2], "mov x3, #0x2000"), - ([0x0c, 0x4a, 0x84, 0xd2], "mov x12, #0x2250"), - ([0xe2, 0x7f, 0x84, 0xd2], "mov x2, #0x23ff"), - ([0x01, 0x80, 0x84, 0xd2], "mov x1, #0x2400"), - ([0x05, 0xe2, 0x84, 0xd2], "mov x5, #0x2710"), - ([0x00, 0xec, 0x84, 0xd2], "mov x0, #0x2760"), - ([0x0c, 0xee, 0x84, 0xd2], "mov x12, #0x2770"), - ([0x0c, 0x8a, 0x85, 0xd2], "mov x12, #0x2c50"), - ([0x0c, 0xc6, 0x85, 0xd2], "mov x12, #0x2e30"), - ([0x0c, 0xd6, 0x85, 0xd2], "mov x12, #0x2eb0"), - ([0x0c, 0xd8, 0x85, 0xd2], "mov x12, #0x2ec0"), - ([0x0c, 0xdc, 0x85, 0xd2], "mov x12, #0x2ee0"), - ([0x0c, 0xde, 0x85, 0xd2], "mov x12, #0x2ef0"), - ([0x0c, 0xe0, 0x85, 0xd2], "mov x12, #0x2f00"), - ([0x0c, 0xe4, 0x85, 0xd2], "mov x12, #0x2f20"), - ([0x0c, 0xe6, 0x85, 0xd2], "mov x12, #0x2f30"), - ([0x0c, 0x08, 0x86, 0xd2], "mov x12, #0x3040"), - ([0x0c, 0x20, 0x86, 0xd2], "mov x12, #0x3100"), - ([0x02, 0x21, 0x86, 0xd2], "mov x2, #0x3108"), - ([0x0c, 0x22, 0x86, 0xd2], "mov x12, #0x3110"), - ([0x01, 0x29, 0x86, 0xd2], "mov x1, #0x3148"), - ([0x0c, 0x2a, 0x86, 0xd2], "mov x12, #0x3150"), - ([0x00, 0x2d, 0x86, 0xd2], "mov x0, #0x3168"), - ([0x0c, 0x2e, 0x86, 0xd2], "mov x12, #0x3170"), - ([0x0c, 0x30, 0x86, 0xd2], "mov x12, #0x3180"), - ([0x0c, 0x42, 0x86, 0xd2], "mov x12, #0x3210"), - ([0x0c, 0x44, 0x86, 0xd2], "mov x12, #0x3220"), - ([0x06, 0x4d, 0x86, 0xd2], "mov x6, #0x3268"), - ([0x0c, 0x4e, 0x86, 0xd2], "mov x12, #0x3270"), - ([0xe1, 0xff, 0x87, 0xd2], "mov x1, #0x3fff"), - ([0xe2, 0xff, 0x87, 0xd2], "mov x2, #0x3fff"), - ([0x08, 0x02, 0x88, 0xd2], "mov x8, #0x4010"), - ([0x04, 0x51, 0x88, 0xd2], "mov x4, #0x4288"), - ([0x0c, 0x52, 0x88, 0xd2], "mov x12, #0x4290"), - ([0x04, 0x53, 0x88, 0xd2], "mov x4, #0x4298"), - ([0x0c, 0x54, 0x88, 0xd2], "mov x12, #0x42a0"), - ([0x8c, 0x58, 0x88, 0xd2], "mov x12, #0x42c4"), - ([0x02, 0x59, 0x88, 0xd2], "mov x2, #0x42c8"), - ([0x06, 0x59, 0x88, 0xd2], "mov x6, #0x42c8"), - ([0x08, 0x59, 0x88, 0xd2], "mov x8, #0x42c8"), - ([0x09, 0x59, 0x88, 0xd2], "mov x9, #0x42c8"), - ([0x0c, 0x6a, 0x88, 0xd2], "mov x12, #0x4350"), - ([0x0c, 0x4a, 0x89, 0xd2], "mov x12, #0x4a50"), - ([0x0c, 0x4c, 0x89, 0xd2], "mov x12, #0x4a60"), - ([0x00, 0xb4, 0x89, 0xd2], "mov x0, #0x4da0"), - ([0x0c, 0xb6, 0x89, 0xd2], "mov x12, #0x4db0"), - ([0x00, 0x0a, 0x90, 0xd2], "mov x0, #0x8050"), - ([0x01, 0x20, 0x90, 0xd2], "mov x1, #0x8100"), - ([0x0d, 0x20, 0x90, 0xd2], "mov x13, #0x8100"), - ([0x0a, 0x7a, 0x90, 0xd2], "mov x10, #0x83d0"), - ([0x0c, 0x7a, 0x90, 0xd2], "mov x12, #0x83d0"), - ([0x08, 0x7c, 0x90, 0xd2], "mov x8, #0x83e0"), - ([0x07, 0x7d, 0x90, 0xd2], "mov x7, #0x83e8"), - ([0x01, 0x46, 0x93, 0xd2], "mov x1, #0x9a30"), - ([0x0c, 0x48, 0x93, 0xd2], "mov x12, #0x9a40"), - ([0x01, 0x20, 0xa0, 0xd2], "mov x1, #0x1000000"), - ([0x00, 0xf0, 0xa7, 0xd2], "mov x0, #0x3f800000"), - ([0x1c, 0xf0, 0xa7, 0xd2], "mov x28, #0x3f800000"), - ([0x00, 0xf0, 0xb7, 0xd2], "mov x0, #0xbf800000"), - ([0x05, 0xf0, 0xb7, 0xd2], "mov x5, #0xbf800000"), - ([0x00, 0x00, 0xc8, 0xd2], "mov x0, #0x400000000000"), - ([0x00, 0x00, 0xd0, 0xd2], "mov x0, #0x800000000000"), - ([0x00, 0x00, 0xdd, 0xd2], "mov x0, #0xe80000000000"), - ([0x00, 0x02, 0xe0, 0xd2], "mov x0, #0x10000000000000"), - ([0x01, 0x94, 0xe7, 0xd2], "mov x1, #0x3ca0000000000000"), - ([0x01, 0x96, 0xe7, 0xd2], "mov x1, #0x3cb0000000000000"), - ([0x02, 0xce, 0xe7, 0xd2], "mov x2, #0x3e70000000000000"), - ([0x00, 0xe6, 0xe7, 0xd2], "mov x0, #0x3f30000000000000"), - ([0x13, 0xf0, 0xe7, 0xd2], "mov x19, #0x3f80000000000000"), - ([0x00, 0x0a, 0xe8, 0xd2], "mov x0, #0x4050000000000000"), - ([0x20, 0x0b, 0xe8, 0xd2], "mov x0, #0x4059000000000000"), - ([0x00, 0x12, 0xe8, 0xd2], "mov x0, #0x4090000000000000"), - ([0x04, 0x16, 0xe8, 0xd2], "mov x4, #0x40b0000000000000"), - ([0x40, 0x18, 0xe8, 0xd2], "mov x0, #0x40c2000000000000"), - ([0x01, 0x1c, 0xe8, 0xd2], "mov x1, #0x40e0000000000000"), - ([0x01, 0x22, 0xe8, 0xd2], "mov x1, #0x4110000000000000"), - ([0x00, 0x2e, 0xe8, 0xd2], "mov x0, #0x4170000000000000"), - ([0x00, 0xff, 0xef, 0xd2], "mov x0, #0x7ff8000000000000"), - ([0x00, 0x00, 0xf0, 0xd2], "mov x0, #0x8000000000000000"), - ([0x02, 0xfe, 0xff, 0xd2], "mov x2, #0xfff0000000000000"), - ([0x1b, 0x00, 0x80, 0x12], "mov w27, #0xffffffff"), - ([0x84, 0x00, 0x80, 0x12], "mov w4, #0xfffffffb"), - ([0x00, 0x19, 0x80, 0x12], "mov w0, #0xffffff37"), - ([0xe0, 0x07, 0x82, 0x12], "mov w0, #0xffffefc0"), - ([0xe1, 0x07, 0x82, 0x12], "mov w1, #0xffffefc0"), - ([0x00, 0x10, 0xb0, 0x12], "mov w0, #0x7f7fffff"), - ([0xf9, 0x03, 0x0a, 0xaa], "mov x25, x10"), - ([0x01, 0x20, 0xa0, 0xf2], "movk x1, #0x100, lsl #16"), - ([0x02, 0x0e, 0xc0, 0xf2], "movk x2, #0x70, lsl #32"), - ([0x03, 0x0e, 0xc0, 0xf2], "movk x3, #0x70, lsl #32"), - ([0x02, 0x0f, 0xc0, 0xf2], "movk x2, #0x78, lsl #32"), - ([0x04, 0x10, 0xc0, 0xf2], "movk x4, #0x80, lsl #32"), - ([0x05, 0x10, 0xc0, 0xf2], "movk x5, #0x80, lsl #32"), - ([0x04, 0x1c, 0xc0, 0xf2], "movk x4, #0xe0, lsl #32"), - ([0x07, 0x1e, 0xc0, 0xf2], "movk x7, #0xf0, lsl #32"), - ([0x06, 0x2c, 0xc0, 0xf2], "movk x6, #0x160, lsl #32"), - ([0xc1, 0xfd, 0xe7, 0xf2], "movk x1, #0x3fee, lsl #48"), - ([0x40, 0x09, 0xe8, 0xf2], "movk x0, #0x404a, lsl #48"), - ([0xe0, 0x13, 0xe8, 0xf2], "movk x0, #0x409f, lsl #48"), - ([0xe0, 0x11, 0xf8, 0xf2], "movk x0, #0xc08f, lsl #48"), - ([0x42, 0x55, 0xa5, 0x72], "movk w2, #0x2aaa, lsl #16"), - ([0x60, 0x1c, 0xa7, 0x72], "movk w0, #0x38e3, lsl #16"), - ([0x63, 0x1c, 0xa7, 0x72], "movk w3, #0x38e3, lsl #16"), - ([0x80, 0x99, 0xb9, 0x72], "movk w0, #0xcccc, lsl #16"), - ([0xfa, 0x03, 0x3c, 0xaa], "mvn x26, x28"), - ([0xfb, 0x03, 0x3c, 0xaa], "mvn x27, x28"), - ([0xfe, 0x03, 0x3e, 0xaa], "mvn x30, x30"), - ([0xe3, 0x03, 0x3b, 0x2a], "mvn w3, w27"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_cmp_ops() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0xff, 0x01, 0x01, 0xeb], "cmp x15, x1"), - ([0x1f, 0x02, 0x01, 0xeb], "cmp x16, x1"), - ([0x9f, 0x02, 0x1b, 0xeb], "cmp x20, x27"), - ([0xbf, 0x06, 0x1b, 0xeb], "cmp x21, x27, lsl #1"), - ([0x7f, 0xc3, 0x20, 0xeb], "cmp x27, w0, sxtw"), - ([0xff, 0x63, 0x21, 0xeb], "cmp sp, x1"), - ([0x1f, 0xc0, 0x21, 0xeb], "cmp x0, w1, sxtw"), - ([0x5f, 0xc0, 0x21, 0xeb], "cmp x2, w1, sxtw"), - ([0x5f, 0x0b, 0x00, 0xf1], "cmp x26, #0x2"), - ([0x7f, 0x0d, 0x00, 0xf1], "cmp x11, #0x3"), - ([0xdf, 0x0f, 0x00, 0xf1], "cmp x30, #0x3"), - ([0x7f, 0x13, 0x00, 0xf1], "cmp x27, #0x4"), - ([0xdf, 0x16, 0x00, 0xf1], "cmp x22, #0x5"), - ([0x3f, 0x1b, 0x00, 0xf1], "cmp x25, #0x6"), - ([0x7f, 0x1c, 0x00, 0xf1], "cmp x3, #0x7"), - ([0x1f, 0x20, 0x00, 0xf1], "cmp x0, #0x8"), - ([0x9f, 0x23, 0x00, 0xf1], "cmp x28, #0x8"), - ([0x9f, 0x27, 0x00, 0xf1], "cmp x28, #0x9"), - ([0x9f, 0x2b, 0x00, 0xf1], "cmp x28, #0xa"), - ([0x1f, 0x2c, 0x00, 0xf1], "cmp x0, #0xb"), - ([0x9f, 0x2f, 0x00, 0xf1], "cmp x28, #0xb"), - ([0x1f, 0x30, 0x00, 0xf1], "cmp x0, #0xc"), - ([0x9f, 0x33, 0x00, 0xf1], "cmp x28, #0xc"), - ([0x1f, 0x34, 0x00, 0xf1], "cmp x0, #0xd"), - ([0xbf, 0x36, 0x00, 0xf1], "cmp x21, #0xd"), - ([0xdf, 0x36, 0x00, 0xf1], "cmp x22, #0xd"), - ([0x1f, 0x3d, 0x00, 0xf1], "cmp x8, #0xf"), - ([0xbf, 0x3e, 0x00, 0xf1], "cmp x21, #0xf"), - ([0xdf, 0x3e, 0x00, 0xf1], "cmp x22, #0xf"), - ([0x1f, 0x41, 0x00, 0xf1], "cmp x8, #0x10"), - ([0x5f, 0x41, 0x00, 0xf1], "cmp x10, #0x10"), - ([0xff, 0x80, 0x00, 0xf1], "cmp x7, #0x20"), - ([0x3f, 0xfc, 0x00, 0xf1], "cmp x1, #0x3f"), - ([0x1f, 0x01, 0x01, 0xf1], "cmp x8, #0x40"), - ([0x3f, 0xfc, 0x07, 0xf1], "cmp x1, #0x1ff"), - ([0x3f, 0xfc, 0x0f, 0xf1], "cmp x1, #0x3ff"), - ([0x7f, 0xfc, 0x0f, 0xf1], "cmp x3, #0x3ff"), - ([0x1f, 0x00, 0x10, 0xf1], "cmp x0, #0x400"), - ([0x3f, 0x00, 0x10, 0xf1], "cmp x1, #0x400"), - ([0x3f, 0x00, 0x24, 0xf1], "cmp x1, #0x900"), - ([0x1f, 0xfc, 0x3f, 0xf1], "cmp x0, #0xfff"), - ([0x3f, 0xfc, 0x3f, 0xf1], "cmp x1, #0xfff"), - ([0x1f, 0x08, 0x40, 0xf1], "cmp x0, #0x2, lsl #12"), - ([0x3f, 0x08, 0x40, 0xf1], "cmp x1, #0x2, lsl #12"), - ([0x7f, 0x01, 0x00, 0xf1], "cmp x11, #0x0"), - ([0x3f, 0x07, 0x00, 0xf1], "cmp x25, #0x1"), - ([0x1f, 0x00, 0x00, 0x71], "cmp w0, #0x0"), - ([0x3f, 0x04, 0x00, 0x6b], "cmp w1, w0, lsl #1"), - ([0x5f, 0x05, 0x80, 0x6b], "cmp w10, w0, asr #1"), - ([0x3f, 0x04, 0x00, 0x71], "cmp w1, #0x1"), - ([0x5f, 0x24, 0x34, 0x71], "cmp w2, #0xd09"), - ([0x7f, 0x0a, 0x40, 0x71], "cmp w19, #0x2, lsl #12"), - ([0x1f, 0x80, 0x40, 0x71], "cmp w0, #0x20, lsl #12"), - ([0x1f, 0x00, 0x44, 0x71], "cmp w0, #0x100, lsl #12"), - ([0x9f, 0x02, 0x1a, 0x2b], "cmn w20, w26"), - ([0x1f, 0x58, 0x00, 0x31], "cmn w0, #0x16"), - ([0x1f, 0x04, 0x00, 0xb1], "cmn x0, #0x1"), - ([0xdf, 0x38, 0x00, 0xb1], "cmn x6, #0xe"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_tst_ops() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x9f, 0x02, 0x05, 0x6a], "tst w20, w5"), - ([0x1f, 0x78, 0x1e, 0x72], "tst w0, #0xfffffffd"), - ([0x3f, 0x78, 0x1e, 0x72], "tst w1, #0xfffffffd"), - ([0x5f, 0x03, 0x13, 0xea], "tst x26, x19"), - ([0x3f, 0x01, 0x40, 0xf2], "tst x9, #0x1"), - ([0x5f, 0x01, 0x40, 0xf2], "tst x10, #0x1"), - ([0x1f, 0x04, 0x40, 0xf2], "tst x0, #0x3"), - ([0x3f, 0x09, 0x40, 0xf2], "tst x9, #0x7"), - ([0x3f, 0x01, 0x7e, 0xf2], "tst x9, #0x4"), - ([0x5f, 0x04, 0x7f, 0xf2], "tst x2, #0x6"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_conditional_ops() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x82, 0xd2, 0x80, 0x1a], "csel w2, w20, w0, le"), - ([0x94, 0xd2, 0x80, 0x1a], "csel w20, w20, w0, le"), - ([0xe2, 0x13, 0x81, 0x1a], "csel w2, wzr, w1, ne"), - ([0x73, 0xa2, 0x81, 0x1a], "csel w19, w19, w1, ge"), - ([0xe1, 0xa3, 0x81, 0x1a], "csel w1, wzr, w1, ge"), - ([0xe1, 0xa7, 0x81, 0x1a], "csinc w1, wzr, w1, ge"), - ([0x21, 0xb3, 0x81, 0x1a], "csel w1, w25, w1, lt"), - ([0x9c, 0xd3, 0x81, 0x1a], "csel w28, w28, w1, le"), - ([0x00, 0x00, 0x82, 0x1a], "csel w0, w0, w2, eq"), - ([0x00, 0x30, 0x82, 0x1a], "csel w0, w0, w2, lo"), - ([0x42, 0x54, 0x82, 0x1a], "cinc w2, w2, mi"), - ([0x62, 0x80, 0x82, 0x1a], "csel w2, w3, w2, hi"), - ([0x02, 0xa0, 0x82, 0x1a], "csel w2, w0, w2, ge"), - ([0x44, 0xa4, 0x84, 0x1a], "csinc w4, w2, w4, ge"), - ([0x81, 0xc7, 0x9f, 0x1a], "csinc w1, w28, wzr, gt"), - ([0x9c, 0xc7, 0x9f, 0x1a], "csinc w28, w28, wzr, gt"), - ([0xf4, 0xc7, 0x9f, 0x1a], "cset w20, le"), - ([0x94, 0xd2, 0x9f, 0x1a], "csel w20, w20, wzr, le"), - ([0x00, 0xd4, 0x9f, 0x1a], "csinc w0, w0, wzr, le"), - ([0x21, 0xd4, 0x9f, 0x1a], "csinc w1, w1, wzr, le"), - ([0xfa, 0xd7, 0x9f, 0x1a], "cset w26, gt"), - ([0x16, 0x04, 0x80, 0x5a], "cneg w22, w0, ne"), - ([0x00, 0x44, 0x82, 0x5a], "csneg w0, w0, w2, mi"), - ([0x9c, 0x17, 0x9c, 0x5a], "cneg w28, w28, eq"), - ([0x9c, 0x03, 0x9f, 0x5a], "csinv w28, w28, wzr, eq"), - ([0xfc, 0x03, 0x9f, 0x5a], "csetm w28, ne"), - ([0x7b, 0x13, 0x9f, 0x5a], "csinv w27, w27, wzr, ne"), - ([0xc6, 0xb0, 0x9f, 0x5a], "csinv w6, w6, wzr, lt"), - ([0x63, 0xc0, 0x9f, 0x5a], "csinv w3, w3, wzr, gt"), - ([0x84, 0x1b, 0x40, 0xfa], "ccmp x28, #0x0, #0x4, ne"), - ([0x84, 0xca, 0x40, 0xfa], "ccmp x20, #0x0, #0x4, gt"), - ([0x80, 0x08, 0x41, 0xfa], "ccmp x4, #0x1, #0x0, eq"), - ([0x64, 0x12, 0x43, 0xfa], "ccmp x19, x3, #0x4, ne"), - ([0x04, 0x10, 0x45, 0xfa], "ccmp x0, x5, #0x4, ne"), - ([0x24, 0xd3, 0x5b, 0xfa], "ccmp x25, x27, #0x4, le"), - ([0x00, 0x08, 0x40, 0x7a], "ccmp w0, #0x0, #0x0, eq"), - ([0x01, 0xc0, 0x5c, 0x7a], "ccmp w0, w28, #0x1, gt"), - ([0x04, 0x08, 0x41, 0x3a], "ccmn w0, #0x1, #0x4, eq"), - ([0x84, 0xbb, 0x41, 0x3a], "ccmn w28, #0x1, #0x4, lt"), - ([0x04, 0xc8, 0x41, 0x3a], "ccmn w0, #0x1, #0x4, gt"), - ([0xa4, 0xc8, 0x41, 0x3a], "ccmn w5, #0x1, #0x4, gt"), - ([0x84, 0xdb, 0x41, 0x3a], "ccmn w28, #0x1, #0x4, le"), - ([0x84, 0x1b, 0x4a, 0x3a], "ccmn w28, #0xa, #0x4, ne"), - ([0x08, 0x41, 0x80, 0x9a], "csel x8, x8, x0, mi"), - ([0x8c, 0xb1, 0x8f, 0x9a], "csel x12, x12, x15, lt"), - ([0xc6, 0x50, 0x97, 0x9a], "csel x6, x6, x23, pl"), - ([0x08, 0x51, 0x97, 0x9a], "csel x8, x8, x23, pl"), - ([0x77, 0xd0, 0x97, 0x9a], "csel x23, x3, x23, le"), - ([0x9c, 0xa3, 0x9f, 0x9a], "csel x28, x28, xzr, ge"), - ([0x00, 0xc0, 0x9f, 0x9a], "csel x0, x0, xzr, gt"), - ([0x21, 0xc0, 0x9f, 0x9a], "csel x1, x1, xzr, gt"), - ([0x33, 0xc0, 0x9f, 0x9a], "csel x19, x1, xzr, gt"), - ([0x63, 0xc0, 0x9f, 0x9a], "csel x3, x3, xzr, gt"), - ([0x39, 0xc3, 0x9f, 0x9a], "csel x25, x25, xzr, gt"), - ([0x05, 0xc4, 0x9f, 0x9a], "csinc x5, x0, xzr, gt"), - ([0x18, 0xc7, 0x9f, 0x9a], "csinc x24, x24, xzr, gt"), - ([0x39, 0xc7, 0x9f, 0x9a], "csinc x25, x25, xzr, gt"), - ([0xf7, 0xc7, 0x9f, 0x9a], "cset x23, le"), - ([0x1b, 0xd0, 0x9f, 0x9a], "csel x27, x0, xzr, le"), - ([0x00, 0xd3, 0x9f, 0x9a], "csel x0, x24, xzr, le"), - ([0xe0, 0xd7, 0x9f, 0x9a], "cset x0, gt"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_muldiv_ops() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x39, 0x08, 0xc0, 0x1a], "udiv w25, w1, w0"), - ([0x3a, 0x09, 0xc1, 0x1a], "udiv w26, w9, w1"), - ([0xa0, 0x0e, 0xc1, 0x1a], "sdiv w0, w21, w1"), - ([0x00, 0x08, 0xc2, 0x1a], "udiv w0, w0, w2"), - ([0x61, 0x0b, 0xc2, 0x1a], "udiv w1, w27, w2"), - ([0x00, 0x0c, 0xc2, 0x1a], "sdiv w0, w0, w2"), - ([0x01, 0x0d, 0xc2, 0x1a], "sdiv w1, w8, w2"), - ([0x00, 0x08, 0xc3, 0x1a], "udiv w0, w0, w3"), - ([0x6b, 0x0d, 0xc4, 0x1a], "sdiv w11, w11, w4"), - ([0x73, 0x0e, 0xdc, 0x1a], "sdiv w19, w19, w28"), - ([0xa1, 0x72, 0x00, 0x1b], "madd w1, w21, w0, w28"), - ([0x3c, 0xa8, 0x00, 0x1b], "msub w28, w1, w0, w10"), - ([0x80, 0x7f, 0x01, 0x1b], "mul w0, w28, w1"), - ([0x00, 0x0c, 0xd3, 0x9a], "sdiv x0, x0, x19"), - ([0x80, 0x0c, 0xda, 0x9a], "sdiv x0, x4, x26"), - ([0x00, 0x0c, 0xdb, 0x9a], "sdiv x0, x0, x27"), - ([0x00, 0x00, 0x00, 0x9b], "madd x0, x0, x0, x0"), - ([0x9c, 0x7f, 0x1b, 0x9b], "mul x28, x28, x27"), - ([0x00, 0xd4, 0x1b, 0x9b], "msub x0, x0, x27, x21"), - ([0x20, 0x00, 0x1c, 0x9b], "madd x0, x1, x28, x0"), - ([0x81, 0x7b, 0x1e, 0x9b], "madd x1, x28, x30, x30"), - ([0xad, 0x7d, 0x1e, 0x9b], "mul x13, x13, x30"), - ([0x02, 0x7f, 0x3a, 0x9b], "smull x2, w24, w26"), - ([0x42, 0x64, 0x3c, 0x9b], "smaddl x2, w2, w28, x25"), - ([0x29, 0x7c, 0x3c, 0x9b], "smull x9, w1, w28"), - ([0x20, 0x7c, 0xa0, 0x9b], "umull x0, w1, w0"), - ([0x42, 0x0c, 0xa4, 0x9b], "umaddl x2, w2, w4, x3"), - ([0x21, 0x7c, 0xa4, 0x9b], "umull x1, w1, w4"), - ([0x63, 0x98, 0xa4, 0x9b], "umsubl x3, w3, w4, x6"), - ([0x85, 0x00, 0xa5, 0x9b], "umaddl x5, w4, w5, x0"), - ([0x10, 0xa8, 0xb0, 0x9b], "umsubl x16, w0, w16, x10"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_branch_ops() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x40, 0x00, 0x00, 0x34], "cbz w0, $+0x8"), - ([0xcd, 0xff, 0xff, 0x34], "cbz w13, $-0x8"), - ([0x40, 0x00, 0x00, 0x35], "cbnz w0, $+0x8"), - ([0x19, 0xfd, 0xff, 0x35], "cbnz w25, $-0x60"), - ([0xc1, 0xff, 0xff, 0x35], "cbnz w1, $-0x8"), - ([0x61, 0x00, 0x00, 0x36], "tbz w1, #0x0, $+0xc"), - ([0x20, 0x01, 0x00, 0x36], "tbz w0, #0x0, $+0x24"), - ([0x73, 0x00, 0xf8, 0x36], "tbz w19, #0x1f, $+0xc"), - ([0x27, 0xff, 0xff, 0x36], "tbz w7, #0x1f, $-0x1c"), - ([0xf3, 0x05, 0x00, 0x37], "tbnz w19, #0x0, $+0xbc"), - ([0xfb, 0xff, 0xff, 0x17], "b $-0x14"), - ([0xfd, 0xff, 0xff, 0x17], "b $-0xc"), - ([0x6d, 0x02, 0x00, 0x54], "b.le $+0x4c"), - ([0x6d, 0xff, 0xff, 0x54], "b.le $-0x14"), - ([0x97, 0x1e, 0x00, 0x94], "bl $+0x7a5c"), - ([0xd2, 0xff, 0xff, 0x97], "bl $-0xb8"), - ([0x53, 0x00, 0x00, 0xb4], "cbz x19, $+0x8"), - ([0x7c, 0x00, 0x00, 0xb4], "cbz x28, $+0xc"), - ([0x96, 0x00, 0x00, 0xb5], "cbnz x22, $+0x10"), - ([0x98, 0x00, 0x00, 0xb5], "cbnz x24, $+0x10"), - ([0xa6, 0x00, 0xf8, 0xb6], "tbz x6, #0x3f, $+0x14"), - ([0x73, 0x03, 0xf8, 0xb7], "tbnz x19, #0x3f, $+0x6c"), - ([0x23, 0xf8, 0xff, 0xb7], "tbnz x3, #0x3f, $-0xfc"), - ([0x40, 0x00, 0x1f, 0xd6], "br x2"), - ([0x00, 0x02, 0x1f, 0xd6], "br x16"), - ([0x20, 0x02, 0x1f, 0xd6], "br x17"), - ([0x00, 0x00, 0x3f, 0xd6], "blr x0"), - ([0x20, 0x00, 0x3f, 0xd6], "blr x1"), - ([0x80, 0x03, 0x3f, 0xd6], "blr x28"), - ([0xc0, 0x03, 0x5f, 0xd6], "ret"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_simd_ops() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x64, 0xcc, 0x21, 0x0e], "fmla v4.2s, v3.2s, v1.2s"), - ([0x00, 0xd4, 0x21, 0x0e], "fadd v0.2s, v0.2s, v1.2s"), - ([0x03, 0xcc, 0x22, 0x0e], "fmla v3.2s, v0.2s, v2.2s"), - ([0x21, 0xd4, 0x23, 0x0e], "fadd v1.2s, v1.2s, v3.2s"), - ([0x29, 0xd5, 0x35, 0x0e], "fadd v9.2s, v9.2s, v21.2s"), - ([0x4a, 0xd5, 0x35, 0x0e], "fadd v10.2s, v10.2s, v21.2s"), - ([0x42, 0x78, 0x61, 0x0e], "fcvtl v2.2d, v2.2s"), - ([0x63, 0x78, 0x61, 0x0e], "fcvtl v3.2d, v3.2s"), - ([0x00, 0xf8, 0xa0, 0x0e], "fabs v0.2s, v0.2s"), - ([0x25, 0xcc, 0xa2, 0x0e], "fmls v5.2s, v1.2s, v2.2s"), - ([0x10, 0x11, 0x80, 0x0f], "fmla v16.2s, v8.2s, v0.s[0]"), - ([0x39, 0x58, 0x88, 0x0f], "fmls v25.2s, v1.2s, v8.s[2]"), - ([0x08, 0x92, 0x8a, 0x0f], "fmul v8.2s, v16.2s, v10.s[0]"), - ([0x01, 0x12, 0x8b, 0x0f], "fmla v1.2s, v16.2s, v11.s[0]"), - ([0x8c, 0x12, 0x8e, 0x0f], "fmla v12.2s, v20.2s, v14.s[0]"), - ([0xc6, 0x12, 0x8e, 0x0f], "fmla v6.2s, v22.2s, v14.s[0]"), - ([0x3c, 0x58, 0xa9, 0x0f], "fmls v28.2s, v1.2s, v9.s[3]"), - ([0x00, 0x06, 0x20, 0x1e], "fccmp s16, s0, #0x0, eq"), - ([0x05, 0x08, 0x22, 0x1e], "fmul s5, s0, s2"), - ([0x35, 0x88, 0x24, 0x1e], "fnmul s21, s1, s4"), - ([0x42, 0x88, 0x24, 0x1e], "fnmul s2, s2, s4"), - ([0x00, 0xdc, 0x26, 0x1e], "fcsel s0, s0, s6, le"), - ([0x4e, 0x0c, 0x2e, 0x1e], "fcsel s14, s2, s14, eq"), - ([0x41, 0x18, 0x2e, 0x1e], "fdiv s1, s2, s14"), - ([0xd3, 0x5e, 0x33, 0x1e], "fcsel s19, s22, s19, pl"), - ([0xe4, 0x3b, 0x3b, 0x1e], "fsub s4, s31, s27"), - ([0xa1, 0x08, 0x3c, 0x1e], "fmul s1, s5, s28"), - ([0xb8, 0x1a, 0x3c, 0x1e], "fdiv s24, s21, s28"), - ([0x5c, 0x39, 0x3c, 0x1e], "fsub s28, s10, s28"), - ([0x76, 0x08, 0x3d, 0x1e], "fmul s22, s3, s29"), - ([0x59, 0x18, 0x3d, 0x1e], "fdiv s25, s2, s29"), - ([0x26, 0x08, 0x3e, 0x1e], "fmul s6, s1, s30"), - ([0x39, 0x3b, 0x3f, 0x1e], "fsub s25, s25, s31"), - ([0x20, 0x04, 0x60, 0x1e], "fccmp d1, d0, #0x0, eq"), - ([0x20, 0x06, 0x60, 0x1e], "fccmp d17, d0, #0x0, eq"), - ([0x00, 0x08, 0x60, 0x1e], "fmul d0, d0, d0"), - ([0xe8, 0x0b, 0x60, 0x1e], "fmul d8, d31, d0"), - ([0xf3, 0x0b, 0x60, 0x1e], "fmul d19, d31, d0"), - ([0x40, 0x0c, 0x60, 0x1e], "fcsel d0, d2, d0, eq"), - ([0x08, 0x0d, 0x60, 0x1e], "fcsel d8, d8, d0, eq"), - ([0xc4, 0x14, 0x60, 0x1e], "fccmp d6, d0, #0x4, ne"), - ([0x72, 0x15, 0x60, 0x1e], "fccmpe d11, d0, #0x2, ne"), - ([0xa4, 0x15, 0x60, 0x1e], "fccmp d13, d0, #0x4, ne"), - ([0xe4, 0x15, 0x60, 0x1e], "fccmp d15, d0, #0x4, ne"), - ([0x20, 0x18, 0x60, 0x1e], "fdiv d0, d1, d0"), - ([0xc6, 0x1a, 0x60, 0x1e], "fdiv d6, d22, d0"), - ([0x20, 0x1c, 0x60, 0x1e], "fcsel d0, d1, d0, ne"), - ([0xef, 0x1d, 0x60, 0x1e], "fcsel d15, d15, d0, ne"), - ([0x70, 0x22, 0x60, 0x1e], "fcmpe d19, d0"), - ([0xd8, 0x22, 0x60, 0x1e], "fcmpe d22, #0.0"), - ([0x08, 0x23, 0x60, 0x1e], "fcmp d24, #0.0"), - ([0x80, 0x28, 0x60, 0x1e], "fadd d0, d4, d0"), - ([0x22, 0x4c, 0x60, 0x1e], "fcsel d2, d1, d0, mi"), - ([0x21, 0x5c, 0x60, 0x1e], "fcsel d1, d1, d0, pl"), - ([0x20, 0x68, 0x60, 0x1e], "fmaxnm d0, d1, d0"), - ([0xab, 0x6a, 0x60, 0x1e], "fmaxnm d11, d21, d0"), - ([0xaf, 0x79, 0x60, 0x1e], "fminnm d15, d13, d0"), - ([0x82, 0x8b, 0x60, 0x1e], "fnmul d2, d28, d0"), - ([0xc0, 0x8b, 0x60, 0x1e], "fnmul d0, d30, d0"), - ([0x22, 0x9c, 0x60, 0x1e], "fcsel d2, d1, d0, ls"), - ([0x08, 0xad, 0x60, 0x1e], "fcsel d8, d8, d0, ge"), - ([0x20, 0xcc, 0x60, 0x1e], "fcsel d0, d1, d0, gt"), - ([0x6b, 0xdd, 0x60, 0x1e], "fcsel d11, d11, d0, le"), - ([0xec, 0x0b, 0x61, 0x1e], "fmul d12, d31, d1"), - ([0x41, 0x0c, 0x61, 0x1e], "fcsel d1, d2, d1, eq"), - ([0x04, 0x14, 0x61, 0x1e], "fccmp d0, d1, #0x4, ne"), - ([0xe1, 0x1b, 0x61, 0x1e], "fdiv d1, d31, d1"), - ([0x00, 0x1c, 0x61, 0x1e], "fcsel d0, d0, d1, ne"), - ([0xd0, 0x22, 0x61, 0x1e], "fcmpe d22, d1"), - ([0x41, 0x2b, 0x61, 0x1e], "fadd d1, d26, d1"), - ([0x00, 0x38, 0x61, 0x1e], "fsub d0, d0, d1"), - ([0x81, 0x3b, 0x61, 0x1e], "fsub d1, d28, d1"), - ([0x01, 0x4c, 0x61, 0x1e], "fcsel d1, d0, d1, mi"), - ([0xef, 0x5d, 0x61, 0x1e], "fcsel d15, d15, d1, pl"), - ([0x6c, 0x68, 0x61, 0x1e], "fmaxnm d12, d3, d1"), - ([0x61, 0x78, 0x61, 0x1e], "fminnm d1, d3, d1"), - ([0x06, 0x88, 0x61, 0x1e], "fnmul d6, d0, d1"), - ([0x01, 0x9c, 0x61, 0x1e], "fcsel d1, d0, d1, ls"), - ([0x02, 0xac, 0x61, 0x1e], "fcsel d2, d0, d1, ge"), - ([0x84, 0xbc, 0x61, 0x1e], "fcsel d4, d4, d1, lt"), - ([0x04, 0xc4, 0x61, 0x1e], "fccmp d0, d1, #0x4, gt"), - ([0x11, 0xc4, 0x61, 0x1e], "fccmpe d0, d1, #0x1, gt"), - ([0x50, 0xcc, 0x61, 0x1e], "fcsel d16, d2, d1, gt"), - ([0x92, 0xcc, 0x61, 0x1e], "fcsel d18, d4, d1, gt"), - ([0x00, 0xdc, 0x61, 0x1e], "fcsel d0, d0, d1, le"), - ([0x20, 0x04, 0x62, 0x1e], "fccmp d1, d2, #0x0, eq"), - ([0x00, 0x08, 0x62, 0x1e], "fmul d0, d0, d2"), - ([0x8b, 0x09, 0x62, 0x1e], "fmul d11, d12, d2"), - ([0x04, 0x14, 0x6a, 0x1e], "fccmp d0, d10, #0x4, ne"), - ([0x72, 0x15, 0x6a, 0x1e], "fccmpe d11, d10, #0x2, ne"), - ([0x00, 0x18, 0x6a, 0x1e], "fdiv d0, d0, d10"), - ([0xf5, 0x5e, 0x75, 0x1e], "fcsel d21, d23, d21, pl"), - ([0xa5, 0x68, 0x75, 0x1e], "fmaxnm d5, d5, d21"), - ([0x42, 0x88, 0x75, 0x1e], "fnmul d2, d2, d21"), - ([0x20, 0x06, 0x76, 0x1e], "fccmp d17, d22, #0x0, eq"), - ([0x41, 0x18, 0x76, 0x1e], "fdiv d1, d2, d22"), - ([0xa5, 0x18, 0x76, 0x1e], "fdiv d5, d5, d22"), - ([0xf0, 0x22, 0x76, 0x1e], "fcmpe d23, d22"), - ([0x00, 0x28, 0x76, 0x1e], "fadd d0, d0, d22"), - ([0xf7, 0x39, 0x77, 0x1e], "fsub d23, d15, d23"), - ([0x10, 0x3a, 0x77, 0x1e], "fsub d16, d16, d23"), - ([0x01, 0x68, 0x77, 0x1e], "fmaxnm d1, d0, d23"), - ([0x42, 0x88, 0x77, 0x1e], "fnmul d2, d2, d23"), - ([0x00, 0x00, 0x78, 0x1e], "fcvtzs w0, d0"), - ([0x85, 0x01, 0x78, 0x1e], "fcvtzs w5, d12"), - ([0x00, 0x18, 0x7e, 0x1e], "fdiv d0, d0, d30"), - ([0x42, 0x18, 0x7e, 0x1e], "fdiv d2, d2, d30"), - ([0x84, 0x18, 0x7e, 0x1e], "fdiv d4, d4, d30"), - ([0x52, 0x1a, 0x7e, 0x1e], "fdiv d18, d18, d30"), - ([0xbd, 0x1b, 0x7e, 0x1e], "fdiv d29, d29, d30"), - ([0x21, 0x28, 0x7e, 0x1e], "fadd d1, d1, d30"), - ([0x63, 0x38, 0x7e, 0x1e], "fsub d3, d3, d30"), - ([0x7c, 0x38, 0x7e, 0x1e], "fsub d28, d3, d30"), - ([0xe7, 0x38, 0x7e, 0x1e], "fsub d7, d7, d30"), - ([0x73, 0x3a, 0x7e, 0x1e], "fsub d19, d19, d30"), - ([0x03, 0x08, 0x7f, 0x1e], "fmul d3, d0, d31"), - ([0x23, 0x08, 0x7f, 0x1e], "fmul d3, d1, d31"), - ([0x24, 0x08, 0x7f, 0x1e], "fmul d4, d1, d31"), - ([0x29, 0x08, 0x7f, 0x1e], "fmul d9, d1, d31"), - ([0x0c, 0xb2, 0x01, 0x1f], "fmsub s12, s16, s1, s12"), - ([0x39, 0xe6, 0x74, 0x1f], "fnmsub d25, d17, d20, d25"), - ([0x82, 0x0a, 0x75, 0x1f], "fnmadd d2, d20, d21, d2"), - ([0xc6, 0xf4, 0x30, 0x4e], "fmax v6.4s, v6.4s, v16.4s"), - ([0x64, 0xcc, 0x31, 0x4e], "fmla v4.4s, v3.4s, v17.4s"), - ([0xc6, 0xd4, 0x3c, 0x4e], "fadd v6.4s, v6.4s, v28.4s"), - ([0x82, 0xce, 0x3d, 0x4e], "fmla v2.4s, v20.4s, v29.4s"), - ([0xdf, 0x7b, 0x61, 0x4e], "fcvtl2 v31.2d, v30.4s"), - ([0x18, 0xf7, 0x79, 0x4e], "fmax v24.2d, v24.2d, v25.2d"), - ([0xde, 0xd7, 0x7f, 0x4e], "fadd v30.2d, v30.2d, v31.2d"), - ([0x21, 0xf8, 0xa0, 0x4e], "fabs v1.4s, v1.4s"), - ([0x00, 0xd4, 0xa1, 0x4e], "fsub v0.4s, v0.4s, v1.4s"), - ([0x65, 0xcc, 0xb0, 0x4e], "fmls v5.4s, v3.4s, v16.4s"), - ([0x64, 0xcc, 0xb1, 0x4e], "fmls v4.4s, v3.4s, v17.4s"), - ([0xff, 0xfb, 0xe0, 0x4e], "fabs v31.2d, v31.2d"), - ([0x94, 0xd6, 0xe6, 0x4e], "fsub v20.2d, v20.2d, v6.2d"), - ([0x30, 0xce, 0xf4, 0x4e], "fmls v16.2d, v17.2d, v20.2d"), - ([0x4f, 0xce, 0xf4, 0x4e], "fmls v15.2d, v18.2d, v20.2d"), - ([0x5a, 0x18, 0x88, 0x4f], "fmla v26.4s, v2.4s, v8.s[2]"), - ([0x1d, 0x98, 0xaa, 0x4f], "fmul v29.4s, v0.4s, v10.s[3]"), - ([0xfe, 0x18, 0xae, 0x4f], "fmla v30.4s, v7.4s, v14.s[3]"), - ([0xfe, 0x50, 0xaf, 0x4f], "fmls v30.4s, v7.4s, v15.s[1]"), - ([0x31, 0x50, 0xc8, 0x4f], "fmls v17.2d, v1.2d, v8.d[0]"), - ([0xc7, 0x93, 0xcb, 0x4f], "fmul v7.2d, v30.2d, v11.d[0]"), - ([0xb0, 0x18, 0xcc, 0x4f], "fmla v16.2d, v5.2d, v12.d[1]"), - ([0xf7, 0x58, 0xcc, 0x4f], "fmls v23.2d, v7.2d, v12.d[1]"), - ([0xa0, 0xb9, 0xa1, 0x5e], "fcvtzs s0, s13"), - ([0x40, 0x10, 0x82, 0x5f], "fmla s0, s2, v2.s[0]"), - ([0x84, 0x12, 0x8a, 0x5f], "fmla s4, s20, v10.s[0]"), - ([0xa5, 0x12, 0x8a, 0x5f], "fmla s5, s21, v10.s[0]"), - ([0x00, 0x13, 0x8a, 0x5f], "fmla s0, s24, v10.s[0]"), - ([0x21, 0x13, 0x8a, 0x5f], "fmla s1, s25, v10.s[0]"), - ([0x84, 0x13, 0x8a, 0x5f], "fmla s4, s28, v10.s[0]"), - ([0xa5, 0x13, 0x8a, 0x5f], "fmla s5, s29, v10.s[0]"), - ([0x00, 0x92, 0x8a, 0x5f], "fmul s0, s16, v10.s[0]"), - ([0x84, 0x92, 0x8a, 0x5f], "fmul s4, s20, v10.s[0]"), - ([0x00, 0x93, 0x8a, 0x5f], "fmul s0, s24, v10.s[0]"), - ([0x84, 0x93, 0x8a, 0x5f], "fmul s4, s28, v10.s[0]"), - ([0x01, 0x12, 0x8b, 0x5f], "fmla s1, s16, v11.s[0]"), - ([0x85, 0x12, 0x8b, 0x5f], "fmla s5, s20, v11.s[0]"), - ([0x01, 0x13, 0x8b, 0x5f], "fmla s1, s24, v11.s[0]"), - ([0x85, 0x13, 0x8b, 0x5f], "fmla s5, s28, v11.s[0]"), - ([0x20, 0x52, 0x8b, 0x5f], "fmls s0, s17, v11.s[0]"), - ([0x20, 0x52, 0xb8, 0x5f], "fmls s0, s17, v24.s[1]"), - ([0x40, 0x10, 0xc2, 0x5f], "fmla d0, d2, v2.d[0]"), - ([0x03, 0x90, 0xc2, 0x5f], "fmul d3, d0, v2.d[0]"), - ([0x20, 0x5a, 0xd8, 0x5f], "fmls d0, d17, v24.d[1]"), - ([0x21, 0xdc, 0x60, 0x6e], "fmul v1.2d, v1.2d, v0.2d"), - ([0x42, 0xdc, 0x60, 0x6e], "fmul v2.2d, v2.2d, v0.2d"), - ([0x44, 0xdc, 0x60, 0x6e], "fmul v4.2d, v2.2d, v0.2d"), - ([0x63, 0xdc, 0x60, 0x6e], "fmul v3.2d, v3.2d, v0.2d"), - ([0x84, 0xdc, 0x60, 0x6e], "fmul v4.2d, v4.2d, v0.2d"), - ([0x42, 0xdc, 0x61, 0x6e], "fmul v2.2d, v2.2d, v1.2d"), - ([0x02, 0xdc, 0x62, 0x6e], "fmul v2.2d, v0.2d, v2.2d"), - ([0x04, 0xdc, 0x62, 0x6e], "fmul v4.2d, v0.2d, v2.2d"), - ([0x06, 0xdc, 0x62, 0x6e], "fmul v6.2d, v0.2d, v2.2d"), - ([0x42, 0xd4, 0x63, 0x6e], "faddp v2.2d, v2.2d, v3.2d"), - ([0x05, 0xdc, 0x63, 0x6e], "fmul v5.2d, v0.2d, v3.2d"), - ([0x07, 0xdc, 0x63, 0x6e], "fmul v7.2d, v0.2d, v3.2d"), - ([0x42, 0xdc, 0x63, 0x6e], "fmul v2.2d, v2.2d, v3.2d"), - ([0x81, 0xd4, 0x64, 0x6e], "faddp v1.2d, v4.2d, v4.2d"), - ([0x10, 0xdc, 0x64, 0x6e], "fmul v16.2d, v0.2d, v4.2d"), - ([0x42, 0xdc, 0x64, 0x6e], "fmul v2.2d, v2.2d, v4.2d"), - ([0x83, 0xd4, 0x65, 0x6e], "faddp v3.2d, v4.2d, v5.2d"), - ([0x84, 0xd4, 0x65, 0x6e], "faddp v4.2d, v4.2d, v5.2d"), - ([0x11, 0xdc, 0x65, 0x6e], "fmul v17.2d, v0.2d, v5.2d"), - ([0x63, 0xdc, 0x65, 0x6e], "fmul v3.2d, v3.2d, v5.2d"), - ([0x84, 0xdc, 0x65, 0x6e], "fmul v4.2d, v4.2d, v5.2d"), - ([0xc6, 0xd4, 0x67, 0x6e], "faddp v6.2d, v6.2d, v7.2d"), - ([0x10, 0xde, 0x68, 0x6e], "fmul v16.2d, v16.2d, v8.2d"), - ([0x31, 0xde, 0x68, 0x6e], "fmul v17.2d, v17.2d, v8.2d"), - ([0x52, 0xde, 0x68, 0x6e], "fmul v18.2d, v18.2d, v8.2d"), - ([0x73, 0xde, 0x68, 0x6e], "fmul v19.2d, v19.2d, v8.2d"), - ([0x94, 0xde, 0x68, 0x6e], "fmul v20.2d, v20.2d, v8.2d"), - ([0xb5, 0xde, 0x68, 0x6e], "fmul v21.2d, v21.2d, v8.2d"), - ([0xd6, 0xde, 0x68, 0x6e], "fmul v22.2d, v22.2d, v8.2d"), - ([0xf7, 0xde, 0x68, 0x6e], "fmul v23.2d, v23.2d, v8.2d"), - ([0x44, 0xdc, 0x70, 0x6e], "fmul v4.2d, v2.2d, v16.2d"), - ([0x66, 0xdc, 0x70, 0x6e], "fmul v6.2d, v3.2d, v16.2d"), - ([0x18, 0xde, 0x70, 0x6e], "fmul v24.2d, v16.2d, v16.2d"), - ([0x54, 0xde, 0x70, 0x6e], "fmul v20.2d, v18.2d, v16.2d"), - ([0x66, 0xde, 0x70, 0x6e], "fmul v6.2d, v19.2d, v16.2d"), - ([0x04, 0xd6, 0x71, 0x6e], "faddp v4.2d, v16.2d, v17.2d"), - ([0x10, 0xd6, 0x71, 0x6e], "faddp v16.2d, v16.2d, v17.2d"), - ([0x45, 0xdc, 0x71, 0x6e], "fmul v5.2d, v2.2d, v17.2d"), - ([0x66, 0xdc, 0x71, 0x6e], "fmul v6.2d, v3.2d, v17.2d"), - ([0x39, 0xde, 0x71, 0x6e], "fmul v25.2d, v17.2d, v17.2d"), - ([0x55, 0xde, 0x71, 0x6e], "fmul v21.2d, v18.2d, v17.2d"), - ([0x66, 0xde, 0x71, 0x6e], "fmul v6.2d, v19.2d, v17.2d"), - ([0x18, 0xf6, 0x71, 0x6e], "fmaxp v24.2d, v16.2d, v17.2d"), - ([0x5a, 0xde, 0x72, 0x6e], "fmul v26.2d, v18.2d, v18.2d"), - ([0x45, 0xd6, 0x73, 0x6e], "faddp v5.2d, v18.2d, v19.2d"), - ([0x52, 0xd6, 0x73, 0x6e], "faddp v18.2d, v18.2d, v19.2d"), - ([0x7b, 0xde, 0x73, 0x6e], "fmul v27.2d, v19.2d, v19.2d"), - ([0x59, 0xf6, 0x73, 0x6e], "fmaxp v25.2d, v18.2d, v19.2d"), - ([0x94, 0xd6, 0x75, 0x6e], "faddp v20.2d, v20.2d, v21.2d"), - ([0x9a, 0xf6, 0x75, 0x6e], "fmaxp v26.2d, v20.2d, v21.2d"), - ([0xd6, 0xd6, 0x77, 0x6e], "faddp v22.2d, v22.2d, v23.2d"), - ([0xdb, 0xf6, 0x77, 0x6e], "fmaxp v27.2d, v22.2d, v23.2d"), - ([0x18, 0xf7, 0x78, 0x6e], "fmaxp v24.2d, v24.2d, v24.2d"), - ([0x18, 0xd7, 0x79, 0x6e], "faddp v24.2d, v24.2d, v25.2d"), - ([0x18, 0xf7, 0x79, 0x6e], "fmaxp v24.2d, v24.2d, v25.2d"), - ([0x18, 0xf7, 0x7a, 0x6e], "fmaxp v24.2d, v24.2d, v26.2d"), - ([0x5a, 0xf7, 0x7b, 0x6e], "fmaxp v26.2d, v26.2d, v27.2d"), - ([0x00, 0xd8, 0x30, 0x7e], "faddp s0, v0.2s"), - ([0x21, 0xd8, 0x30, 0x7e], "faddp s1, v1.2s"), - ([0x29, 0xd9, 0x30, 0x7e], "faddp s9, v9.2s"), - ([0x4a, 0xd9, 0x30, 0x7e], "faddp s10, v10.2s"), - ([0x00, 0xd8, 0x70, 0x7e], "faddp d0, v0.2d"), - ([0x21, 0xd8, 0x70, 0x7e], "faddp d1, v1.2d"), - ([0x29, 0xd9, 0x70, 0x7e], "faddp d9, v9.2d"), - ([0x4a, 0xd9, 0x70, 0x7e], "faddp d10, v10.2d"), - ([0x18, 0xdb, 0x70, 0x7e], "faddp d24, v24.2d"), - ([0x00, 0xf8, 0x70, 0x7e], "fmaxp d0, v0.2d"), - ([0x41, 0xf8, 0x70, 0x7e], "fmaxp d1, v2.2d"), - ([0x20, 0xd4, 0xa0, 0x7e], "fabd s0, s1, s0"), - ([0x21, 0xd4, 0xa0, 0x7e], "fabd s1, s1, s0"), - ([0xd6, 0xd6, 0xf9, 0x7e], "fabd d22, d22, d25"), - ([0x21, 0xd4, 0xfa, 0x7e], "fabd d1, d1, d26"), - ([0x06, 0x00, 0x66, 0x9e], "fmov x6, d0"), - ([0x11, 0x00, 0x66, 0x9e], "fmov x17, d0"), - ([0x4b, 0x02, 0x67, 0x9e], "fmov d11, x18"), - ([0xfc, 0x03, 0x67, 0x9e], "fmov d28, xzr"), - ([0x06, 0x01, 0x78, 0x9e], "fcvtzs x6, d8"), - ([0x42, 0xdc, 0x20, 0x2e], "fmul v2.2s, v2.2s, v0.2s"), - ([0x44, 0xdc, 0x20, 0x2e], "fmul v4.2s, v2.2s, v0.2s"), - ([0x42, 0xdc, 0x21, 0x2e], "fmul v2.2s, v2.2s, v1.2s"), - ([0x02, 0xdc, 0x22, 0x2e], "fmul v2.2s, v0.2s, v2.2s"), - ([0x04, 0xdc, 0x22, 0x2e], "fmul v4.2s, v0.2s, v2.2s"), - ([0x05, 0xdc, 0x23, 0x2e], "fmul v5.2s, v0.2s, v3.2s"), - ([0x81, 0xd4, 0x24, 0x2e], "faddp v1.2s, v4.2s, v4.2s"), - ([0x00, 0xd4, 0x20, 0x6e], "faddp v0.4s, v0.4s, v0.4s"), - ([0x21, 0xdc, 0x20, 0x6e], "fmul v1.4s, v1.4s, v0.4s"), - ([0x42, 0xdc, 0x20, 0x6e], "fmul v2.4s, v2.4s, v0.4s"), - ([0x21, 0xd4, 0x21, 0x6e], "faddp v1.4s, v1.4s, v1.4s"), - ([0x04, 0xdc, 0x22, 0x6e], "fmul v4.4s, v0.4s, v2.4s"), - ([0x06, 0xdc, 0x22, 0x6e], "fmul v6.4s, v0.4s, v2.4s"), - ([0x42, 0xd4, 0x23, 0x6e], "faddp v2.4s, v2.4s, v3.4s"), - ([0x05, 0xdc, 0x23, 0x6e], "fmul v5.4s, v0.4s, v3.4s"), - ([0x07, 0xdc, 0x23, 0x6e], "fmul v7.4s, v0.4s, v3.4s"), - ([0x10, 0xdc, 0x24, 0x6e], "fmul v16.4s, v0.4s, v4.4s"), - ([0x83, 0xd4, 0x25, 0x6e], "faddp v3.4s, v4.4s, v5.4s"), - ([0x84, 0xd4, 0x25, 0x6e], "faddp v4.4s, v4.4s, v5.4s"), - ([0x11, 0xdc, 0x25, 0x6e], "fmul v17.4s, v0.4s, v5.4s"), - ([0xc6, 0xd4, 0x27, 0x6e], "faddp v6.4s, v6.4s, v7.4s"), - ([0x44, 0xdc, 0x30, 0x6e], "fmul v4.4s, v2.4s, v16.4s"), - ([0x66, 0xdc, 0x30, 0x6e], "fmul v6.4s, v3.4s, v16.4s"), - ([0x00, 0xf8, 0x30, 0x6e], "fmaxv s0, v0.4s"), - ([0x21, 0xf8, 0x30, 0x6e], "fmaxv s1, v1.4s"), - ([0x41, 0xf8, 0x30, 0x6e], "fmaxv s1, v2.4s"), - ([0x10, 0xd6, 0x31, 0x6e], "faddp v16.4s, v16.4s, v17.4s"), - ([0x45, 0xdc, 0x31, 0x6e], "fmul v5.4s, v2.4s, v17.4s"), - ([0x66, 0xdc, 0x31, 0x6e], "fmul v6.4s, v3.4s, v17.4s"), - ([0x52, 0xd6, 0x33, 0x6e], "faddp v18.4s, v18.4s, v19.4s"), - ([0x94, 0xd6, 0x35, 0x6e], "faddp v20.4s, v20.4s, v21.4s"), - ([0xd6, 0xd6, 0x37, 0x6e], "faddp v22.4s, v22.4s, v23.4s"), - ([0x18, 0xd7, 0x39, 0x6e], "faddp v24.4s, v24.4s, v25.4s"), - ([0xc7, 0x20, 0x06, 0x2e], "ext v7.8b, v6.8b, v6.8b, #0x4"), - ([0x27, 0x1c, 0x20, 0x2e], "eor v7.8b, v1.8b, v0.8b"), - ([0x22, 0x1c, 0x22, 0x2e], "eor v2.8b, v1.8b, v2.8b"), - ([0x42, 0x1c, 0x32, 0x2e], "eor v2.8b, v2.8b, v18.8b"), - ([0xc2, 0x1c, 0x70, 0x2e], "bsl v2.8b, v6.8b, v16.8b"), - ([0xd2, 0x1d, 0xa1, 0x2e], "bit v18.8b, v14.8b, v1.8b"), - ([0x01, 0x1c, 0xa6, 0x2e], "bit v1.8b, v0.8b, v6.8b"), - ([0xa6, 0x1c, 0xe0, 0x2e], "bif v6.8b, v5.8b, v0.8b"), - ([0x15, 0x1e, 0xf7, 0x2e], "bif v21.8b, v16.8b, v23.8b"), - ([0x08, 0x85, 0xa0, 0x0e], "add v8.2s, v8.2s, v0.2s"), - ([0x21, 0x1c, 0x21, 0x6e], "eor v1.16b, v1.16b, v1.16b"), - ([0x42, 0x1c, 0x22, 0x6e], "eor v2.16b, v2.16b, v2.16b"), - ([0x84, 0x1c, 0x24, 0x6e], "eor v4.16b, v4.16b, v4.16b"), - ([0x10, 0x1e, 0x30, 0x6e], "eor v16.16b, v16.16b, v16.16b"), - ([0x31, 0x1e, 0x31, 0x6e], "eor v17.16b, v17.16b, v17.16b"), - ([0x73, 0x1e, 0x33, 0x6e], "eor v19.16b, v19.16b, v19.16b"), - ([0xb5, 0x1e, 0x35, 0x6e], "eor v21.16b, v21.16b, v21.16b"), - ([0xf7, 0x1e, 0x37, 0x6e], "eor v23.16b, v23.16b, v23.16b"), - ([0x39, 0x1f, 0x39, 0x6e], "eor v25.16b, v25.16b, v25.16b"), - ([0x7b, 0x1f, 0x3b, 0x6e], "eor v27.16b, v27.16b, v27.16b"), - ([0xbd, 0x1f, 0x3d, 0x6e], "eor v29.16b, v29.16b, v29.16b"), - ([0xff, 0x1f, 0x3f, 0x6e], "eor v31.16b, v31.16b, v31.16b"), - ([0xa5, 0x40, 0x05, 0x6e], "ext v5.16b, v5.16b, v5.16b, #0x8"), - ([0xc7, 0x40, 0x06, 0x6e], "ext v7.16b, v6.16b, v6.16b, #0x8"), - ([0x02, 0x1d, 0x21, 0x0e], "and v2.8b, v8.8b, v1.8b"), - ([0x21, 0x1c, 0x22, 0x0e], "and v1.8b, v1.8b, v2.8b"), - ([0x21, 0x1c, 0x32, 0x0e], "and v1.8b, v1.8b, v18.8b"), - ([0x08, 0x54, 0x22, 0x0f], "shl v8.2s, v0.2s, #0x2"), - ([0xfe, 0x43, 0x60, 0x1e], "fmov d30, d31"), - ([0x54, 0xc2, 0x20, 0x1e], "fabs s20, s18"), - ([0xf7, 0xc3, 0x60, 0x1e], "fabs d23, d31"), - ([0x23, 0x40, 0x21, 0x1e], "fneg s3, s1"), - ([0x06, 0x40, 0x61, 0x1e], "fneg d6, d0"), - ([0x00, 0xc0, 0x61, 0x1e], "fsqrt d0, d0"), - ([0x02, 0xc2, 0x61, 0x1e], "fsqrt d2, d16"), - ([0x08, 0x90, 0x26, 0x1e], "fmov s8, #20.0"), - ([0x00, 0x10, 0x2e, 0x1e], "fmov s0, #1.0"), - ([0x08, 0x90, 0x3b, 0x1e], "fmov s8, #-0.4375"), - ([0x01, 0x10, 0x3c, 0x1e], "fmov s1, #-0.5"), - ([0x00, 0x10, 0x3e, 0x1e], "fmov s0, #-1.0"), - ([0x13, 0x10, 0x3e, 0x1e], "fmov s19, #-1.0"), - ([0x14, 0x10, 0x60, 0x1e], "fmov d20, #2.0"), - ([0x18, 0x10, 0x61, 0x1e], "fmov d24, #3.0"), - ([0x13, 0x10, 0x7e, 0x1e], "fmov d19, #-1.0"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_simd_movs() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x55, 0x04, 0x04, 0x4e], "mov v21.4s, v2.s[0]"), - ([0x38, 0x07, 0x08, 0x4e], "mov v24.2d, v25.d[0]"), - ([0x64, 0x64, 0x04, 0x6e], "mov v4.s[0], v3.s[3]"), - ([0x67, 0x64, 0x04, 0x6e], "mov v7.s[0], v3.s[3]"), - ([0x4b, 0x64, 0x14, 0x6e], "mov v11.s[2], v2.s[3]"), - ([0x00, 0x04, 0x18, 0x6e], "mov v0.d[1], v0.d[0]"), - ([0x21, 0x04, 0x18, 0x6e], "mov v1.d[1], v1.d[0]"), - ([0x40, 0x04, 0x18, 0x6e], "mov v0.d[1], v2.d[0]"), - ([0x41, 0x04, 0x18, 0x6e], "mov v1.d[1], v2.d[0]"), - ([0x42, 0x04, 0x18, 0x6e], "mov v2.d[1], v2.d[0]"), - ([0x48, 0x04, 0x18, 0x6e], "mov v8.d[1], v2.d[0]"), - ([0x50, 0x04, 0x18, 0x6e], "mov v16.d[1], v2.d[0]"), - ([0x63, 0x04, 0x18, 0x6e], "mov v3.d[1], v3.d[0]"), - ([0x6b, 0x44, 0x18, 0x6e], "mov v11.d[1], v3.d[1]"), - ([0xff, 0x45, 0x18, 0x6e], "mov v31.d[1], v15.d[1]"), - ([0x5a, 0x46, 0x18, 0x6e], "mov v26.d[1], v18.d[1]"), - ([0x00, 0x04, 0x1c, 0x6e], "mov v0.s[3], v0.s[0]"), - ([0x21, 0x04, 0x1c, 0x6e], "mov v1.s[3], v1.s[0]"), - ([0x68, 0x04, 0x1c, 0x6e], "mov v8.s[3], v3.s[0]"), - ([0x69, 0x24, 0x1c, 0x6e], "mov v9.s[3], v3.s[1]"), - ([0x6a, 0x44, 0x1c, 0x6e], "mov v10.s[3], v3.s[2]"), - ([0x6b, 0x64, 0x1c, 0x6e], "mov v11.s[3], v3.s[3]"), - ([0x43, 0x1c, 0xa2, 0x4e], "mov v3.16b, v2.16b"), - ([0x1c, 0x04, 0x00, 0x0f], "movi v28.2s, #0x0"), - ([0x28, 0x04, 0x00, 0x0f], "movi v8.2s, #0x1"), - ([0x80, 0x66, 0x01, 0x0f], "movi v0.2s, #0x34, lsl #24"), - ([0x17, 0x64, 0x04, 0x0f], "movi v23.2s, #0x80, lsl #24"), - ([0x01, 0xe4, 0x00, 0x6f], "movi v1.2d, #0x0"), - ([0x02, 0xe4, 0x00, 0x6f], "movi v2.2d, #0x0"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_openblas_misc_ops() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x1f, 0x20, 0x03, 0xd5], "esb"), // executes as nop, but also a barrier - ([0xbf, 0x3a, 0x03, 0xd5], "dmb ishst"), - ([0xbf, 0x3b, 0x03, 0xd5], "dmb ish"), - ([0xdf, 0x3f, 0x03, 0xd5], "isb"), - ([0x01, 0x00, 0x38, 0xd5], "mrs x1, midr_el1"), - ([0x54, 0xd0, 0x3b, 0xd5], "mrs x20, tpidr_el0"), - ([0x41, 0xe0, 0x3b, 0xd5], "mrs x1, cntvct_el0"), - ([0x55, 0xe0, 0x3b, 0xd5], "mrs x21, cntvct_el0"), - ([0xe2, 0x69, 0xb6, 0xf8], "prfm pldl2keep, [x15, x22]"), - ([0x00, 0x6a, 0xb7, 0xf8], "prfm pldl1keep, [x16, x23]"), - ([0x80, 0x00, 0x80, 0xf9], "prfm pldl1keep, [x4]"), - ([0x81, 0x00, 0x80, 0xf9], "prfm pldl1strm, [x4]"), - ([0x00, 0x02, 0x80, 0xf9], "prfm pldl1keep, [x16]"), - ([0x21, 0x20, 0x80, 0xf9], "prfm pldl1strm, [x1, #0x40]"), - ([0x00, 0x22, 0x80, 0xf9], "prfm pldl1keep, [x16, #0x40]"), - ([0x61, 0x30, 0x80, 0xf9], "prfm pldl1strm, [x3, #0x60]"), - ([0xa2, 0x51, 0x80, 0xf9], "prfm pldl2keep, [x13, #0xa0]"), - ([0xc2, 0x51, 0x80, 0xf9], "prfm pldl2keep, [x14, #0xa0]"), - ([0xe2, 0x51, 0x80, 0xf9], "prfm pldl2keep, [x15, #0xa0]"), - ([0xa1, 0x00, 0x82, 0xf9], "prfm pldl1strm, [x5, #0x400]"), - ([0x00, 0x82, 0x87, 0xf9], "prfm pldl1keep, [x16, #0xf00]"), - ]; - - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_fmul() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x92, 0x8a, 0x5f], "fmul s0, s16, v10.s[0]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_fmov_general() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x4b, 0x02, 0x67, 0x9e], "fmov d11, x18"), - ([0xfc, 0x03, 0x67, 0x9e], "fmov d28, xzr"), - ([0x06, 0x00, 0x66, 0x9e], "fmov x6, d0"), - ([0x11, 0x00, 0x66, 0x9e], "fmov x17, d0"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_cvt_general() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0xd8, 0x21, 0x5e], "scvtf s0, s0"), - ([0x82, 0xd8, 0x61, 0x5e], "scvtf d2, d4"), - ([0x42, 0x78, 0x61, 0x0e], "fcvtl v2.2d, v2.2s"), - ([0x63, 0x78, 0x61, 0x0e], "fcvtl v3.2d, v3.2s"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_fabd_general() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x20, 0xd4, 0xa0, 0x7e], "fabd s0, s1, s0"), - ([0x21, 0xd4, 0xa0, 0x7e], "fabd s1, s1, s0"), - ([0xd6, 0xd6, 0xf9, 0x7e], "fabd d22, d22, d25"), - ([0x21, 0xd4, 0xfa, 0x7e], "fabd d1, d1, d26"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_ext() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0xa5, 0x40, 0x05, 0x6e], "ext v5.16b, v5.16b, v5.16b, #0x8"), - ([0xc7, 0x40, 0x06, 0x6e], "ext v7.16b, v6.16b, v6.16b, #0x8"), - ([0xc7, 0x20, 0x06, 0x2e], "ext v7.8b, v6.8b, v6.8b, #0x4"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_indexed() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x10, 0x11, 0x80, 0x0f], "fmla v16.2s, v8.2s, v0.s[0]"), - ([0x39, 0x58, 0x88, 0x0f], "fmls v25.2s, v1.2s, v8.s[2]"), - ([0x08, 0x92, 0x8a, 0x0f], "fmul v8.2s, v16.2s, v10.s[0]"), - ([0x01, 0x12, 0x8b, 0x0f], "fmla v1.2s, v16.2s, v11.s[0]"), - ([0x8c, 0x12, 0x8e, 0x0f], "fmla v12.2s, v20.2s, v14.s[0]"), - ([0xc6, 0x12, 0x8e, 0x0f], "fmla v6.2s, v22.2s, v14.s[0]"), - ([0x3c, 0x58, 0xa9, 0x0f], "fmls v28.2s, v1.2s, v9.s[3]"), - ([0x00, 0x00, 0x50, 0x2f], "mla v0.4h, v0.4h, v0.h[1]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_simd_abs() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0xf8, 0xa0, 0x0e], "fabs v0.2s, v0.2s"), - ([0x21, 0xf8, 0xa0, 0x4e], "fabs v1.4s, v1.4s"), - ([0xf7, 0xc3, 0x60, 0x1e], "fabs d23, d31"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_movi() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x1c, 0x04, 0x00, 0x0f], "movi v28.2s, #0x0"), - ([0x28, 0x04, 0x00, 0x0f], "movi v8.2s, #0x1"), - ([0x80, 0x66, 0x01, 0x0f], "movi v0.2s, #0x34, lsl #24"), - ([0x17, 0x64, 0x04, 0x0f], "movi v23.2s, #0x80, lsl #24"), - ([0x01, 0xe4, 0x00, 0x6f], "movi v1.2d, #0x0"), - ([0x02, 0xe4, 0x00, 0x6f], "movi v2.2d, #0x0"), - ([0x03, 0xe4, 0x00, 0x2f], "movi d3, #0x0"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_weird_str() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x08, 0xdb, 0x7c, 0xf8], "ldr x8, [x24, w28, sxtw #3]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_mismatches() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x00, 0x00, 0x08], "stxrb w0, w0, [x0]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_cas() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x20, 0x7c, 0x20, 0x08], "casp w0, w1, w0, w1, [x1]"), - ([0x01, 0x7c, 0xa0, 0x08], "casb w0, w1, [x0]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_stll() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x7c, 0x9f, 0x08], "stllrb w0, [x0]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_ldst_structure() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0xe0, 0x40, 0x0d], "ld3r {v0.8b, v1.8b, v2.8b}, [x0]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_tbl() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x00, 0x00, 0x0e], "tbl v0.8b, {v0.16b}, v0.8b"), - ([0x20, 0x00, 0x00, 0x0e], "tbl v0.8b, {v1.16b}, v0.8b"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_saddw() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x10, 0x20, 0x0e], "saddw v0.8h, v0.8h, v0.8b"), - ([0x00, 0x60, 0x20, 0x0e], "subhn v0.8b, v0.8h, v0.8h"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_vector_cmge() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x98, 0x20, 0x0e], "cmeq v0.8b, v0.8b, #0x0"), - ([0x00, 0xc8, 0xa0, 0x0e], "fcmgt v0.2s, v0.2s, #0.0"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_xtn() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x28, 0x21, 0x0e], "xtn v0.8b, v0.8h"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_saddlv() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x38, 0x30, 0x0e], "saddlv h0, v0.8b"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_simd_same_three_fp16() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x04, 0x40, 0x0e], "fmaxnm v0.4h, v0.4h, v0.4h"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_simd_two_register_misc_fp16() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x88, 0x79, 0x0e], "frintn v0.4h, v0.4h"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_simd_three_same_extra() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x94, 0x90, 0x0e], "sdot v0.2s, v0.8b, v16.8b"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_rev64() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x08, 0xa0, 0x0e], "rev64 v0.2s, v0.2s"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_adds_aliases() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x1f, 0x00, 0x20, 0x2b], "cmn w0, w0, uxtb"), - ([0x1f, 0x00, 0x40, 0x2b], "cmn w0, w0, lsr"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_mov_aliases() { - const TESTS: &[([u8; 4], &'static str)] = &[ - // does not alias when lsl #12 - ([0x00, 0x00, 0x40, 0x11], "add w0, w0, #0x0, lsl #12"), - // shift makes this not alias mov - ([0xe0, 0x07, 0x00, 0x2a], "orr w0, wzr, w0, lsl #1"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_sbfm_aliases() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x7c, 0x00, 0x13], "asr w0, w0, #0x0"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_extr_aliases() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x40, 0x80, 0x13], "ror w0, w0, #0x10"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_armv8_3() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x00, 0x7e, 0x1e], "fjcvtzs w0, d0"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_armv8_4() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x00, 0x00, 0x19], "stlurb w0, [x0]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_crc() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x44, 0xc0, 0x1a], "crc32h w0, w0, w0"), - ([0x00, 0x50, 0xc0, 0x1a], "crc32cb w0, w0, w0"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_stnp() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x80, 0x00, 0x28], "stnp w0, w0, [x0, #0x4]"), - ([0x00, 0x80, 0x00, 0x2c], "stnp s0, s0, [x0, #0x4]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_preindex() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x00, 0x80, 0x2d], "stp s0, s0, [x0, #0x0]!"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_postindex() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x20, 0x80, 0x81, 0x28], "stp w0, w0, [x1], #0xc"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_not_vec() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x58, 0x20, 0x2e], "mvn v0.8b, v0.8b"), // `not` instruction, aliased to mvn always - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_fcmla() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0xe4, 0x40, 0x2e], "fcadd v0.4h, v0.4h, v0.4h, #0x5a"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_vec_shift() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0xa4, 0x08, 0x0f], "sshll v0.8h, v0.8b, #0x0"), - ([0x00, 0xa4, 0x08, 0x2f], "ushll v0.8h, v0.8b, #0x0"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_pac() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x04, 0xc1, 0xda], "pacib x0, x0"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_uq() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x38, 0xe0, 0x4e], "suqadd v0.2d, v0.2d"), - ([0x00, 0x88, 0xe0, 0x4e], "cmgt v0.2d, v0.2d, #0x0"), - ([0x00, 0xb8, 0xe0, 0x4e], "abs v0.2d, v0.2d"), - ([0x00, 0xfc, 0x20, 0x5e], "frecps s0, s0, s0"), - ([0x00, 0xc8, 0xb0, 0x5e], "fminnmp h0, v0.2h"), - ([0x00, 0x74, 0x08, 0x5f], "sqshl b0, b0, #0x0"), - ([0x00, 0x94, 0x08, 0x5f], "sqshrn b0, h0, #0x8"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_cfi() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x1f, 0x08, 0x1f, 0xd6], "braaz x0"), - ([0x3f, 0x08, 0x1f, 0xd6], "braaz x1"), - ([0x00, 0x08, 0x1f, 0xd7], "braa x0, x0"), - ([0x00, 0x08, 0x3f, 0xd7], "blraa x0, x0"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_sha() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x00, 0x00, 0x5e], "sha1c q0, s0, v0.4s"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} - -#[test] -fn test_misc() { - const TESTS: &[([u8; 4], &'static str)] = &[ - ([0x00, 0x98, 0x00, 0x2f], "fmulx v0.4h, v0.4h, v0.h[4]"), - ([0x00, 0xc4, 0x00, 0x2f], "mvni v0.2s, #0x0, msl #8"), - ([0x00, 0xd4, 0x00, 0x2f], "mvni v0.2s, #0x0, msl #16"), - ([0x00, 0xe0, 0x80, 0x2f], "udot v0.2s, v0.8b, v0.4b[0]"), - ([0x00, 0x03, 0x00, 0x32], "orr w0, w24, #0x1"), - ([0x00, 0x00, 0x00, 0x33], "bfxil w0, w0, #0x0, #0x1"), -// ([0xe0, 0x03, 0x00, 0x33], "bfc w0, #0x0, #0x1"), - ([0x00, 0x00, 0x01, 0x33], "bfi w0, w0, #0x1f, #0x1"), - ([0x00, 0x08, 0x00, 0x38], "sttrb w0, [x0]"), - ([0x1f, 0x00, 0x20, 0x38], "staddb w0, [x0]"), - ([0x00, 0x58, 0x20, 0x38], "strb w0, [x0, w0, uxtw]"), - ([0x00, 0xc0, 0xbf, 0x38], "ldaprb w0, [x0]"), - ([0x0d, 0x08, 0x00, 0x3a], "setf8 w0"), - ([0x00, 0x58, 0xbf, 0x3c], "str q0, [x0, wzr, uxtw #4]"), - ([0x00, 0x04, 0x01, 0x4e], "mov v0.16b, v0.b[0]"), // "The alias is always the preferred disassembly." - ([0x00, 0x38, 0x20, 0x4e], "suqadd v0.16b, v0.16b"), - ([0x00, 0x88, 0x20, 0x4e], "cmgt v0.16b, v0.16b, #0x0"), - ([0x00, 0xb8, 0x20, 0x4e], "abs v0.16b, v0.16b"), - ([0x00, 0xe0, 0x20, 0x4e], "pmull2 v0.8h, v0.16b, v0.16b"), - ([0x00, 0x28, 0x21, 0x4e], "xtn2 v0.16b, v0.8h"), - ([0x00, 0x48, 0x28, 0x4e], "aese v0.16b, v0.16b"), - ([0x00, 0x84, 0x08, 0x4f], "shrn2 v0.16b, v0.8h, #0x8"), - ([0x00, 0x8c, 0x08, 0x4f], "rshrn2 v0.16b, v0.8h, #0x8"), - ([0x00, 0x94, 0x08, 0x4f], "sqshrn2 v0.16b, v0.8h, #0x8"), - ([0x00, 0x28, 0x40, 0x4f], "smlal2 v0.4s, v0.8h, v0.h[4]"), - ([0x00, 0xc0, 0x40, 0x4f], "sqdmulh v0.8h, v0.8h, v0.h[0]"), - ([0x00, 0xe0, 0x80, 0x4f], "sdot v0.4s, v0.16b, v0.4b[0]"), - ([0x00, 0x24, 0x40, 0x5e], "fcmeq h0, h0, h0"), - ([0x00, 0x88, 0xe0, 0x5e], "cmgt d0, d0, #0x0"), - ([0x00, 0xa8, 0xf9, 0x5e], "fcvtps h0, h0"), - ([0x00, 0x10, 0x10, 0x5f], "fmla h0, h0, v0.h[1]"), - ([0x00, 0xd0, 0x40, 0x5f], "sqrdmulh h0, h0, v0.h[0]"), - ([0x00, 0x10, 0xd0, 0x5f], "fmla d0, d0, v16.d[0]"), - ([0x1f, 0x00, 0x20, 0x6b], "cmp w0, w0, uxtb"), - ([0x00, 0x78, 0x20, 0x6e], "sqneg v0.16b, v0.16b"), - ([0x00, 0xb8, 0x20, 0x6e], "neg v0.16b, v0.16b"), - ([0x00, 0x28, 0x21, 0x6e], "sqxtun2 v0.16b, v0.8h"), - ([0x1f, 0x00, 0x00, 0x72], "tst w0, #0x1"), - ([0x00, 0x84, 0x40, 0x7e], "sqrdmlah h0, h0, h0"), - ([0x1f, 0x00, 0x20, 0x8b], "add sp, x0, w0, uxtb"), -// ([0x00, 0x00, 0x00, 0x00], "add x0, x0, #0x0"), - ([0x1f, 0x00, 0x00, 0x91], "mov sp, x0"), - ([0x1f, 0x00, 0x00, 0x92], "and sp, x0, #0x100000001"), - ([0x00, 0x4c, 0xc0, 0x9a], "crc32x w0, w0, x0"), - ([0x00, 0x00, 0x40, 0x9b], "smulh x0, x0, x0"), - ([0x00, 0x08, 0x40, 0xce], "sm3ss1 v0.4s, v0.4s, v0.4s, v2.4s"), -// ([0x00, 0x1c, 0x40, 0xd3], "ubfx x0, x0, #0x0, #0x8"), - ([0x00, 0x08, 0x00, 0xf8], "sttr x0, [x0]"), - ([0x00, 0x14, 0x20, 0xf8], "ldraa x0, [x0, #0x8]"), - ([0x00, 0x00, 0x80, 0xf8], "prfum pldl1keep, [x0]"), - ([0x06, 0x48, 0xa0, 0xf8], "prfm 0x6, [x0, w0, uxtw]"), - ([0xe0, 0x03, 0x00, 0x0b], "add w0, wzr, w0"), - ([0x00, 0xc0, 0x40, 0x0f], "sqdmulh v0.4h, v0.4h, v0.h[0]"), - ([0x00, 0xd0, 0x40, 0x0f], "sqrdmulh v0.4h, v0.4h, v0.h[0]"), - ([0x00, 0xc0, 0x40, 0x5f], "sqdmulh h0, h0, v0.h[0]"), - ([0x00, 0x10, 0x40, 0x6f], "fcmla v0.8h, v0.8h, v0.h[0], #0x0"), - ([0x00, 0x10, 0x80, 0x6f], "fcmla v0.4s, v0.4s, v0.s[0], #0x0"), - ([0x00, 0x14, 0xc0, 0x7e], "fabd h0, h0, h0"), - ([0x00, 0x24, 0xc0, 0x7e], "fcmgt h0, h0, h0"), - ([0x00, 0xd0, 0x40, 0x7f], "sqrdmlah h0, h0, v0.h[0]"), - ([0x00, 0x7c, 0xa0, 0x88], "cas w0, w0, [x0]"), - ([0x00, 0x30, 0xc0, 0x9a], "pacga x0, x0, x0"), - ([0x00, 0x00, 0xae, 0x9e], "fmov x0, v0.d[1]"), - ([0x00, 0x00, 0xe6, 0x9e], "fmov x0, h0"), - ([0x7f, 0x41, 0x00, 0xd5], "msr pstate.0x58, #0x1"), - ([0x00, 0x68, 0x20, 0x38], "strb w0, [x0, x0]"), - ]; - let errs = run_tests(TESTS); - - for err in errs.iter() { - println!("{}", err); - } - - assert!(errs.is_empty()); -} diff --git a/test/armv8/mod.rs b/test/armv8/mod.rs deleted file mode 100644 index f7274b6..0000000 --- a/test/armv8/mod.rs +++ /dev/null @@ -1 +0,0 @@ -mod a64; diff --git a/test/test.rs b/test/test.rs deleted file mode 100644 index eb9050e..0000000 --- a/test/test.rs +++ /dev/null @@ -1,52 +0,0 @@ -// #![feature(test)] -// -// extern crate test; - -extern crate yaxpeax_arch; -extern crate yaxpeax_arm; - -mod armv7; -mod armv8; - -use yaxpeax_arch::{Arch, Decoder, U8Reader}; - -#[test] -fn test_armv7_does_not_panic() { - let armv7 = ::Decoder::default(); - - for i in 0..=u32::MAX { - let bytes = i.to_le_bytes(); - let res = armv7.decode(&mut U8Reader::new(&bytes)); - if let Ok(instr) = res { - let s = instr.to_string(); - drop(s); - } - } -} -#[test] -fn test_armv7_thumb_does_not_panic() { - let mut armv7_t = ::Decoder::default(); - armv7_t.set_thumb_mode(true); - - for i in 0..=u32::MAX { - let bytes = i.to_le_bytes(); - let res = armv7_t.decode(&mut U8Reader::new(&bytes)); - if let Ok(instr) = res { - let s = instr.to_string(); - drop(s); - } - } -} -#[test] -fn test_armv8_does_not_panic() { - let armv8 = ::Decoder::default(); - - for i in 0..=u32::MAX { - let bytes = i.to_le_bytes(); - let res = armv8.decode(&mut U8Reader::new(&bytes)); - if let Ok(instr) = res { - let s = instr.to_string(); - drop(s); - } - } -} -- cgit v1.1