@@ -162,8 +162,10 @@ pub struct TargetDataLayout {
162
162
pub i32_align : AbiAndPrefAlign ,
163
163
pub i64_align : AbiAndPrefAlign ,
164
164
pub i128_align : AbiAndPrefAlign ,
165
+ pub f16_align : AbiAndPrefAlign ,
165
166
pub f32_align : AbiAndPrefAlign ,
166
167
pub f64_align : AbiAndPrefAlign ,
168
+ pub f128_align : AbiAndPrefAlign ,
167
169
pub pointer_size : Size ,
168
170
pub pointer_align : AbiAndPrefAlign ,
169
171
pub aggregate_align : AbiAndPrefAlign ,
@@ -191,8 +193,10 @@ impl Default for TargetDataLayout {
191
193
i32_align : AbiAndPrefAlign :: new ( align ( 32 ) ) ,
192
194
i64_align : AbiAndPrefAlign { abi : align ( 32 ) , pref : align ( 64 ) } ,
193
195
i128_align : AbiAndPrefAlign { abi : align ( 32 ) , pref : align ( 64 ) } ,
196
+ f16_align : AbiAndPrefAlign :: new ( align ( 16 ) ) ,
194
197
f32_align : AbiAndPrefAlign :: new ( align ( 32 ) ) ,
195
198
f64_align : AbiAndPrefAlign :: new ( align ( 64 ) ) ,
199
+ f128_align : AbiAndPrefAlign :: new ( align ( 128 ) ) ,
196
200
pointer_size : Size :: from_bits ( 64 ) ,
197
201
pointer_align : AbiAndPrefAlign :: new ( align ( 64 ) ) ,
198
202
aggregate_align : AbiAndPrefAlign { abi : align ( 0 ) , pref : align ( 64 ) } ,
@@ -270,8 +274,10 @@ impl TargetDataLayout {
270
274
dl. instruction_address_space = parse_address_space ( & p[ 1 ..] , "P" ) ?
271
275
}
272
276
[ "a" , ref a @ ..] => dl. aggregate_align = align ( a, "a" ) ?,
277
+ [ "f16" , ref a @ ..] => dl. f32_align = align ( a, "f16" ) ?,
273
278
[ "f32" , ref a @ ..] => dl. f32_align = align ( a, "f32" ) ?,
274
279
[ "f64" , ref a @ ..] => dl. f64_align = align ( a, "f64" ) ?,
280
+ [ "f128" , ref a @ ..] => dl. f32_align = align ( a, "f128" ) ?,
275
281
// FIXME(erikdesjardins): we should be parsing nonzero address spaces
276
282
// this will require replacing TargetDataLayout::{pointer_size,pointer_align}
277
283
// with e.g. `fn pointer_size_in(AddressSpace)`
@@ -901,8 +907,10 @@ pub enum Primitive {
901
907
/// a negative integer passed by zero-extension will appear positive in
902
908
/// the callee, and most operations on it will produce the wrong values.
903
909
Int ( Integer , bool ) ,
910
+ F16 ,
904
911
F32 ,
905
912
F64 ,
913
+ F128 ,
906
914
Pointer ( AddressSpace ) ,
907
915
}
908
916
@@ -912,8 +920,10 @@ impl Primitive {
912
920
913
921
match self {
914
922
Int ( i, _) => i. size ( ) ,
923
+ F16 => Size :: from_bits ( 16 ) ,
915
924
F32 => Size :: from_bits ( 32 ) ,
916
925
F64 => Size :: from_bits ( 64 ) ,
926
+ F128 => Size :: from_bits ( 128 ) ,
917
927
// FIXME(erikdesjardins): ignoring address space is technically wrong, pointers in
918
928
// different address spaces can have different sizes
919
929
// (but TargetDataLayout doesn't currently parse that part of the DL string)
@@ -926,8 +936,10 @@ impl Primitive {
926
936
927
937
match self {
928
938
Int ( i, _) => i. align ( dl) ,
939
+ F16 => dl. f16_align ,
929
940
F32 => dl. f32_align ,
930
941
F64 => dl. f64_align ,
942
+ F128 => dl. f128_align ,
931
943
// FIXME(erikdesjardins): ignoring address space is technically wrong, pointers in
932
944
// different address spaces can have different alignments
933
945
// (but TargetDataLayout doesn't currently parse that part of the DL string)
0 commit comments