@@ -119,10 +119,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
119
119
let op = op. to_scalar ( ) ;
120
120
// "Bitwise" operation, no NaN adjustments
121
121
match float_ty {
122
- FloatTy :: F16 => unimplemented ! ( "f16_f128" ) ,
122
+ FloatTy :: F16 => Scalar :: from_f16 ( op . to_f16 ( ) ? . abs ( ) ) ,
123
123
FloatTy :: F32 => Scalar :: from_f32 ( op. to_f32 ( ) ?. abs ( ) ) ,
124
124
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 ( ) ) ,
126
126
}
127
127
}
128
128
Op :: Round ( rounding) => {
@@ -133,21 +133,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
133
133
intrinsic_name
134
134
)
135
135
} ;
136
+ let op = op. to_scalar ( ) ;
136
137
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) ?) ,
151
142
}
152
143
}
153
144
Op :: Numeric ( name) => {
@@ -724,10 +715,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
724
715
} ;
725
716
726
717
let val = match float_ty {
727
- FloatTy :: F16 => unimplemented ! ( "f16_f128" ) ,
718
+ FloatTy :: F16 => Scalar :: from_f16 ( self . float_muladd ( a , b , c , typ ) ? ) ,
728
719
FloatTy :: F32 => Scalar :: from_f32 ( self . float_muladd ( a, b, c, typ) ?) ,
729
720
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 ) ? ) ,
731
722
} ;
732
723
self . write_scalar ( val, & dest) ?;
733
724
}
0 commit comments