1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-17 13:29:02 +00:00

Test integer loads and stores.

This commit is contained in:
Thomas Harte 2022-04-02 15:27:12 -04:00
parent 8a1409184f
commit b84fa619da
2 changed files with 120 additions and 7 deletions

View File

@ -331,18 +331,40 @@ enum class Operation: uint8_t {
fabsx, faddx, faddsx, fcmpo, fcmpu, fctiwx, fctiwzx, fabsx, faddx, faddsx, fcmpo, fcmpu, fctiwx, fctiwzx,
fdivx, fdivsx, fmaddx, fmaddsx, fmrx, fmsubx, fmsubsx, fmulx, fmulsx, fdivx, fdivsx, fmaddx, fmaddsx, fmrx, fmsubx, fmsubsx, fmulx, fmulsx,
fnabsx, fnegx, fnmaddx, fnmaddsx, fnmsubx, fnmsubsx, frspx, fsubx, fsubsx, fnabsx, fnegx, fnmaddx, fnmaddsx, fnmsubx, fnmsubsx, frspx, fsubx, fsubsx,
icbi, isync, lbz, lbzu, icbi, isync,
/// Load byte and zero.
/// lbz
/// rD(), d() [ rA() ]
lbz,
/// Load byte and zero with update.
/// lbz
/// rD(), d() [ rA() ]
lbzu,
/// Load byte and zero with update indexed. /// Load byte and zero with update indexed.
/// lbzux /// lbzux
/// rD(), rA(), rB()
lbzux, lbzux,
/// Load byte and zero indexed. /// Load byte and zero indexed.
/// lbzx /// lbzx
/// rD(), rA(), rB()
lbzx, lbzx,
lfd, lfdu, lfdux, lfdx, lfs, lfsu, lfd, lfdu, lfdux, lfdx, lfs, lfsu,
lfsux, lfsx, lha, lhau, lfsux, lfsx,
/// Load half word algebraic.
/// lha
/// rD(), d() [ rA() ]
lha,
/// Load half word algebraic with update.
/// lha
/// rD(), d() [ rA() ]
lhau,
/// Load half-word algebraic with update indexed. /// Load half-word algebraic with update indexed.
/// lhaux /// lhaux
@ -533,19 +555,64 @@ enum class Operation: uint8_t {
stfs, stfs,
/// Store floating point single precision with update. /// Store floating point single precision with update.
/// stfs /// stfsu
/// frS() d() [ rA() ] /// frS() d() [ rA() ]
stfsu, stfsu,
stfsux, stfsx, sth, sthbrx, sthu, /// Store floating point single precision with update indexed.
/// stfsux
/// frS(), rA(), rB()
stfsux,
/// Store floating point single precisionindexed.
/// stfsx
/// frS(), rA(), rB()
stfsx,
/// Store half word.
/// sth
/// rS(), d() [ rA() ]
sth,
/// Store half word byte-reverse indexed.
/// sthbrx
/// rS(), rA(), rB()
sthbrx,
/// Store half word with update.
/// sthu
/// rS(), d() [ rA() ]
sthu,
/// Store half-word with update indexed. /// Store half-word with update indexed.
/// sthux
/// rS(), rA(), rB()
sthux, sthux,
/// Store half-word indexed. /// Store half-word indexed.
/// sthx
/// rS(), rA(), rB()
sthx, sthx,
stmw, stswi, stswx, stw, /// Store multiple word.
/// stmw
/// rS(), d() [ rA() ]
stmw,
/// Store string word immediate.
/// stswi
/// rS(), rA(), nb()
stswi,
/// Store string word indexed.
/// stswx
/// rS(), rA(), rB()
stswx,
/// Store word.
/// stw
/// rS(), d() [ rA() ]
stw,
/// Store word byte-reverse indexed. /// Store word byte-reverse indexed.
/// stwbrx /// stwbrx

View File

@ -92,6 +92,16 @@ NSString *condition(uint32_t code) {
} }
} }
NSString *offset(Instruction instruction) {
NSString *const hexPart = [NSString stringWithFormat:@"%s%X", (instruction.d() < 0) ? "-0x" : "0x", abs(instruction.d())];
if(instruction.rA()) {
return [hexPart stringByAppendingFormat:@"(r%d)", instruction.rA()];
} else {
return hexPart;
}
}
} }
@implementation DingusdevPowerPCTests @implementation DingusdevPowerPCTests
@ -464,6 +474,42 @@ NSString *condition(uint32_t code) {
#undef SAB #undef SAB
#define DDA(x) \
case Operation::x: { \
AssertEqualOperationName(operation, @#x, instruction); \
AssertEqualR(columns[3], instruction.rD()); \
XCTAssertEqualObjects(columns[4], offset(instruction)); \
} break;
DDA(lbz);
DDA(lbzu);
DDA(lmw);
DDA(lwz);
DDA(lwzu);
DDA(lhz);
DDA(lhzu);
DDA(lha);
DDA(lhau);
#undef DDA
#define SDA(x) \
case Operation::x: { \
AssertEqualOperationName(operation, @#x, instruction); \
AssertEqualR(columns[3], instruction.rS()); \
XCTAssertEqualObjects(columns[4], offset(instruction)); \
} break;
SDA(stb);
SDA(stbu);
SDA(sth);
SDA(sthu);
SDA(stmw);
SDA(stw);
SDA(stwu);
#undef SDA
case Operation::bcx: case Operation::bcx:
case Operation::bclrx: case Operation::bclrx:
case Operation::bcctrx: { case Operation::bcctrx: {