Skip to content

Commit 46eea99

Browse files
author
Robert Zakrzewski
committed
Add support for Float16, Float32, Float64 and Float128
Upgrade libgccjit.version Limit new Floatxx types to master branch only apply rustfmt Make new types available only when requested Make new types available only when requested
1 parent 8692192 commit 46eea99

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libgccjit.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b6f163f52
1+
ab469a6daaed9f4191ac8c32894b3f44d78b2ba5

src/type_.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use gccjit::{RValue, Struct, Type};
1+
use gccjit::{CType, RValue, Struct, Type};
22
use rustc_codegen_ssa::common::TypeKind;
33
use rustc_codegen_ssa::traits::{BaseTypeMethods, DerivedTypeMethods, TypeMembershipMethods};
44
use rustc_middle::ty::layout::TyAndLayout;
@@ -120,8 +120,14 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
120120
self.isize_type
121121
}
122122

123+
#[cfg(feature = "master")]
123124
fn type_f16(&self) -> Type<'gcc> {
124-
unimplemented!("f16_f128")
125+
self.context.new_c_type(CType::Float16)
126+
}
127+
128+
#[cfg(not(feature = "master"))]
129+
fn type_f16(&self) -> Type<'gcc> {
130+
unimplemented!("f16")
125131
}
126132

127133
fn type_f32(&self) -> Type<'gcc> {
@@ -132,8 +138,14 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
132138
self.double_type
133139
}
134140

141+
#[cfg(feature = "master")]
142+
fn type_f128(&self) -> Type<'gcc> {
143+
self.context.new_c_type(CType::Float128)
144+
}
145+
146+
#[cfg(not(feature = "master"))]
135147
fn type_f128(&self) -> Type<'gcc> {
136-
unimplemented!("f16_f128")
148+
unimplemented!("f128")
137149
}
138150

139151
fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> {

0 commit comments

Comments
 (0)