@@ -461,18 +461,16 @@ fn test_recip() {
461461#[ test]  
462462#[ cfg( reliable_f16_math) ]  
463463fn  test_powi ( )  { 
464-     // FIXME(llvm19): LLVM misoptimizes `powi.f16` 
465-     // <https://github.com/llvm/llvm-project/issues/98665> 
466-     // let nan: f16 = f16::NAN; 
467-     // let inf: f16 = f16::INFINITY; 
468-     // let neg_inf: f16 = f16::NEG_INFINITY; 
469-     // assert_eq!(1.0f16.powi(1), 1.0); 
470-     // assert_approx_eq!((-3.1f16).powi(2), 9.61, TOL_0); 
471-     // assert_approx_eq!(5.9f16.powi(-2), 0.028727, TOL_N2); 
472-     // assert_eq!(8.3f16.powi(0), 1.0); 
473-     // assert!(nan.powi(2).is_nan()); 
474-     // assert_eq!(inf.powi(3), inf); 
475-     // assert_eq!(neg_inf.powi(2), inf); 
464+     let  nan:  f16  = f16:: NAN ; 
465+     let  inf:  f16  = f16:: INFINITY ; 
466+     let  neg_inf:  f16  = f16:: NEG_INFINITY ; 
467+     assert_eq ! ( 1.0f16 . powi( 1 ) ,  1.0 ) ; 
468+     assert_approx_eq ! ( ( -3.1f16 ) . powi( 2 ) ,  9.61 ,  TOL_0 ) ; 
469+     assert_approx_eq ! ( 5.9f16 . powi( -2 ) ,  0.028727 ,  TOL_N2 ) ; 
470+     assert_eq ! ( 8.3f16 . powi( 0 ) ,  1.0 ) ; 
471+     assert ! ( nan. powi( 2 ) . is_nan( ) ) ; 
472+     assert_eq ! ( inf. powi( 3 ) ,  inf) ; 
473+     assert_eq ! ( neg_inf. powi( 2 ) ,  inf) ; 
476474} 
477475
478476#[ test]  
@@ -813,21 +811,21 @@ fn test_clamp_max_is_nan() {
813811} 
814812
815813#[ test]  
814+ #[ cfg( reliable_f16_math) ]  
816815fn  test_total_cmp ( )  { 
817816    use  core:: cmp:: Ordering ; 
818817
819818    fn  quiet_bit_mask ( )  -> u16  { 
820819        1  << ( f16:: MANTISSA_DIGITS  - 2 ) 
821820    } 
822821
823-     // FIXME(f16_f128): test subnormals when powf is available 
824-     // fn min_subnorm() -> f16 { 
825-     //     f16::MIN_POSITIVE / f16::powf(2.0, f16::MANTISSA_DIGITS as f16 - 1.0) 
826-     // } 
822+     fn  min_subnorm ( )  -> f16  { 
823+         f16:: MIN_POSITIVE  / f16:: powf ( 2.0 ,  f16:: MANTISSA_DIGITS  as  f16  - 1.0 ) 
824+     } 
827825
828-     //  fn max_subnorm() -> f16 {
829-     //      f16::MIN_POSITIVE - min_subnorm()
830-     //  }
826+     fn  max_subnorm ( )  -> f16  { 
827+         f16:: MIN_POSITIVE  - min_subnorm ( ) 
828+     } 
831829
832830    fn  q_nan ( )  -> f16  { 
833831        f16:: from_bits ( f16:: NAN . to_bits ( )  | quiet_bit_mask ( ) ) 
@@ -846,12 +844,12 @@ fn test_total_cmp() {
846844    assert_eq ! ( Ordering :: Equal ,  ( -1.5_f16 ) . total_cmp( & -1.5 ) ) ; 
847845    assert_eq ! ( Ordering :: Equal ,  ( -0.5_f16 ) . total_cmp( & -0.5 ) ) ; 
848846    assert_eq ! ( Ordering :: Equal ,  ( -f16:: MIN_POSITIVE ) . total_cmp( & -f16:: MIN_POSITIVE ) ) ; 
849-     //  assert_eq!(Ordering::Equal, (-max_subnorm()).total_cmp(&-max_subnorm()));
850-     //  assert_eq!(Ordering::Equal, (-min_subnorm()).total_cmp(&-min_subnorm()));
847+     assert_eq ! ( Ordering :: Equal ,  ( -max_subnorm( ) ) . total_cmp( & -max_subnorm( ) ) ) ; 
848+     assert_eq ! ( Ordering :: Equal ,  ( -min_subnorm( ) ) . total_cmp( & -min_subnorm( ) ) ) ; 
851849    assert_eq ! ( Ordering :: Equal ,  ( -0.0_f16 ) . total_cmp( & -0.0 ) ) ; 
852850    assert_eq ! ( Ordering :: Equal ,  0.0_f16 . total_cmp( & 0.0 ) ) ; 
853-     //  assert_eq!(Ordering::Equal, min_subnorm().total_cmp(&min_subnorm()));
854-     //  assert_eq!(Ordering::Equal, max_subnorm().total_cmp(&max_subnorm()));
851+     assert_eq ! ( Ordering :: Equal ,  min_subnorm( ) . total_cmp( & min_subnorm( ) ) ) ; 
852+     assert_eq ! ( Ordering :: Equal ,  max_subnorm( ) . total_cmp( & max_subnorm( ) ) ) ; 
855853    assert_eq ! ( Ordering :: Equal ,  f16:: MIN_POSITIVE . total_cmp( & f16:: MIN_POSITIVE ) ) ; 
856854    assert_eq ! ( Ordering :: Equal ,  0.5_f16 . total_cmp( & 0.5 ) ) ; 
857855    assert_eq ! ( Ordering :: Equal ,  1.0_f16 . total_cmp( & 1.0 ) ) ; 
@@ -870,13 +868,13 @@ fn test_total_cmp() {
870868    assert_eq ! ( Ordering :: Less ,  ( -1.5_f16 ) . total_cmp( & -1.0 ) ) ; 
871869    assert_eq ! ( Ordering :: Less ,  ( -1.0_f16 ) . total_cmp( & -0.5 ) ) ; 
872870    assert_eq ! ( Ordering :: Less ,  ( -0.5_f16 ) . total_cmp( & -f16:: MIN_POSITIVE ) ) ; 
873-     //  assert_eq!(Ordering::Less, (-f16::MIN_POSITIVE).total_cmp(&-max_subnorm()));
874-     //  assert_eq!(Ordering::Less, (-max_subnorm()).total_cmp(&-min_subnorm()));
875-     //  assert_eq!(Ordering::Less, (-min_subnorm()).total_cmp(&-0.0));
871+     assert_eq ! ( Ordering :: Less ,  ( -f16:: MIN_POSITIVE ) . total_cmp( & -max_subnorm( ) ) ) ; 
872+     assert_eq ! ( Ordering :: Less ,  ( -max_subnorm( ) ) . total_cmp( & -min_subnorm( ) ) ) ; 
873+     assert_eq ! ( Ordering :: Less ,  ( -min_subnorm( ) ) . total_cmp( & -0.0 ) ) ; 
876874    assert_eq ! ( Ordering :: Less ,  ( -0.0_f16 ) . total_cmp( & 0.0 ) ) ; 
877-     //  assert_eq!(Ordering::Less, 0.0_f16.total_cmp(&min_subnorm()));
878-     //  assert_eq!(Ordering::Less, min_subnorm().total_cmp(&max_subnorm()));
879-     //  assert_eq!(Ordering::Less, max_subnorm().total_cmp(&f16::MIN_POSITIVE));
875+     assert_eq ! ( Ordering :: Less ,  0.0_f16 . total_cmp( & min_subnorm( ) ) ) ; 
876+     assert_eq ! ( Ordering :: Less ,  min_subnorm( ) . total_cmp( & max_subnorm( ) ) ) ; 
877+     assert_eq ! ( Ordering :: Less ,  max_subnorm( ) . total_cmp( & f16:: MIN_POSITIVE ) ) ; 
880878    assert_eq ! ( Ordering :: Less ,  f16:: MIN_POSITIVE . total_cmp( & 0.5 ) ) ; 
881879    assert_eq ! ( Ordering :: Less ,  0.5_f16 . total_cmp( & 1.0 ) ) ; 
882880    assert_eq ! ( Ordering :: Less ,  1.0_f16 . total_cmp( & 1.5 ) ) ; 
@@ -894,13 +892,13 @@ fn test_total_cmp() {
894892    assert_eq ! ( Ordering :: Greater ,  ( -1.0_f16 ) . total_cmp( & -1.5 ) ) ; 
895893    assert_eq ! ( Ordering :: Greater ,  ( -0.5_f16 ) . total_cmp( & -1.0 ) ) ; 
896894    assert_eq ! ( Ordering :: Greater ,  ( -f16:: MIN_POSITIVE ) . total_cmp( & -0.5 ) ) ; 
897-     //  assert_eq!(Ordering::Greater, (-max_subnorm()).total_cmp(&-f16::MIN_POSITIVE));
898-     //  assert_eq!(Ordering::Greater, (-min_subnorm()).total_cmp(&-max_subnorm()));
899-     //  assert_eq!(Ordering::Greater, (-0.0_f16).total_cmp(&-min_subnorm()));
895+     assert_eq ! ( Ordering :: Greater ,  ( -max_subnorm( ) ) . total_cmp( & -f16:: MIN_POSITIVE ) ) ; 
896+     assert_eq ! ( Ordering :: Greater ,  ( -min_subnorm( ) ) . total_cmp( & -max_subnorm( ) ) ) ; 
897+     assert_eq ! ( Ordering :: Greater ,  ( -0.0_f16 ) . total_cmp( & -min_subnorm( ) ) ) ; 
900898    assert_eq ! ( Ordering :: Greater ,  0.0_f16 . total_cmp( & -0.0 ) ) ; 
901-     //  assert_eq!(Ordering::Greater, min_subnorm().total_cmp(&0.0));
902-     //  assert_eq!(Ordering::Greater, max_subnorm().total_cmp(&min_subnorm()));
903-     //  assert_eq!(Ordering::Greater, f16::MIN_POSITIVE.total_cmp(&max_subnorm()));
899+     assert_eq ! ( Ordering :: Greater ,  min_subnorm( ) . total_cmp( & 0.0 ) ) ; 
900+     assert_eq ! ( Ordering :: Greater ,  max_subnorm( ) . total_cmp( & min_subnorm( ) ) ) ; 
901+     assert_eq ! ( Ordering :: Greater ,  f16:: MIN_POSITIVE . total_cmp( & max_subnorm( ) ) ) ; 
904902    assert_eq ! ( Ordering :: Greater ,  0.5_f16 . total_cmp( & f16:: MIN_POSITIVE ) ) ; 
905903    assert_eq ! ( Ordering :: Greater ,  1.0_f16 . total_cmp( & 0.5 ) ) ; 
906904    assert_eq ! ( Ordering :: Greater ,  1.5_f16 . total_cmp( & 1.0 ) ) ; 
@@ -918,12 +916,12 @@ fn test_total_cmp() {
918916    assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & -1.0 ) ) ; 
919917    assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & -0.5 ) ) ; 
920918    assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & -f16:: MIN_POSITIVE ) ) ; 
921-     //  assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-max_subnorm()));
922-     //  assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-min_subnorm()));
919+     assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & -max_subnorm( ) ) ) ; 
920+     assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & -min_subnorm( ) ) ) ; 
923921    assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & -0.0 ) ) ; 
924922    assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & 0.0 ) ) ; 
925-     //  assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&min_subnorm()));
926-     //  assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&max_subnorm()));
923+     assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & min_subnorm( ) ) ) ; 
924+     assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & max_subnorm( ) ) ) ; 
927925    assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & f16:: MIN_POSITIVE ) ) ; 
928926    assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & 0.5 ) ) ; 
929927    assert_eq ! ( Ordering :: Less ,  ( -q_nan( ) ) . total_cmp( & 1.0 ) ) ; 
@@ -940,12 +938,12 @@ fn test_total_cmp() {
940938    assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & -1.0 ) ) ; 
941939    assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & -0.5 ) ) ; 
942940    assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & -f16:: MIN_POSITIVE ) ) ; 
943-     //  assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-max_subnorm()));
944-     //  assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-min_subnorm()));
941+     assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & -max_subnorm( ) ) ) ; 
942+     assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & -min_subnorm( ) ) ) ; 
945943    assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & -0.0 ) ) ; 
946944    assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & 0.0 ) ) ; 
947-     //  assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&min_subnorm()));
948-     //  assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&max_subnorm()));
945+     assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & min_subnorm( ) ) ) ; 
946+     assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & max_subnorm( ) ) ) ; 
949947    assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & f16:: MIN_POSITIVE ) ) ; 
950948    assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & 0.5 ) ) ; 
951949    assert_eq ! ( Ordering :: Less ,  ( -s_nan( ) ) . total_cmp( & 1.0 ) ) ; 
0 commit comments