summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-07-09 00:27:43 +0000
committerFangrui Song <maskray@google.com>2019-07-09 00:27:43 +0000
commit11cb39c5fc52e59c155be9b8fedbd114a596891b (patch)
treee6de4edf00ad775200d79c6d6b84f2f3bf2ae0e2 /clang/lib/Basic
parent9801621616b2eaac6839c144095d8e479385566a (diff)
downloadbcm5719-llvm-11cb39c5fc52e59c155be9b8fedbd114a596891b.tar.gz
bcm5719-llvm-11cb39c5fc52e59c155be9b8fedbd114a596891b.zip
[X86][PPC] Support -mlong-double-64
-mlong-double-64 is supported on some ports of gcc (i386, x86_64, and ppc{32,64}). On many other targets, there will be an error: error: unrecognized command line option '-mlong-double-64' This patch makes the driver option -mlong-double-64 available for x86 and ppc. The CC1 option -mlong-double-64 is available on all targets for users to test on unsupported targets. LongDoubleSize is added as a VALUE_LANGOPT so that the option can be shared with -mlong-double-128 when we support it in clang. Also, make powerpc*-linux-musl default to use 64-bit long double. It is currently the only supported ABI on musl and is also how people configure powerpc*-linux-musl-gcc. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D64067 llvm-svn: 365412
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r--clang/lib/Basic/TargetInfo.cpp6
-rw-r--r--clang/lib/Basic/Targets/PPC.h27
2 files changed, 13 insertions, 20 deletions
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 5a75b857c21..43ab77289b1 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -373,6 +373,12 @@ void TargetInfo::adjust(LangOptions &Opts) {
LongDoubleFormat = &llvm::APFloat::IEEEquad();
}
+ if (Opts.LongDoubleSize && Opts.LongDoubleSize == DoubleWidth) {
+ LongDoubleWidth = DoubleWidth;
+ LongDoubleAlign = DoubleAlign;
+ LongDoubleFormat = DoubleFormat;
+ }
+
if (Opts.NewAlignOverride)
NewAlign = Opts.NewAlignOverride * getCharWidth();
diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index 6c132e3841f..85d898cda24 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -345,17 +345,10 @@ public:
break;
}
- switch (getTriple().getOS()) {
- case llvm::Triple::FreeBSD:
- case llvm::Triple::NetBSD:
- case llvm::Triple::OpenBSD:
- // FIXME: -mlong-double-128 is not yet supported on AIX.
- case llvm::Triple::AIX:
+ if (Triple.isOSFreeBSD() || Triple.isOSNetBSD() || Triple.isOSOpenBSD() ||
+ Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
LongDoubleWidth = LongDoubleAlign = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble();
- break;
- default:
- break;
}
// PPC32 supports atomics up to 4 bytes.
@@ -386,19 +379,13 @@ public:
ABI = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
}
- switch (Triple.getOS()) {
- case llvm::Triple::FreeBSD:
- LongDoubleWidth = LongDoubleAlign = 64;
- LongDoubleFormat = &llvm::APFloat::IEEEdouble();
- break;
- case llvm::Triple::AIX:
- // FIXME: -mlong-double-128 is not yet supported on AIX.
+ if (Triple.getOS() == llvm::Triple::AIX)
+ SuitableAlign = 64;
+
+ if (Triple.isOSFreeBSD() || Triple.getOS() == llvm::Triple::AIX ||
+ Triple.isMusl()) {
LongDoubleWidth = LongDoubleAlign = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble();
- SuitableAlign = 64;
- break;
- default:
- break;
}
// PPC64 supports atomics up to 8 bytes.
OpenPOWER on IntegriCloud