@@ -162,8 +162,10 @@ pub struct TargetDataLayout {
162162 pub i32_align : AbiAndPrefAlign ,
163163 pub i64_align : AbiAndPrefAlign ,
164164 pub i128_align : AbiAndPrefAlign ,
165+ pub f16_align : AbiAndPrefAlign ,
165166 pub f32_align : AbiAndPrefAlign ,
166167 pub f64_align : AbiAndPrefAlign ,
168+ pub f128_align : AbiAndPrefAlign ,
167169 pub pointer_size : Size ,
168170 pub pointer_align : AbiAndPrefAlign ,
169171 pub aggregate_align : AbiAndPrefAlign ,
@@ -191,8 +193,10 @@ impl Default for TargetDataLayout {
191193 i32_align : AbiAndPrefAlign :: new ( align ( 32 ) ) ,
192194 i64_align : AbiAndPrefAlign { abi : align ( 32 ) , pref : align ( 64 ) } ,
193195 i128_align : AbiAndPrefAlign { abi : align ( 32 ) , pref : align ( 64 ) } ,
196+ f16_align : AbiAndPrefAlign :: new ( align ( 16 ) ) ,
194197 f32_align : AbiAndPrefAlign :: new ( align ( 32 ) ) ,
195198 f64_align : AbiAndPrefAlign :: new ( align ( 64 ) ) ,
199+ f128_align : AbiAndPrefAlign :: new ( align ( 128 ) ) ,
196200 pointer_size : Size :: from_bits ( 64 ) ,
197201 pointer_align : AbiAndPrefAlign :: new ( align ( 64 ) ) ,
198202 aggregate_align : AbiAndPrefAlign { abi : align ( 0 ) , pref : align ( 64 ) } ,
@@ -270,8 +274,10 @@ impl TargetDataLayout {
270274 dl. instruction_address_space = parse_address_space ( & p[ 1 ..] , "P" ) ?
271275 }
272276 [ "a" , ref a @ ..] => dl. aggregate_align = align ( a, "a" ) ?,
277+ [ "f16" , ref a @ ..] => dl. f32_align = align ( a, "f16" ) ?,
273278 [ "f32" , ref a @ ..] => dl. f32_align = align ( a, "f32" ) ?,
274279 [ "f64" , ref a @ ..] => dl. f64_align = align ( a, "f64" ) ?,
280+ [ "f128" , ref a @ ..] => dl. f32_align = align ( a, "f128" ) ?,
275281 // FIXME(erikdesjardins): we should be parsing nonzero address spaces
276282 // this will require replacing TargetDataLayout::{pointer_size,pointer_align}
277283 // with e.g. `fn pointer_size_in(AddressSpace)`
@@ -901,8 +907,10 @@ pub enum Primitive {
901907 /// a negative integer passed by zero-extension will appear positive in
902908 /// the callee, and most operations on it will produce the wrong values.
903909 Int ( Integer , bool ) ,
910+ F16 ,
904911 F32 ,
905912 F64 ,
913+ F128 ,
906914 Pointer ( AddressSpace ) ,
907915}
908916
@@ -912,8 +920,10 @@ impl Primitive {
912920
913921 match self {
914922 Int ( i, _) => i. size ( ) ,
923+ F16 => Size :: from_bits ( 16 ) ,
915924 F32 => Size :: from_bits ( 32 ) ,
916925 F64 => Size :: from_bits ( 64 ) ,
926+ F128 => Size :: from_bits ( 128 ) ,
917927 // FIXME(erikdesjardins): ignoring address space is technically wrong, pointers in
918928 // different address spaces can have different sizes
919929 // (but TargetDataLayout doesn't currently parse that part of the DL string)
@@ -926,8 +936,10 @@ impl Primitive {
926936
927937 match self {
928938 Int ( i, _) => i. align ( dl) ,
939+ F16 => dl. f16_align ,
929940 F32 => dl. f32_align ,
930941 F64 => dl. f64_align ,
942+ F128 => dl. f128_align ,
931943 // FIXME(erikdesjardins): ignoring address space is technically wrong, pointers in
932944 // different address spaces can have different alignments
933945 // (but TargetDataLayout doesn't currently parse that part of the DL string)
0 commit comments