[PATCH] D115441: [X86][MS] Add 80bit long double support for Windows

Phoebe Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 14 22:23:39 PST 2021


pengfei added a comment.

> GCC doesn't align fp80 long double to 16 bytes on i686, so I see no reason for LLVM to do it. Is there some other compiler that you need ABI compatibility with?

Yes. ICC aligns long double to 16 bytes on 32bit Windows. (I mentioned it in the summary :). In contrast with GCC, ICC is more compatible with MSVC. So I think it's reasonable to align with ICC ranther than GCC.

> Also consider that in LLVM, the alignment of arguments passed in memory is not observable (unless byval or inalloca is used). If the user takes the address of an argument, they actually take the address of a local alloca, which is a copy of the argument. The frontend (clang) decides the alignment of the alloca.

We cannot force user to always pass arguments by address. Once they are passed by value, (actually it's common in the code, we usually write like foo(double a) rather than foo(double *a) ), it turns to the scope of calling conversion. It's true all basic types except f80 is aligned to 4 when passed by value on 32 bits. But Windows 32 bits is not alone. Darwin 32 bits uses the same calling conversion for f80 too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115441/new/

https://reviews.llvm.org/D115441



More information about the cfe-commits mailing list