Skip to content

Commit 18f7655

Browse files
authored
[Clang][Wasm] Set __float128 alignment to 64 for emscripten (llvm#146494)
https://reviews.llvm.org/D104808 set the alignment of long double to 64 bits. This is also the alignment specified in the LLVM data layout. However, the alignment of __float128 was left at 128 bits. I assume that this was just an oversight, rather than an intentional divergence. The C ABI document currently does not make any statement about `__float128`: https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md
1 parent ae496bf commit 18f7655

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clang/lib/Basic/Targets/OSTargets.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,7 @@ class LLVM_LIBRARY_VISIBILITY EmscriptenTargetInfo
10021002
// Emscripten's ABI is unstable and we may change this back to 128 to match
10031003
// the WebAssembly default in the future.
10041004
this->LongDoubleAlign = 64;
1005+
this->Float128Align = 64;
10051006
}
10061007
};
10071008

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,7 @@ static void checkDataLayoutConsistency(const TargetInfo &Target,
388388
llvm::Type::getFloatingPointTy(Context, *Target.LongDoubleFormat),
389389
Target.LongDoubleAlign);
390390
}
391-
// FIXME: Wasm has a mismatch in f128 alignment between Clang and LLVM.
392-
if (Target.hasFloat128Type() && !Triple.isWasm())
391+
if (Target.hasFloat128Type())
393392
Check("__float128", llvm::Type::getFP128Ty(Context), Target.Float128Align);
394393
if (Target.hasIbm128Type())
395394
Check("__ibm128", llvm::Type::getPPC_FP128Ty(Context), Target.Ibm128Align);

0 commit comments

Comments
 (0)