Skip to content

Commit 2eaac23

Browse files
author
Robert Zakrzewski
committed
Refactor type_f16|32|128 functions. Common type_kind()
fix
1 parent 55788e4 commit 2eaac23

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

src/type_.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -125,47 +125,32 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
125125
self.isize_type
126126
}
127127

128-
#[cfg(feature = "master")]
129128
fn type_f16(&self) -> Type<'gcc> {
129+
#[cfg(feature = "master")]
130130
if self.supports_f16_type {
131131
return self.context.new_c_type(CType::Float16);
132132
}
133-
unimplemented!("f16")
134-
}
135-
136-
#[cfg(not(feature = "master"))]
137-
fn type_f16(&self) -> Type<'gcc> {
138-
unimplemented!("f16")
133+
bug!("unsupported float width 16")
139134
}
140135

141-
#[cfg(feature = "master")]
142136
fn type_f32(&self) -> Type<'gcc> {
137+
#[cfg(feature = "master")]
143138
if self.supports_f32_type {
144139
return self.context.new_c_type(CType::Float32);
145140
}
146141
self.float_type
147142
}
148143

149-
#[cfg(not(feature = "master"))]
150-
fn type_f32(&self) -> Type<'gcc> {
151-
self.float_type
152-
}
153-
154144
fn type_f64(&self) -> Type<'gcc> {
155145
self.double_type
156146
}
157147

158-
#[cfg(feature = "master")]
159148
fn type_f128(&self) -> Type<'gcc> {
149+
#[cfg(feature = "master")]
160150
if self.supports_f128_type {
161151
return self.context.new_c_type(CType::Float128);
162152
}
163-
unimplemented!("f128")
164-
}
165-
166-
#[cfg(not(feature = "master"))]
167-
fn type_f128(&self) -> Type<'gcc> {
168-
unimplemented!("f128")
153+
bug!("unsupported float width 128")
169154
}
170155

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

0 commit comments

Comments
 (0)