[PATCH] D115441: [X86][MS] Add 80bit long double support for Windows
Phoebe Wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 15 18:47:36 PST 2021
pengfei added a comment.
Hi @rnk , mine is Phoebe#3036. I haven't really used it before. No sure if I invited you correctly, so I try to explain here.
> My comment here refers to the alignment of argument values, not user-declared variables. The frontend controls the alignment of user-declared variables by setting the alloca alignment.
Sure. We have the same goal :)
> GCC and ICC appear to align long double arguments to 4 bytes: https://gcc.godbolt.org/z/PbobWdrPf
Unfortunately, compiler explorer doesn't provide the Windows version ICC. And the alignment on Windows is different from Linux for ICC. Here are my local result:
> cat ex5.cpp
void escape(void*);
void foo(int x, long double d, int y) {
escape(&x);
escape(&d);
escape(&y);
}
> icl -c ex5.cpp /Qlong-double /Qpc80
> dumpbin.exe /disasm ex5.obj
Microsoft (R) COFF/PE Dumper Version 14.29.30133.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file ex5.obj
File Type: COFF OBJECT
?foo@@YAXH_TH at Z (void __cdecl foo(int,decltype(auto),int)):
00000000: 8D 44 24 04 lea eax,[esp+4]
00000004: 50 push eax
00000005: E8 00 00 00 00 call ?escape@@YAXPAX at Z
0000000A: 8D 44 24 18 lea eax,[esp+18h]
0000000E: 50 push eax
0000000F: E8 00 00 00 00 call ?escape@@YAXPAX at Z
00000014: 8D 44 24 2C lea eax,[esp+2Ch]
00000018: 50 push eax
00000019: E8 00 00 00 00 call ?escape@@YAXPAX at Z
0000001E: 83 C4 0C add esp,0Ch
00000021: C3 ret
00000022: 0F 1F 80 00 00 00 nop dword ptr [eax]
00
00000029: 0F 1F 80 00 00 00 nop dword ptr [eax]
00
Summary
B7 .drectve
30 .text
As you can see, the `x` and `d` has 16 bytes distance.
I realized I should have put the result earlier to avoid the ambiguity. Sorry for the inconvenience!
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