1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-07 23:29:06 +00:00

Add a formal SIB test.

This commit is contained in:
Thomas Harte 2022-03-08 14:56:27 -05:00
parent a954f23642
commit 0cbb481fa4

View File

@ -330,4 +330,16 @@ std::vector<typename InstructionSet::x86::Decoder<model>::InstructionT> decode(c
run_test(true, DataSize::DWord);
}
- (void)testSIB {
const auto instructions = decode<Model::i80386>({
// add edx, -0x7d(ebp + eax*2)
0x01, 0x54, 0x45, 0x83
}, true);
XCTAssertEqual(instructions.size(), 1);
test(instructions[0], DataSize::DWord, Operation::ADD, Source::eDX, ScaleIndexBase(1, Source::eAX, Source::eBP), 0x00, -125);
// Noting that a multiplier of 2 is a scale of 1,
// since the scale is in log2.
}
@end