| 147 | } |
| 148 | |
| 149 | bool |
| 150 | executeInstrTest(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... |
no test coverage detected