[PATCH] D6260: Add -mlong-double-64 flag

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 27 18:17:27 PDT 2018

rsmith added a comment.

What about `-mlong-double-128`? It seems sensible to me to add support for that at the same time.

It looks like this also needs to affect name mangling. As far as I can tell from some quick testing, on ppc64-linux-gnu GCC uses `e` for 64-bit `long double` and `g` for 128-bit `long double`. On x86_64, `-mlong-double-64` and `-mlong-double-128` do not appear to affect the mangling scheme. Someone needs to do some research here to find out what the right mangling scheme to use is for each platform where we want to allow these flags.

Comment at: lib/Basic/TargetInfo.cpp:277
+    LongDoubleWidth = 64;
+    LongDoubleAlign = 32;
+    LongDoubleFormat = &llvm::APFloat::IEEEdouble;
hfinkel wrote:
> This seems wrong for targets in general. Maybe this should be, instead of 32 always, 64 on 64-bit targets?
I'd expect that this should match the alignment of `double`.

Comment at: lib/Basic/TargetInfo.cpp:299
     LongDoubleWidth = LongDoubleAlign = 128;
What should happen if you try to combine `-mlong-double-64` with `-x cl`? I'd expect the `-mlong-double-64` to win (as it's clearly a more specific override).


More information about the cfe-commits mailing list