mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-25 16:31:42 +00:00
Test as far as mffs.
This commit is contained in:
parent
7f6a955a71
commit
c581aef11d
@ -99,7 +99,7 @@ enum class Operation: uint8_t {
|
|||||||
|
|
||||||
/// Load string and compare byte indexed.
|
/// Load string and compare byte indexed.
|
||||||
/// lscbx lsxbx.
|
/// lscbx lsxbx.
|
||||||
/// rD(), rA(), rB()
|
/// rD(), rA(), rB() [rc()]
|
||||||
lscbxx,
|
lscbxx,
|
||||||
|
|
||||||
/// Mask generate.
|
/// Mask generate.
|
||||||
@ -454,7 +454,15 @@ enum class Operation: uint8_t {
|
|||||||
frspx,
|
frspx,
|
||||||
|
|
||||||
fsubx, fsubsx,
|
fsubx, fsubsx,
|
||||||
icbi, isync,
|
|
||||||
|
/// Instruction cache block invalidate.
|
||||||
|
/// icbi
|
||||||
|
/// rA(), rB()
|
||||||
|
icbi,
|
||||||
|
|
||||||
|
/// Instruction synchronise.
|
||||||
|
/// isync
|
||||||
|
isync,
|
||||||
|
|
||||||
/// Load byte and zero.
|
/// Load byte and zero.
|
||||||
/// lbz
|
/// lbz
|
||||||
@ -1114,7 +1122,12 @@ struct Instruction {
|
|||||||
uint32_t fm() const { return (opcode >> 17) & 0xff; }
|
uint32_t fm() const { return (opcode >> 17) & 0xff; }
|
||||||
|
|
||||||
/// Specifies the number of bytes to move in an immediate string load or store.
|
/// Specifies the number of bytes to move in an immediate string load or store.
|
||||||
uint32_t nb() const { return (opcode >> 11) & 0x1f; }
|
uint32_t nb() const {
|
||||||
|
// Map nb == 0 to 32, branchlessly, given that this is
|
||||||
|
// a five-bit field.
|
||||||
|
const uint32_t nb = (opcode >> 11) & 0x1f;
|
||||||
|
return ((nb - 1) & 31) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
/// Specifies a shift amount.
|
/// Specifies a shift amount.
|
||||||
uint32_t sh() const { return (opcode >> 11) & 0x1f; }
|
uint32_t sh() const { return (opcode >> 11) & 0x1f; }
|
||||||
|
@ -310,6 +310,31 @@ NSString *offset(Instruction instruction) {
|
|||||||
XCTAssertEqual([columns[4] intValue], instruction.imm());
|
XCTAssertEqual([columns[4] intValue], instruction.imm());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Operation::mcrxr:
|
||||||
|
AssertEqualOperationName(operation, @"mcrxr");
|
||||||
|
XCTAssertEqualObjects(columns[3], conditionreg(instruction.crfD()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Operation::icbi:
|
||||||
|
AssertEqualOperationName(operation, @"icbi");
|
||||||
|
AssertEqualR(columns[3], instruction.rA(), false);
|
||||||
|
AssertEqualR(columns[4], instruction.rB());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Operation::lswi:
|
||||||
|
AssertEqualOperationName(operation, @"lswi");
|
||||||
|
AssertEqualR(columns[3], instruction.rD());
|
||||||
|
AssertEqualR(columns[4], instruction.rA());
|
||||||
|
XCTAssertEqual([columns[5] hexInt], instruction.nb());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Operation::stswi:
|
||||||
|
AssertEqualOperationName(operation, @"stswi");
|
||||||
|
AssertEqualR(columns[3], instruction.rS());
|
||||||
|
AssertEqualR(columns[4], instruction.rA());
|
||||||
|
XCTAssertEqual([columns[5] hexInt], instruction.nb());
|
||||||
|
break;
|
||||||
|
|
||||||
case Operation::cmp:
|
case Operation::cmp:
|
||||||
if([operation isEqualToString:@"cmpw"]) {
|
if([operation isEqualToString:@"cmpw"]) {
|
||||||
XCTAssertFalse(instruction.l());
|
XCTAssertFalse(instruction.l());
|
||||||
@ -359,6 +384,15 @@ NSString *offset(Instruction instruction) {
|
|||||||
XCTAssertEqual([columns[5] hexInt], instruction.simm());
|
XCTAssertEqual([columns[5] hexInt], instruction.simm());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Operation::mtfsb0x:
|
||||||
|
case Operation::mtfsb1x:
|
||||||
|
AssertEqualOperationNameE(
|
||||||
|
operation,
|
||||||
|
instruction.operation == Operation::mtfsb0x ? @"mtfsb0x" : @"mtfsb1x",
|
||||||
|
instruction);
|
||||||
|
XCTAssertEqual([columns[3] intValue], instruction.crbD());
|
||||||
|
break;
|
||||||
|
|
||||||
#define NoArg(x) \
|
#define NoArg(x) \
|
||||||
case Operation::x: \
|
case Operation::x: \
|
||||||
AssertEqualOperationName(operation, @#x); \
|
AssertEqualOperationName(operation, @#x); \
|
||||||
@ -481,39 +515,45 @@ NSString *offset(Instruction instruction) {
|
|||||||
ABCz(lwarx);
|
ABCz(lwarx);
|
||||||
ABCz(stwbrx);
|
ABCz(stwbrx);
|
||||||
ABCz(sthbrx);
|
ABCz(sthbrx);
|
||||||
|
ABCz(eciwx);
|
||||||
|
ABCz(lswx);
|
||||||
|
ABCz(lwa);
|
||||||
|
ABCz(lwaux);
|
||||||
|
ABCz(lwax);
|
||||||
|
|
||||||
#undef ABCz
|
#undef ABCz
|
||||||
|
|
||||||
#define ABD(x) \
|
#define DABe(x) \
|
||||||
case Operation::x: \
|
case Operation::x: \
|
||||||
AssertEqualOperationNameOE(operation, @#x, instruction); \
|
AssertEqualOperationNameOE(operation, @#x, instruction); \
|
||||||
[self testABDInstruction:instruction columns:columns testZero:NO]; \
|
[self testABDInstruction:instruction columns:columns testZero:NO]; \
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ABD(subfcx);
|
DABe(subfcx);
|
||||||
ABD(subfx);
|
DABe(subfx);
|
||||||
ABD(negx);
|
DABe(negx);
|
||||||
ABD(subfex);
|
DABe(subfex);
|
||||||
ABD(subfzex);
|
DABe(subfzex);
|
||||||
ABD(subfmex);
|
DABe(subfmex);
|
||||||
ABD(dozx);
|
DABe(dozx);
|
||||||
ABD(absx);
|
DABe(absx);
|
||||||
ABD(nabsx);
|
DABe(nabsx);
|
||||||
ABD(addx);
|
DABe(addx);
|
||||||
ABD(addcx);
|
DABe(addcx);
|
||||||
ABD(addex);
|
DABe(addex);
|
||||||
ABD(addmex);
|
DABe(addmex);
|
||||||
ABD(addzex);
|
DABe(addzex);
|
||||||
ABD(mulhwx);
|
DABe(mulhwx);
|
||||||
ABD(mulhwux);
|
DABe(mulhwux);
|
||||||
ABD(mulx);
|
DABe(mulx);
|
||||||
ABD(mullwx);
|
DABe(mullwx);
|
||||||
ABD(divx);
|
DABe(divx);
|
||||||
ABD(divsx);
|
DABe(divsx);
|
||||||
ABD(divwux);
|
DABe(divwux);
|
||||||
ABD(divwx);
|
DABe(divwx);
|
||||||
|
DABe(lscbxx);
|
||||||
|
|
||||||
#undef ABD
|
#undef DABe
|
||||||
|
|
||||||
#define ASB(x) \
|
#define ASB(x) \
|
||||||
case Operation::x: \
|
case Operation::x: \
|
||||||
@ -536,7 +576,7 @@ NSString *offset(Instruction instruction) {
|
|||||||
|
|
||||||
#define SAB(x) \
|
#define SAB(x) \
|
||||||
case Operation::x: \
|
case Operation::x: \
|
||||||
AssertEqualOperationName(operation, @#x, instruction); \
|
AssertEqualOperationName(operation, @#x); \
|
||||||
AssertEqualR(columns[3], instruction.rS()); \
|
AssertEqualR(columns[3], instruction.rS()); \
|
||||||
AssertEqualR(columns[4], instruction.rA(), false); \
|
AssertEqualR(columns[4], instruction.rA(), false); \
|
||||||
AssertEqualR(columns[5], instruction.rB()); \
|
AssertEqualR(columns[5], instruction.rB()); \
|
||||||
@ -546,6 +586,20 @@ NSString *offset(Instruction instruction) {
|
|||||||
|
|
||||||
#undef SAB
|
#undef SAB
|
||||||
|
|
||||||
|
#define AS(x) \
|
||||||
|
case Operation::x: \
|
||||||
|
AssertEqualOperationNameE(operation, @#x, instruction); \
|
||||||
|
AssertEqualR(columns[3], instruction.rA()); \
|
||||||
|
AssertEqualR(columns[4], instruction.rS()); \
|
||||||
|
break;
|
||||||
|
|
||||||
|
AS(cntlzwx);
|
||||||
|
AS(extsbx);
|
||||||
|
AS(extshx);
|
||||||
|
AS(extswx);
|
||||||
|
|
||||||
|
#undef AS
|
||||||
|
|
||||||
#define fSAB(x) \
|
#define fSAB(x) \
|
||||||
case Operation::x: \
|
case Operation::x: \
|
||||||
AssertEqualOperationName(operation, @#x, instruction); \
|
AssertEqualOperationName(operation, @#x, instruction); \
|
||||||
|
Loading…
Reference in New Issue
Block a user