On Tue, May 5, 2020 at 2:11 PM Joseph Myers <
jos...@codesourcery.com> wrote:
>
> On Tue, 5 May 2020, H.J. Lu wrote:
>
> > Although the control bits of the MXCSR register are callee-saved, they
> > are not restored by exception handling routines if they are changed in
> > the program execution. I created a merge request:
> >
> >
https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/6
> >
> > to document the current behavior. Any comments?
>
> I think it's unhelpful to try to describe either MXCSR or the x87 status
> and control words in terms of callee-saved and caller-saved. Rather, many
> of the bits in those registers (exception trap enable / disable, rounding
> mode, exception flags, etc.) are essentially like thread-local variables
> (accessed via interfaces such as fesetround) and the rules for the
> preservation of those bits are the rules that follow from the standard C
> rules about when those variables change; on function entry and exit they
> must have the values those variables must have at that time according to
> C language semantics (which might sometimes be undefined, e.g. for
> various bits in the absence of #pragma STDC FENV_ACCESS ON).