4 ms·
I don't think Intel/AMD make any guarantees about instructions being constant time either.
by CodesInChaos 6y ago
I don't think Intel/AMD make any guarantees about instructions being constant time either.
- SAI_Peregrinus 6y agoCorrect, and don't provide any guarantees about electromagnetic side channel emissions or power side channels or… The lack of a guarantee in assembly is less of a concern than the lack of a guarantee in C, since the CPU behavior is less likely to change unexpectedly than a C compiler. Though Intel at least does provide a list of instruction latencies and throughputs, in their "Intel 64 and IA-32 Architectures Optimization Reference Manual"[1]. [1] https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-optimization-manual.pdf https://www.intel.com/content/dam/www/public/us/en/documents...
- JoshTriplett 6y agoNormally, rather than counting on two different codepaths to take the same number of cycles, assembly code written for constant execution time will always run all the same instructions unconditionally. So, you don't have to know how many cycles every instruction takes; you just have to make sure you use instructions that don't take a data-dependent number of cycles.