The saturated intrinsic operations define the SAT bit if saturation occurs. The SAT bit can be set and cleared from C/C++ code by accessing the control status register (CSR). The compiler uses the following steps for generating code that accesses the SAT bit:
- The SAT bit becomes undefined by a function call or a function return. This means that the SAT bit in the CSR is valid and can be read in C/C++ code until a function call or until a function returns.
- If the code in a function accesses the CSR, then the compiler assumes that the SAT bit is live across the function, which means:
- The SAT bit is maintained by the code that disables interrupts around software pipelined loops.
- Saturated instructions cannot be speculatively executed.
- If an interrupt service routine modifies the SAT bit, then the routine should be written to save and restore the CSR.