| ... | ... | @@ -6051,12 +6051,12 @@ ZigType *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) { |
| 6051 | 6051 | entry->abi_size = LLVMABISizeOfType(g->target_data_ref, entry->llvm_type); |
| 6052 | 6052 | entry->abi_align = LLVMABIAlignmentOfType(g->target_data_ref, entry->llvm_type); |
| 6053 | 6053 | |
| 6054 | | if (size_in_bits >= 128) { |
| 6054 | if (size_in_bits >= 128 && entry->abi_align < 16) { |
| 6055 | 6055 | // Override the incorrect alignment reported by LLVM. Clang does this as well. |
| 6056 | 6056 | // On x86_64 there are some instructions like CMPXCHG16B which require this. |
| 6057 | 6057 | // On all targets, integers 128 bits and above have ABI alignment of 16. |
| 6058 | // However for some targets, LLVM incorrectly reports this as 8. |
| 6058 | 6059 | // See: https://github.com/ziglang/zig/issues/2987 |
| 6059 | | assert(entry->abi_align == 8); // if this trips we can remove the workaround |
| 6060 | 6060 | entry->abi_align = 16; |
| 6061 | 6061 | } |
| 6062 | 6062 | } |