diff options
| author | Trevor Gross <tmgross@umich.edu> | 2024-02-28 03:44:23 -0500 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2024-02-28 12:58:32 -0500 |
| commit | e3f63d93755f2f62b4a52686f608b9664e87f092 (patch) | |
| tree | 6d29765020fdfbd6bd2d049b5079baa83c4a4382 /compiler/rustc_mir_build/src | |
| parent | ef324565d071c6d7e2477a195648549e33d6a465 (diff) | |
| download | rust-e3f63d93755f2f62b4a52686f608b9664e87f092.tar.gz rust-e3f63d93755f2f62b4a52686f608b9664e87f092.zip | |
Add `f16` and `f128` to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`
Make changes necessary to support these types in the compiler.
Diffstat (limited to 'compiler/rustc_mir_build/src')
| -rw-r--r-- | compiler/rustc_mir_build/src/build/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index 2b1a9fef360..294b27def16 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -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"), } } diff --git a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs index 09727f9b71b..ce39aff69cb 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs @@ -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. |
