diff options
| author | gingerBill <bill@gingerbill.org> | 2022-08-24 12:58:16 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-08-24 12:58:16 +0100 |
| commit | 4ba486baa2d1414393dff0d7ddaff777f4592cbd (patch) | |
| tree | 33946e0c16136b3f9b476f1ddae0afd620794c81 /src/types.cpp | |
| parent | f1ffd902944df5a7a8f89ca9a3d18e3c94307348 (diff) | |
Add extra max alignment parameter for metrics (specifically for SIMD)
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/types.cpp b/src/types.cpp index 570d7c556..aa4a3c4a1 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -3556,7 +3556,7 @@ i64 type_align_of_internal(Type *t, TypePath *path) { case Type_SimdVector: { // IMPORTANT TODO(bill): Figure out the alignment of vector types - return gb_clamp(next_pow2(type_size_of_internal(t, path)), 1, build_context.max_align*2); + return gb_clamp(next_pow2(type_size_of_internal(t, path)), 1, build_context.max_simd_align*2); } case Type_Matrix: @@ -3571,22 +3571,9 @@ i64 type_align_of_internal(Type *t, TypePath *path) { return build_context.word_size; } - i64 max_alignment = build_context.word_size; - if (is_arch_wasm()) { - // NOTE(bill): wasm32 with LLVM defines its default datalayout as: - // - // e-m:e-p:32:32-i64:64-n32:64-S128 - // - // This means that the alignment of a 64-bit type is 64-bits and not 32-bits like - // on other 32-bit architectures - // - // See: https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md - max_alignment = 8; - } - // NOTE(bill): Things that are bigger than build_context.word_size, are actually comprised of smaller types // TODO(bill): Is this correct for 128-bit types (integers)? - return gb_clamp(next_pow2(type_size_of_internal(t, path)), 1, max_alignment); + return gb_clamp(next_pow2(type_size_of_internal(t, path)), 1, build_context.max_align); } i64 *type_set_offsets_of(Slice<Entity *> const &fields, bool is_packed, bool is_raw_union) { |