@@ -1365,6 +1365,15 @@ pub unsafe fn _mm_sfence() {
13651365
13661366/// Gets the unsigned 32-bit value of the MXCSR control and status register.
13671367///
1368+ /// Note that Rust makes no guarantees whatsoever about the contents of this regiser: Rust
1369+ /// floating-point operations may or may not result in this register getting updated with exception
1370+ /// state, and the register can change between two invocations of this function even when no
1371+ /// floating-point operations appear in the source code (since floating-point operations appearing
1372+ /// earlier or later can be reordered).
1373+ ///
1374+ /// If you need to perform some floating-point operations and check whether they raised an
1375+ /// exception, use an inline assembly block for the entire sequence of operations.
1376+ ///
13681377/// For more info see [`_mm_setcsr`](fn._mm_setcsr.html)
13691378///
13701379/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_getcsr)
@@ -1401,6 +1410,16 @@ pub unsafe fn _mm_getcsr() -> u32 {
14011410/// * The *denormals-are-zero mode flag* turns all numbers which would be
14021411/// denormalized (exponent bits are all zeros) into zeros.
14031412///
1413+ /// Note that modfying the masking flags, rounding mode, or denormals-are-zero mode flags leads to
1414+ /// **immediate Undefined Behavior**: Rust assumes that these are always in their default state and
1415+ /// will optimize accordingly. This even applies when the register is altered and later reset to its
1416+ /// original value without any floating-point operations appearing in the source code between those
1417+ /// operations (since floating-point operations appearing earlier or later can be reordered).
1418+ ///
1419+ /// If you need to perform some floating-point operations under a different masking flags, rounding
1420+ /// mode, or denormals-are-zero mode, use an inline assembly block and make sure to restore the
1421+ /// original MXCSR register state before the end of the block.
1422+ ///
14041423/// ## Exception Flags
14051424///
14061425/// * `_MM_EXCEPT_INVALID`: An invalid operation was performed (e.g., dividing
0 commit comments