@@ -531,6 +531,15 @@ pub unsafe fn hinval_gvma_all() {
531
531
532
532
/// Reads the floating-point control and status register `fcsr`
533
533
///
534
+ /// Note that Rust makes no guarantees whatsoever about the contents of this register: Rust
535
+ /// floating-point operations may or may not result in this register getting updated with exception
536
+ /// state, and the register can change between two invocations of this function even when no
537
+ /// floating-point operations appear in the source code (since floating-point operations appearing
538
+ /// earlier or later can be reordered).
539
+ ///
540
+ /// If you need to perform some floating-point operations and check whether they raised an
541
+ /// exception, use an inline assembly block for the entire sequence of operations.
542
+ ///
534
543
/// Register `fcsr` is a 32-bit read/write register that selects the dynamic rounding mode
535
544
/// for floating-point arithmetic operations and holds the accrued exception flag.
536
545
///
@@ -549,6 +558,10 @@ pub unsafe fn hinval_gvma_all() {
549
558
/// [`frflags`]: fn.frflags.html
550
559
#[ inline]
551
560
#[ unstable( feature = "stdsimd" , issue = "27731" ) ]
561
+ #[ deprecated(
562
+ since = "1.75.0" ,
563
+ note = "see `frcsr` documentation - use inline assembly instead"
564
+ ) ]
552
565
pub fn frcsr ( ) -> u32 {
553
566
let value: u32 ;
554
567
unsafe { asm ! ( "frcsr {}" , out( reg) value, options( nomem, nostack) ) } ;
@@ -557,10 +570,24 @@ pub fn frcsr() -> u32 {
557
570
558
571
/// Swaps the floating-point control and status register `fcsr`
559
572
///
573
+ /// Note that modifying the masking flags, rounding mode, or denormals-are-zero mode flags leads to
574
+ /// **immediate Undefined Behavior**: Rust assumes that these are always in their default state and
575
+ /// will optimize accordingly. This even applies when the register is altered and later reset to its
576
+ /// original value without any floating-point operations appearing in the source code between those
577
+ /// operations (since floating-point operations appearing earlier or later can be reordered).
578
+ ///
579
+ /// If you need to perform some floating-point operations under a different masking flags, rounding
580
+ /// mode, or denormals-are-zero mode, use an inline assembly block and make sure to restore the
581
+ /// original `fcsr` register state before the end of the block.
582
+ ///
560
583
/// This function swaps the value in `fcsr` by copying the original value to be returned,
561
584
/// and then writing a new value obtained from input variable `value` into `fcsr`.
562
585
#[ inline]
563
586
#[ unstable( feature = "stdsimd" , issue = "27731" ) ]
587
+ #[ deprecated(
588
+ since = "1.75.0" ,
589
+ note = "see `fscsr` documentation - use inline assembly instead"
590
+ ) ]
564
591
pub fn fscsr ( value : u32 ) -> u32 {
565
592
let original: u32 ;
566
593
unsafe { asm ! ( "fscsr {}, {}" , out( reg) original, in( reg) value, options( nomem, nostack) ) }
@@ -597,6 +624,10 @@ pub fn frrm() -> u32 {
597
624
/// input variable `value` into `frm`.
598
625
#[ inline]
599
626
#[ unstable( feature = "stdsimd" , issue = "27731" ) ]
627
+ #[ deprecated(
628
+ since = "1.75.0" ,
629
+ note = "see `fscsr` documentation - use inline assembly instead"
630
+ ) ]
600
631
pub fn fsrm ( value : u32 ) -> u32 {
601
632
let original: u32 ;
602
633
unsafe { asm ! ( "fsrm {}, {}" , out( reg) original, in( reg) value, options( nomem, nostack) ) }
@@ -621,6 +652,10 @@ pub fn fsrm(value: u32) -> u32 {
621
652
/// | 0 | NX | Inexact |
622
653
#[ inline]
623
654
#[ unstable( feature = "stdsimd" , issue = "27731" ) ]
655
+ #[ deprecated(
656
+ since = "1.75.0" ,
657
+ note = "see `frcsr` documentation - use inline assembly instead"
658
+ ) ]
624
659
pub fn frflags ( ) -> u32 {
625
660
let value: u32 ;
626
661
unsafe { asm ! ( "frflags {}" , out( reg) value, options( nomem, nostack) ) } ;
@@ -634,6 +669,10 @@ pub fn frflags() -> u32 {
634
669
/// input variable `value` into `fflags`.
635
670
#[ inline]
636
671
#[ unstable( feature = "stdsimd" , issue = "27731" ) ]
672
+ #[ deprecated(
673
+ since = "1.75.0" ,
674
+ note = "see `frcsr` documentation - use inline assembly instead"
675
+ ) ]
637
676
pub fn fsflags ( value : u32 ) -> u32 {
638
677
let original: u32 ;
639
678
unsafe { asm ! ( "fsflags {}, {}" , out( reg) original, in( reg) value, options( nomem, nostack) ) }
0 commit comments