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
b4b180c218
commit
8dd96baddf
10
src/type_.rs
10
src/type_.rs
@ -83,8 +83,10 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
|||||||
|
|
||||||
pub fn type_float_from_ty(&self, t: ty::FloatTy) -> Type<'gcc> {
|
pub fn type_float_from_ty(&self, t: ty::FloatTy) -> Type<'gcc> {
|
||||||
match t {
|
match t {
|
||||||
|
ty::FloatTy::F16 => self.type_f16(),
|
||||||
ty::FloatTy::F32 => self.type_f32(),
|
ty::FloatTy::F32 => self.type_f32(),
|
||||||
ty::FloatTy::F64 => self.type_f64(),
|
ty::FloatTy::F64 => self.type_f64(),
|
||||||
|
ty::FloatTy::F128 => self.type_f128(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,6 +120,10 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
|||||||
self.isize_type
|
self.isize_type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn type_f16(&self) -> Type<'gcc> {
|
||||||
|
unimplemented!("f16_f128")
|
||||||
|
}
|
||||||
|
|
||||||
fn type_f32(&self) -> Type<'gcc> {
|
fn type_f32(&self) -> Type<'gcc> {
|
||||||
self.float_type
|
self.float_type
|
||||||
}
|
}
|
||||||
@ -125,6 +131,10 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
|||||||
fn type_f64(&self) -> Type<'gcc> {
|
fn type_f64(&self) -> Type<'gcc> {
|
||||||
self.double_type
|
self.double_type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn type_f128(&self) -> Type<'gcc> {
|
||||||
|
unimplemented!("f16_f128")
|
||||||
|
}
|
||||||
|
|
||||||
fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> {
|
fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> {
|
||||||
self.context.new_function_pointer_type(None, return_type, params, false)
|
self.context.new_function_pointer_type(None, return_type, params, false)
|
||||||
|
@ -6,7 +6,7 @@ use rustc_middle::bug;
|
|||||||
use rustc_middle::ty::{self, Ty, TypeVisitableExt};
|
use rustc_middle::ty::{self, Ty, TypeVisitableExt};
|
||||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||||
use rustc_target::abi::{self, Abi, Align, F32, F64, FieldsShape, Int, Integer, Pointer, PointeeInfo, Size, TyAbiInterface, Variants};
|
use rustc_target::abi::{self, Abi, Align, F16, F128, F32, F64, FieldsShape, Int, Integer, Pointer, PointeeInfo, Size, TyAbiInterface, Variants};
|
||||||
use rustc_target::abi::call::{CastTarget, FnAbi, Reg};
|
use rustc_target::abi::call::{CastTarget, FnAbi, Reg};
|
||||||
|
|
||||||
use crate::abi::{FnAbiGcc, FnAbiGccExt, GccType};
|
use crate::abi::{FnAbiGcc, FnAbiGccExt, GccType};
|
||||||
@ -257,8 +257,10 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
|
|||||||
match scalar.primitive() {
|
match scalar.primitive() {
|
||||||
Int(i, true) => cx.type_from_integer(i),
|
Int(i, true) => cx.type_from_integer(i),
|
||||||
Int(i, false) => cx.type_from_unsigned_integer(i),
|
Int(i, false) => cx.type_from_unsigned_integer(i),
|
||||||
|
F16 => cx.type_f16(),
|
||||||
F32 => cx.type_f32(),
|
F32 => cx.type_f32(),
|
||||||
F64 => cx.type_f64(),
|
F64 => cx.type_f64(),
|
||||||
|
F128 => cx.type_f128(),
|
||||||
Pointer(address_space) => {
|
Pointer(address_space) => {
|
||||||
// If we know the alignment, pick something better than i8.
|
// If we know the alignment, pick something better than i8.
|
||||||
let pointee =
|
let pointee =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user