<story><title>Replacing 32-bit loop variable with 64-bit introduces performance deviations</title><url>http://stackoverflow.com/questions/25078285/replacing-32bit-loop-count-variable-with-64bit-introduces-crazy-performance-devi</url><text></text></story><parent_chain></parent_chain><comment><author>mgraczyk</author><text>To elaborate on the justification for the answer:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    So Intel probably shoved popcnt into the same category to keep the processor design simple
&lt;/code&gt;&lt;/pre&gt;
In the processor design I work on, we do register dependency checks by partitioning all instructions into a set of &amp;quot;timing classes&amp;quot; and checking the dispatch delay needed between dependent register producers and consumers across all possible timing class pairs.  The delays vary depending on available forwarding networks, resource conflicts, etc.  Often times we groups instructions into sub optimal timing classes to simplify other parts of the design or just to make the dispatch logic simpler.&lt;p&gt;Intel&amp;#x27;s x86 core is waaaaay more complicated than the core I work on and has far more instructions, so I it&amp;#x27;s probably safe to say that they make these suboptimal classifications often.  I strongly suspect that the false dependency was intentional and not a &amp;quot;hardware bug&amp;quot; as some of the StackOverflow comments seem to suggest.</text></comment>
<story><title>Replacing 32-bit loop variable with 64-bit introduces performance deviations</title><url>http://stackoverflow.com/questions/25078285/replacing-32bit-loop-count-variable-with-64bit-introduces-crazy-performance-devi</url><text></text></story><parent_chain></parent_chain><comment><author>jbondeson</author><text>This is why micro-benchmarking is Russian roulette.&lt;p&gt;When you distill a loop until you&amp;#x27;re finding the exact bottleneck in the system (pipelining, branch prediction, etc) you need to be very very careful you&amp;#x27;re measuring what you think you are. Otherwise you&amp;#x27;ll end up in this situation where you&amp;#x27;re benchmarking a compiler...</text></comment>