Add automated ground-truth testing of every instruction variation we currently test for internal self-consistency
Today our api.ir test goes through every opcode and major variation within each opcode and ensures that all our IR components agree with each other: fast decoder, slow decoder, encoder, INSTR_CREATE macros. However, there is no test that we have the right encoding found on the actual processor.
The proposal here is to have api.ir disassemble all of those tests (today done by setting VERBOSE to 1), probably in Intel syntax, and feed it through an external decoder for comparison. This could either be objdump, which is awkward to script for (have to build a binary), or llvm-mc, or capstone. I would propose even pulling capstone into third_party/ since I believe it's pretty small.
We would have to get the syntax to match closely or have some diff fuzzing.
We're already separately adding some tests based on binutils in #3574, but those only test their list of variations. The proposal here should nicely grow organically: any new opcode variation we add will automatically get external validation.