
Clang [defaults to aligning `__int128_t` to 16 bytes], while LLVM `datalayout` strings [default to aligning `i128` to 8 bytes]. Wasm is currently using the defaults for both, so it's inconsistent. Fix this by adding `-i128:128` to Wasm's `datalayout` string so that it aligns `i128` to 16 bytes too. This is similar to [llvm/llvm-project@dbad963](dbad963a69
) for SPARC. This fixes rust-lang/rust#133991; see that issue for further discussion. [defaults to aligning `__int128_t` to 16 bytes]:f8b4182f07/clang/lib/Basic/TargetInfo.cpp (L77)
[default to aligning `i128` to 8 bytes]: https://llvm.org/docs/LangRef.html#langref-datalayout
27 lines
600 B
LLVM
27 lines
600 B
LLVM
; RUN: llc < %s -march=wasm32 | FileCheck %s
|
|
; RUN: llc < %s -march=wasm64 | FileCheck %s
|
|
|
|
; CHECK: .Li8:
|
|
; CHECK-DAG: .size .Li8, 1
|
|
@i8 = private constant i8 42
|
|
|
|
; CHECK: .p2align 1
|
|
; CHECK-NEXT: .Li16:
|
|
; CHECK-DAG: .size .Li16, 2
|
|
@i16 = private constant i16 42
|
|
|
|
; CHECK: .p2align 2
|
|
; CHECK-NEXT: .Li32:
|
|
; CHECK-DAG: .size .Li32, 4
|
|
@i32 = private constant i32 42
|
|
|
|
; CHECK: .p2align 3
|
|
; CHECK-NEXT: .Li64:
|
|
; CHECK-DAG: .size .Li64, 8
|
|
@i64 = private constant i64 42
|
|
|
|
; CHECK: .p2align 4
|
|
; CHECK-NEXT: .Li128:
|
|
; CHECK-DAG: .size .Li128, 16
|
|
@i128 = private constant i128 42
|