On Tue, 21 Jan 2025, Vineet Gupta wrote: > Silly question, what exactly is the procedure calling convention rule for > FCSR/FRM ? Is it a Caller saved or a Callee saved Reg. > The psABI CC doc is not explicit in those terms at least [1] > > | "The Floating-Point Control and Status Register (fcsr) must have thread > storage duration > | in accordance with C11 section 7.6 "Floating-point environment <fenv.h" > > Per your llround snippet#2 is seems like Callee saved (function is restoring > the mode before it returns), but then in the snippet #1 at top, why does it > need > to save the value before a function call, can't the callee just restore it > back. > I'm surely missing something here.
In the 32-bit Power Architecture ABI we defined rounding mode and similar bits as "limited-access" since, being more like a thread-local variable than a normal register, they don't fit well into the caller-save / callee-save model. https://www.polyomino.org.uk/publications/2011/Power-Arch-32-bit-ABI-supp-1.0-Unified.pdf#page=38 -- Joseph S. Myers josmy...@redhat.com