1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +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() /// rD(), rA(), rB()
lbzx, lbzx,
lfd, lfdu, lfdux, lfdx, lfs, lfsu, /// Load floating point double precision.
lfsux, lfsx, /// 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. /// Load half word algebraic.
/// lha /// lha
@ -551,12 +588,12 @@ enum class Operation: uint8_t {
/// Store floating point single precision. /// Store floating point single precision.
/// stfs /// stfs
/// frS() d() [ rA() ] /// frS(), d() [ rA() ]
stfs, stfs,
/// Store floating point single precision with update. /// Store floating point single precision with update.
/// stfsu /// stfsu
/// frS() d() [ rA() ] /// frS(), d() [ rA() ]
stfsu, stfsu,
/// Store floating point single precision with update indexed. /// 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); 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 /// @returns the text name of the condition code @c code
NSString *condition(uint32_t code) { NSString *condition(uint32_t code) {
NSString *suffix; NSString *suffix;
@ -474,6 +480,37 @@ NSString *offset(Instruction instruction) {
#undef SAB #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) \ #define DDA(x) \
case Operation::x: { \ case Operation::x: { \
AssertEqualOperationName(operation, @#x, instruction); \ AssertEqualOperationName(operation, @#x, instruction); \
@ -493,6 +530,20 @@ NSString *offset(Instruction instruction) {
#undef DDA #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) \ #define SDA(x) \
case Operation::x: { \ case Operation::x: { \
AssertEqualOperationName(operation, @#x, instruction); \ AssertEqualOperationName(operation, @#x, instruction); \
@ -510,6 +561,20 @@ NSString *offset(Instruction instruction) {
#undef SDA #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::bcx:
case Operation::bclrx: case Operation::bclrx:
case Operation::bcctrx: { case Operation::bcctrx: {