MCPcopy Create free account
hub / github.com/decaf-emu/decaf-emu / executeInstrTest

Function executeInstrTest

tests/cpu/fuzz-compare/fuzztests.cpp:149–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149bool
150executeInstrTest(uint32_t test_seed)
151{
152 std::mt19937 test_rand(test_seed);
153 InstructionID instrId = (InstructionID)(test_rand() % (int)InstructionID::InstructionCount);
154
155 // Special cases that we can't test easily
156 switch (instrId) {
157 case InstructionID::Invalid:
158 return true;
159 case InstructionID::lmw:
160 case InstructionID::lswi:
161 case InstructionID::lswx:
162 case InstructionID::stmw:
163 case InstructionID::stswi:
164 case InstructionID::stswx:
165 // Multi-word logic, disabled for now
166 return true;
167 case InstructionID::psq_l:
168 case InstructionID::psq_lu:
169 case InstructionID::psq_lux:
170 case InstructionID::psq_lx:
171 case InstructionID::psq_st:
172 case InstructionID::psq_stu:
173 case InstructionID::psq_stux:
174 case InstructionID::psq_stx:
175 // Quantization Registers need to be properly configured for these, disabled for now
176 return true;
177 case InstructionID::b:
178 case InstructionID::bc:
179 case InstructionID::bcctr:
180 case InstructionID::bclr:
181 // Branching cannot be fuzzed
182 return true;
183 case InstructionID::kc:
184 // Emulator Instruction
185 return true;
186 case InstructionID::sc:
187 case InstructionID::tw:
188 case InstructionID::twi:
189 case InstructionID::mfsr:
190 case InstructionID::mfsrin:
191 case InstructionID::mtsr:
192 case InstructionID::mtsrin:
193 // Supervisory Instructions
194 return true;
195 default:
196 break;
197 }
198
199 const auto data = findInstructionInfo(instrId);
200 const InstructionFuzzData *fuzzData = &instructionFuzzData[(int)instrId];
201 if (!data || !fuzzData) {
202 return false;
203 }
204
205 if (!cpu::interpreter::hasInstruction(instrId)) {
206 // No handler, skip it...

Callers 1

executeFuzzTestsFunction · 0.85

Calls 15

findInstructionInfoFunction · 0.85
hasInstructionFunction · 0.85
array_sizeFunction · 0.85
isInstructionFieldMarkerFunction · 0.85
setFieldValueFunction · 0.85
encodeSPRFunction · 0.85
encodeInstructionFunction · 0.85
restoreStateFieldFunction · 0.85
memcpyFunction · 0.85
executeSubFunction · 0.85
clearCacheFunction · 0.85
saveStateFieldFunction · 0.85

Tested by

no test coverage detected