about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Zakrzewski <robert.zakrzewski1@stellantis.com>2024-06-21 16:42:21 +0200
committerRobert Zakrzewski <robert.zakrzewski1@stellantis.com>2024-06-21 17:21:46 +0200
commit2eaac2388d6172922d0b8ac62979ff4fa6a2355c (patch)
tree54c701c911fd9f0e3cebbefbeb6ff4d039eb0734
parent55788e4a92fee3521fa9eb1eba1bbfbe27564e9d (diff)
downloadrust-2eaac2388d6172922d0b8ac62979ff4fa6a2355c.tar.gz
rust-2eaac2388d6172922d0b8ac62979ff4fa6a2355c.zip
Refactor type_f16|32|128 functions. Common type_kind()
fix
-rw-r--r--src/type_.rs25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/type_.rs b/src/type_.rs
index 7bcc71e581d..eaa16c44897 100644
--- a/src/type_.rs
+++ b/src/type_.rs
@@ -125,47 +125,32 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
         self.isize_type
     }
 
-    #[cfg(feature = "master")]
     fn type_f16(&self) -> Type<'gcc> {
+        #[cfg(feature = "master")]
         if self.supports_f16_type {
             return self.context.new_c_type(CType::Float16);
         }
-        unimplemented!("f16")
-    }
-
-    #[cfg(not(feature = "master"))]
-    fn type_f16(&self) -> Type<'gcc> {
-        unimplemented!("f16")
+        bug!("unsupported float width 16")
     }
 
-    #[cfg(feature = "master")]
     fn type_f32(&self) -> Type<'gcc> {
+        #[cfg(feature = "master")]
         if self.supports_f32_type {
             return self.context.new_c_type(CType::Float32);
         }
         self.float_type
     }
 
-    #[cfg(not(feature = "master"))]
-    fn type_f32(&self) -> Type<'gcc> {
-        self.float_type
-    }
-
     fn type_f64(&self) -> Type<'gcc> {
         self.double_type
     }
 
-    #[cfg(feature = "master")]
     fn type_f128(&self) -> Type<'gcc> {
+        #[cfg(feature = "master")]
         if self.supports_f128_type {
             return self.context.new_c_type(CType::Float128);
         }
-        unimplemented!("f128")
-    }
-
-    #[cfg(not(feature = "master"))]
-    fn type_f128(&self) -> Type<'gcc> {
-        unimplemented!("f128")
+        bug!("unsupported float width 128")
     }
 
     fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> {