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

Test lwzux.

This commit is contained in:
Thomas Harte 2022-03-25 20:31:47 -04:00
parent 33c31eb798
commit 3d48183753
2 changed files with 26 additions and 9 deletions

View File

@ -151,7 +151,15 @@ enum class Operation: uint8_t {
fnabsx, fnegx, fnmaddx, fnmaddsx, fnmsubx, fnmsubsx, frspx, fsubx, fsubsx,
icbi, isync, lbz, lbzu, lbzux, lbzx, lfd, lfdu, lfdux, lfdx, lfs, lfsu,
lfsux, lfsx, lha, lhau, lhaux, lhax, lhbrx, lhz, lhzu, lhzux, lhzx, lmw,
lswi, lswx, lwarx, lwbrx, lwz, lwzu, lwzux,
lswi, lswx, lwarx, lwbrx, lwz, lwzu,
/// Load word and zero with Update Indexed.
///
/// rD() = [ rA()|0 + rB() ]; and rA() is set to the calculated address.
///
/// PowerPC defines rA=0 and rA=rD to be invalid forms; the MPC601
/// will suppress the update if rA=0 or rA=rD.
lwzux,
/// Load word and zero indexed.
///

View File

@ -19,6 +19,15 @@ using namespace InstructionSet::PowerPC;
@implementation DingusdevPowerPCTests
- (void)testABDInstruction:(Instruction)instruction columns:(NSArray<NSString *> *)columns testZero:(BOOL)testZero {
NSString *const rA = (instruction.rA() || !testZero) ? [NSString stringWithFormat:@"r%d", instruction.rA()] : @"0";
NSString *const rB = [NSString stringWithFormat:@"r%d", instruction.rB()];
NSString *const rD = [NSString stringWithFormat:@"r%d", instruction.rD()];
XCTAssertEqualObjects(rD, columns[3]);
XCTAssertEqualObjects(rA, columns[4]);
XCTAssertEqualObjects(rB, columns[5]);
}
- (void)testDecoding {
NSData *const testData =
[NSData dataWithContentsOfURL:
@ -53,15 +62,15 @@ using namespace InstructionSet::PowerPC;
NSAssert(FALSE, @"Didn't handle %@", line);
break;
case Operation::lwzx: {
case Operation::lwzux:
XCTAssertEqualObjects(operation, @"lwzux");
[self testABDInstruction:instruction columns:columns testZero:YES];
break;
case Operation::lwzx:
XCTAssertEqualObjects(operation, @"lwzx");
NSString *const rA = instruction.rA() ? [NSString stringWithFormat:@"r%d", instruction.rA()] : @"0";
NSString *const rB = [NSString stringWithFormat:@"r%d", instruction.rB()];
NSString *const rD = [NSString stringWithFormat:@"r%d", instruction.rD()];
XCTAssertEqualObjects(rD, columns[3]);
XCTAssertEqualObjects(rA, columns[4]);
XCTAssertEqualObjects(rB, columns[5]);
} break;
[self testABDInstruction:instruction columns:columns testZero:YES];
break;
case Operation::bcx:
case Operation::bclrx: