How are AVX registers handled by common calls?

I could not find any document defining how the YMM registers are processed by the caller and the called user.

To focus my question, here is what I would like to know:

  • What YMM registers must be restored by the called party before returning to the calling party?
  • Since there are differences for the XMM registers on Linux and Windows, I assume that also the YMM registers do not follow the same rules. What are the rules for each OS?

EDIT: Thanks to the answer below, I was able to remove the answer in the mentioned document for Win64. I am absolutely sure that Linux follows similar rules:

"... The YMM registers do not have callee-save status, except for the lower half of YMM6-YMM15 in 64-bit Windows, where XMM6-XMM15 have callee-save status. Possible future extensions of the vector registers to 512 bits or more will not have calleesave status. ..." 
+6
source share
1 answer

The answer to both of your questions (assuming you're talking about calling a convention in C ++) is in Agner Tuman's excellent optimization guide:

Invoking conventions for different compilers and operating systems in C ++ .

See section 6 (Using the registry) on page 10. Section 7.2 (Transferring and returning SIMD types) on page 22 may also be appropriate.

+4
source

Source: https://habr.com/ru/post/905892/


All Articles