@@ -119,10 +119,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
119119 let op = op. to_scalar ( ) ;
120120 // "Bitwise" operation, no NaN adjustments
121121 match float_ty {
122- FloatTy :: F16 => unimplemented ! ( "f16_f128" ) ,
122+ FloatTy :: F16 => Scalar :: from_f16 ( op . to_f16 ( ) ? . abs ( ) ) ,
123123 FloatTy :: F32 => Scalar :: from_f32 ( op. to_f32 ( ) ?. abs ( ) ) ,
124124 FloatTy :: F64 => Scalar :: from_f64 ( op. to_f64 ( ) ?. abs ( ) ) ,
125- FloatTy :: F128 => unimplemented ! ( "f16_f128" ) ,
125+ FloatTy :: F128 => Scalar :: from_f128 ( op . to_f128 ( ) ? . abs ( ) ) ,
126126 }
127127 }
128128 Op :: Round ( rounding) => {
@@ -133,21 +133,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
133133 intrinsic_name
134134 )
135135 } ;
136+ let op = op. to_scalar ( ) ;
136137 match float_ty {
137- FloatTy :: F16 => unimplemented ! ( "f16_f128" ) ,
138- FloatTy :: F32 => {
139- let f = op. to_scalar ( ) . to_f32 ( ) ?;
140- let res = f. round_to_integral ( rounding) . value ;
141- let res = self . adjust_nan ( res, & [ f] ) ;
142- Scalar :: from_f32 ( res)
143- }
144- FloatTy :: F64 => {
145- let f = op. to_scalar ( ) . to_f64 ( ) ?;
146- let res = f. round_to_integral ( rounding) . value ;
147- let res = self . adjust_nan ( res, & [ f] ) ;
148- Scalar :: from_f64 ( res)
149- }
150- FloatTy :: F128 => unimplemented ! ( "f16_f128" ) ,
138+ FloatTy :: F16 => Scalar :: from_f16 ( self . float_round ( op, rounding) ?) ,
139+ FloatTy :: F32 => Scalar :: from_f32 ( self . float_round ( op, rounding) ?) ,
140+ FloatTy :: F64 => Scalar :: from_f64 ( self . float_round ( op, rounding) ?) ,
141+ FloatTy :: F128 => Scalar :: from_f128 ( self . float_round ( op, rounding) ?) ,
151142 }
152143 }
153144 Op :: Numeric ( name) => {
@@ -724,10 +715,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
724715 } ;
725716
726717 let val = match float_ty {
727- FloatTy :: F16 => unimplemented ! ( "f16_f128" ) ,
718+ FloatTy :: F16 => Scalar :: from_f16 ( self . float_muladd ( a , b , c , typ ) ? ) ,
728719 FloatTy :: F32 => Scalar :: from_f32 ( self . float_muladd ( a, b, c, typ) ?) ,
729720 FloatTy :: F64 => Scalar :: from_f64 ( self . float_muladd ( a, b, c, typ) ?) ,
730- FloatTy :: F128 => unimplemented ! ( "f16_f128" ) ,
721+ FloatTy :: F128 => Scalar :: from_f128 ( self . float_muladd ( a , b , c , typ ) ? ) ,
731722 } ;
732723 self . write_scalar ( val, & dest) ?;
733724 }
0 commit comments