This patch is not to be submitted as is. I'd like to get some input first, but starting with some code will help.
Some instruction's latency depend on the value of its operands (e.g. DIV with NaN or subnormal takes longer to execute than normal numbers).
For llvm-exegesis to explore the latency space of the instructions it needs some special knowledge of the instruction.
I envision that the best place to store this knowledge is the td file.
Let's take the following div example, by choosing special starting values we can make sure that even with 100000 iterations divss will always stay in the normal range.
movss xmm0, 0x3F800000 1.0f
movss xmm1, 0x3F800001 1.0f + 1ulp
.rept 100000
divss xmm0, xmm1
.endr
So an exegesis configuration for divss would be (1.0f, 1.0f + ulp),
Another could be (1.0f, 0.0f) to test infinity generation,
Another could be (NaN, Inf) to test the impact of NaNs...
The configuration should allow to specify the bit precise values and to pack them in case of vector instructions.
This configuration should work for all floating point types (including X87) and for as many arithmetic operations as possible (div, mul, sqrt, ...).
It can be part of the Instruction Records or separated as it is in this Patch.
Addendum
I started a document to gather the different strategies (feel free to comment).
From this it becomes clear that we only need to annotate an Instruction with its semantic, llvm-exegesis would then run strategies depending on the semantic and the type of the arguments (floating point precision, packed/scalar).
I'll update the code with a simpler proposal.