MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / EdGdEffective

Function EdGdEffective

source/test/testCPU.cpp:1724–1816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1722}
1723
1724void EdGdEffective(int instruction, struct Data* data, bool includeLock = false) {
1725 while (data->valid) {
1726 int ed;
1727 int gd;
1728 int rm;
1729
1730 for (ed = 0; ed < 8; ed++) {
1731 for (gd = 0; gd < 8; gd++) {
1732 Reg* e;
1733 Reg* g;
1734
1735 if (ed == gd)
1736 continue;
1737 rm = ed | (gd << 3) | 0xC0;
1738 newInstructionWithRM(instruction, rm, data->flags);
1739 pushConstant(data);
1740 e = &cpu->reg[E(rm)];
1741 g = &cpu->reg[G(rm)];
1742 e->u32 = data->var1;
1743 g->u32 = data->var2;
1744 runTestCPU();
1745 assertResult(data, cpu, instruction, e->u32, g->u32, E(rm), G(rm), 0, 32);
1746
1747 if (gd == 4 || ed == 4) {
1748 continue;
1749 }
1750 newInstructionWithRM(instruction, rm, data->flags);
1751 pushConstant(data);
1752 e = &cpu->reg[E(rm)];
1753 g = &cpu->reg[G(rm)];
1754 e->u32 = data->var1;
1755 g->u32 = data->var2;
1756 pushCode8(0x39);
1757 pushCode8(0xc0); // cmp eax, eax: this will overwrite flags so the above code might take a different path in the dynamic cores that optimize away flag calculation
1758 runTestCPU();
1759 assertResult(data, cpu, instruction, e->u32, g->u32, E(rm), G(rm), 0, 32, true);
1760 }
1761 }
1762
1763 for (int lock = 0; lock < 3; lock++) {
1764 for (gd = 0; gd < 8; gd++) {
1765 Reg* g;
1766 U32 result;
1767 int offset = 0;
1768
1769 rm = (gd << 3);
1770 if (cpu->big) {
1771 offset = (data->var2 >> 5) * 4;
1772 rm += 5;
1773 } else {
1774 offset = (data->var2 >> 4) * 2;
1775 rm += 6;
1776 }
1777 newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0);
1778 U16 addressOffset = lock == 2 ? 202 : 200;
1779
1780 if (cpu->big)
1781 pushCode32(addressOffset);

Callers 4

testBt0x3a3Function · 0.85
testBtr0x3b3Function · 0.85
testBtc0x3bbFunction · 0.85
testBts0x3abFunction · 0.85

Calls 9

newInstructionWithRMFunction · 0.85
pushConstantFunction · 0.85
runTestCPUFunction · 0.85
assertResultFunction · 0.85
pushCode8Function · 0.85
pushCode32Function · 0.85
pushCode16Function · 0.85
writedMethod · 0.45
readdMethod · 0.45

Tested by

no test coverage detected