1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-30 04:50:08 +00:00

Resolve rep vs repe.

63 failures.
This commit is contained in:
Thomas Harte 2023-09-26 17:36:22 -04:00
parent 5368f789f6
commit 2cc60563e0

View File

@ -175,16 +175,21 @@ std::string to_string(InstructionSet::x86::DataPointer pointer, const Instructio
- (NSString *)toString:(const InstructionSet::x86::Instruction<false> &)instruction offsetLength:(int)offsetLength { - (NSString *)toString:(const InstructionSet::x86::Instruction<false> &)instruction offsetLength:(int)offsetLength {
// Form string version, compare. // Form string version, compare.
std::string operation; std::string operation;
using Operation = InstructionSet::x86::Operation;
// TODO: this was a bit of a guess at the logic behind rep versus repe but doesn't seem to fit;
// check more thoroughly.
using Repetition = InstructionSet::x86::Repetition; using Repetition = InstructionSet::x86::Repetition;
switch(instruction.repetition()) { switch(instruction.repetition()) {
case Repetition::None: break; case Repetition::None: break;
case Repetition::RepE: case Repetition::RepE:
operation += switch(instruction.operation) {
InstructionSet::x86::supports(instruction.operation, Repetition::RepNE) default: operation += "repe "; break;
? "repe " : "rep ";
case Operation::MOVS:
case Operation::STOS:
case Operation::LODS:
operation += "rep ";
break;
}
break; break;
case Repetition::RepNE: operation += "repne "; break; case Repetition::RepNE: operation += "repne "; break;
} }
@ -192,7 +197,6 @@ std::string to_string(InstructionSet::x86::DataPointer pointer, const Instructio
operation += to_string(instruction.operation, instruction.operation_size()); operation += to_string(instruction.operation, instruction.operation_size());
// Deal with a few special cases up front. // Deal with a few special cases up front.
using Operation = InstructionSet::x86::Operation;
switch(instruction.operation) { switch(instruction.operation) {
default: { default: {
const int operands = num_operands(instruction.operation); const int operands = num_operands(instruction.operation);