1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Test subfcx, subfx; correct decoding of oe().

This commit is contained in:
Thomas Harte 2022-03-28 20:39:52 -04:00
parent b9c8016aca
commit 99ad40f3e0
2 changed files with 12 additions and 4 deletions

View File

@ -540,7 +540,7 @@ struct Instruction {
/// Whether to compare 32-bit or 64-bit numbers [for 64-bit implementations only]; @c 0 or @c non-0.
uint32_t l() const { return opcode & 0x200000; }
/// Enables setting of OV and SO in the XER; @c 0 or @c non-0.
uint32_t oe() const { return opcode & 0x800; }
uint32_t oe() const { return opcode & 0x400; }
};
// Sanity check on Instruction size.

View File

@ -25,6 +25,14 @@ void AssertEqualOperationName(NSString *lhs, NSString *rhs) {
XCTAssertEqualObjects(lhsMapped, rhsMapped);
}
void AssertEqualOperationNameOE(NSString *lhs, Instruction instruction, NSString *rhs) {
XCTAssert([lhs characterAtIndex:lhs.length - 1] == 'x');
lhs = [lhs substringToIndex:lhs.length - 1];
if(instruction.oe()) lhs = [lhs stringByAppendingString:@"o"];
if(instruction.rc()) lhs = [lhs stringByAppendingString:@"."];
XCTAssertEqualObjects(lhs, rhs);
}
}
@implementation DingusdevPowerPCTests
@ -118,12 +126,12 @@ void AssertEqualOperationName(NSString *lhs, NSString *rhs) {
#define ABD(x) \
case Operation::x: \
AssertEqualOperationName(operation, @#x); \
AssertEqualOperationNameOE(@#x, instruction, operation); \
[self testABDInstruction:instruction columns:columns testZero:NO]; \
break;
// ABD(subfc);
// ABD(subfc_);
ABD(subfcx);
ABD(subfx);
#undef ABD