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
|
@ -303,15 +303,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
self.assume_scalar_range(bx, imm, from_scalar, from_backend_ty);
|
||||
|
||||
imm = match (from_scalar.primitive(), to_scalar.primitive()) {
|
||||
(Int(..) | F32 | F64, Int(..) | F32 | F64) => bx.bitcast(imm, to_backend_ty),
|
||||
(Int(..) | F16 | F32 | F64 | F128, Int(..) | F16 | F32 | F64 | F128) => {
|
||||
bx.bitcast(imm, to_backend_ty)
|
||||
}
|
||||
(Pointer(..), Pointer(..)) => bx.pointercast(imm, to_backend_ty),
|
||||
(Int(..), Pointer(..)) => bx.inttoptr(imm, to_backend_ty),
|
||||
(Pointer(..), Int(..)) => bx.ptrtoint(imm, to_backend_ty),
|
||||
(F32 | F64, Pointer(..)) => {
|
||||
(F16 | F32 | F64 | F128, Pointer(..)) => {
|
||||
let int_imm = bx.bitcast(imm, bx.cx().type_isize());
|
||||
bx.inttoptr(int_imm, to_backend_ty)
|
||||
}
|
||||
(Pointer(..), F32 | F64) => {
|
||||
(Pointer(..), F16 | F32 | F64 | F128) => {
|
||||
let int_imm = bx.ptrtoint(imm, bx.cx().type_isize());
|
||||
bx.bitcast(int_imm, to_backend_ty)
|
||||
}
|
||||
|
|
|
@ -19,8 +19,10 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
|
|||
fn type_i128(&self) -> Self::Type;
|
||||
fn type_isize(&self) -> Self::Type;
|
||||
|
||||
fn type_f16(&self) -> Self::Type;
|
||||
fn type_f32(&self) -> Self::Type;
|
||||
fn type_f64(&self) -> Self::Type;
|
||||
fn type_f128(&self) -> Self::Type;
|
||||
|
||||
fn type_array(&self, ty: Self::Type, len: u64) -> Self::Type;
|
||||
fn type_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::Type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue