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

Test floating point loads and stores.

This commit is contained in:
Thomas Harte 2022-04-02 15:40:17 -04:00
parent b84fa619da
commit 42532ec0f5
2 changed files with 106 additions and 4 deletions

View File

@ -353,8 +353,45 @@ enum class Operation: uint8_t {
/// rD(), rA(), rB()
lbzx,
lfd, lfdu, lfdux, lfdx, lfs, lfsu,
lfsux, lfsx,
/// Load floating point double precision.
/// lfd
/// frD(), d() [ rA() ]
lfd,
/// Load floating point double precision with update.
/// lfdu
/// frD(), d() [ rA() ]
lfdu,
/// Load floating point double precision with update indexed.
/// lfdux
/// frD(), rA(), rB()
lfdux,
/// Load floating point double precision indexed.
/// lfdx
/// frD(), rA(), rB()
lfdx,
/// Load floating point single precision.
/// lfs
/// frD(), d() [ rA() ]
lfs,
/// Load floating point single precision with update.
/// lfsu
/// frD(), d() [ rA() ]
lfsu,
/// Load floating point single precision with update indexed.
/// lfsux
/// frD(), rA(), rB()
lfsux,
/// Load floating point single precision indexed.
/// lfsx
/// frD(), rA(), rB()
lfsx,
/// Load half word algebraic.
/// lha
@ -551,12 +588,12 @@ enum class Operation: uint8_t {
/// Store floating point single precision.
/// stfs
/// frS() d() [ rA() ]
/// frS(), d() [ rA() ]
stfs,
/// Store floating point single precision with update.
/// stfsu
/// frS() d() [ rA() ]
/// frS(), d() [ rA() ]
stfsu,
/// Store floating point single precision with update indexed.

View File

@ -74,6 +74,12 @@ void AssertEqualR(NSString *name, uint32_t reg, bool permitR0 = true) {
XCTAssertEqualObjects(name, regName);
}
/// Forms the string @c f[reg] and compares it to @c name
void AssertEqualFR(NSString *name, uint32_t reg, bool permitR0 = true) {
NSString *const regName = (reg || permitR0) ? [NSString stringWithFormat:@"f%d", reg] : @"0";
XCTAssertEqualObjects(name, regName);
}
/// @returns the text name of the condition code @c code
NSString *condition(uint32_t code) {
NSString *suffix;
@ -474,6 +480,37 @@ NSString *offset(Instruction instruction) {
#undef SAB
#define fSAB(x) \
case Operation::x: \
AssertEqualOperationName(operation, @#x, instruction); \
AssertEqualFR(columns[3], instruction.frS()); \
AssertEqualR(columns[4], instruction.rA(), false); \
AssertEqualR(columns[5], instruction.rB()); \
break;
fSAB(stfdx);
fSAB(stfdux);
fSAB(stfsx);
fSAB(stfsux);
fSAB(stfiwx);
#undef fSAB
#define fDAB(x) \
case Operation::x: \
AssertEqualOperationName(operation, @#x, instruction); \
AssertEqualFR(columns[3], instruction.frD()); \
AssertEqualR(columns[4], instruction.rA(), false); \
AssertEqualR(columns[5], instruction.rB()); \
break;
fDAB(lfdux);
fDAB(lfdx);
fDAB(lfsux);
fDAB(lfsx);
#undef fDAB
#define DDA(x) \
case Operation::x: { \
AssertEqualOperationName(operation, @#x, instruction); \
@ -493,6 +530,20 @@ NSString *offset(Instruction instruction) {
#undef DDA
#define fDDA(x) \
case Operation::x: { \
AssertEqualOperationName(operation, @#x, instruction); \
AssertEqualFR(columns[3], instruction.rD()); \
XCTAssertEqualObjects(columns[4], offset(instruction)); \
} break;
fDDA(lfd);
fDDA(lfdu);
fDDA(lfs);
fDDA(lfsu);
#undef fDDA
#define SDA(x) \
case Operation::x: { \
AssertEqualOperationName(operation, @#x, instruction); \
@ -510,6 +561,20 @@ NSString *offset(Instruction instruction) {
#undef SDA
#define fSDA(x) \
case Operation::x: { \
AssertEqualOperationName(operation, @#x, instruction); \
AssertEqualFR(columns[3], instruction.rS()); \
XCTAssertEqualObjects(columns[4], offset(instruction)); \
} break;
fSDA(stfd);
fSDA(stfdu);
fSDA(stfs);
fSDA(stfsu);
#undef fSDA
case Operation::bcx:
case Operation::bclrx:
case Operation::bcctrx: {