https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81709

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Anatol from comment #4)
> > you need to save the complete vector state
> 
> It is a good point. Would it make sense for compiler to do it? Instead of
> forcing users to track if SSE registers are used and doing xsave/xrstor
> manually?

To save and restore the complete vector state, you need to do

Check if CPU supports xsave/restore
if yes
  Query CPU for the complete vector state size
  Allocate space on stack for the complete vector state
  xsave
else
  Allocate space on stack for the fxsave area.
  fxsave
endif
...
if CPU supports xsave/restore
  xrstor
else
  fxrstor
endif

I don't believe compiler needs to do all that.

Reply via email to