Skip to content

Commit eae902f

Browse files
committed
Auto merge of #121728 - tgross35:f16-f128-step1-ty-updates, r=compiler-errors
Add stubs in IR and ABI for `f16` and `f128` This is the very first step toward the changes in rust-lang/rust#114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary. These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`. The next steps will probably be AST support with parsing and the feature gate. r? `@compiler-errors` cc `@Nilstrieb` suggested breaking the PR up in rust-lang/rust#120645 (comment)
2 parents 7c6387a + 8daaa10 commit eae902f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/common.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ pub(crate) fn scalar_to_clif_type(tcx: TyCtxt<'_>, scalar: Scalar) -> Type {
3333
Integer::I64 => types::I64,
3434
Integer::I128 => types::I128,
3535
},
36+
Primitive::F16 => unimplemented!("f16_f128"),
3637
Primitive::F32 => types::F32,
3738
Primitive::F64 => types::F64,
39+
Primitive::F128 => unimplemented!("f16_f128"),
3840
// FIXME(erikdesjardins): handle non-default addrspace ptr sizes
3941
Primitive::Pointer(_) => pointer_ty(tcx),
4042
}
@@ -61,8 +63,10 @@ fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Typ
6163
},
6264
ty::Char => types::I32,
6365
ty::Float(size) => match size {
66+
FloatTy::F16 => unimplemented!("f16_f128"),
6467
FloatTy::F32 => types::F32,
6568
FloatTy::F64 => types::F64,
69+
FloatTy::F128 => unimplemented!("f16_f128"),
6670
},
6771
ty::FnPtr(_) => pointer_ty(tcx),
6872
ty::RawPtr(TypeAndMut { ty: pointee_ty, mutbl: _ }) | ty::Ref(_, pointee_ty, _) => {

0 commit comments

Comments
 (0)