1
Fork 0

Fix assertion when attempting to convert f16 and f128 with as

These types are currently rejected for `as` casts by the compiler.
Remove this incorrect check and add codegen tests for all conversions
involving these types.
This commit is contained in:
Trevor Gross 2024-05-16 04:05:34 -05:00
parent b71e8cbaf2
commit 488ddd3bbc
3 changed files with 397 additions and 4 deletions

View file

@ -247,7 +247,10 @@ pub trait BuilderMethods<'a, 'tcx>:
} else {
(in_ty, dest_ty)
};
assert!(matches!(self.cx().type_kind(float_ty), TypeKind::Float | TypeKind::Double));
assert!(matches!(
self.cx().type_kind(float_ty),
TypeKind::Half | TypeKind::Float | TypeKind::Double | TypeKind::FP128
));
assert_eq!(self.cx().type_kind(int_ty), TypeKind::Integer);
if let Some(false) = self.cx().sess().opts.unstable_opts.saturating_float_casts {