title: What's the performance impact of exporting registers to stack?
body: <p>I am working on some code that is meant to run on x86 in 32-bit mode. In that mode, I understand that I've got only 8 SIMD/AVX2-Registers (YMM0-7) to freely work with. However, some of my vector subroutines alone sometimes use more than that amount of registers simultainiously (meaning that they are still needed somewhere down the road - mostly not so far afterwards).</p>
  
  <p>My understanding is, that compilers will export older registers to <strong>stack memory</strong> when they can't find unused registers. But how much does this impact performance ? (e.g. in cycles per export/import later on). Can I trust in stack memory mostly residing in L1-D-Cache (with 2 cycles latency in Haswell) or is there a significant performance impact of avoiding such register-to-memory (and vice versa) transfers ? </p>
  
  <p>So far I wasn't able to find answers to this topic, especially since the registers keep getting bigger and bigger (1 Cacheline per register with upcoming Skylake platform). It would be nice if you could give sources in case you answer.</p>