Add f16
and f128
to rustc_type_ir::FloatTy
and rustc_abi::Primitive
Make changes necessary to support these types in the compiler.
This commit is contained in:
parent
ef324565d0
commit
e3f63d9375
31 changed files with 107 additions and 14 deletions
|
@ -1053,6 +1053,7 @@ pub(crate) fn parse_float_into_scalar(
|
|||
) -> Option<Scalar> {
|
||||
let num = num.as_str();
|
||||
match float_ty {
|
||||
ty::FloatTy::F16 => unimplemented!("f16_f128"),
|
||||
ty::FloatTy::F32 => {
|
||||
let Ok(rust_f) = num.parse::<f32>() else { return None };
|
||||
let mut f = num
|
||||
|
@ -1099,6 +1100,7 @@ pub(crate) fn parse_float_into_scalar(
|
|||
|
||||
Some(Scalar::from_f64(f))
|
||||
}
|
||||
ty::FloatTy::F128 => unimplemented!("f16_f128"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -442,8 +442,10 @@ impl<'tcx> ConstToPat<'tcx> {
|
|||
ty::Float(flt) => {
|
||||
let v = cv.unwrap_leaf();
|
||||
let is_nan = match flt {
|
||||
ty::FloatTy::F16 => unimplemented!("f16_f128"),
|
||||
ty::FloatTy::F32 => v.try_to_f32().unwrap().is_nan(),
|
||||
ty::FloatTy::F64 => v.try_to_f64().unwrap().is_nan(),
|
||||
ty::FloatTy::F128 => unimplemented!("f16_f128"),
|
||||
};
|
||||
if is_nan {
|
||||
// NaNs are not ever equal to anything so they make no sense as patterns.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue