From 6bd02a442c0e4cadd84cf7ac37df533e4160e765 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Mon, 15 Jul 2019 07:25:11 +0000 Subject: [PowerPC] Support -mabi=ieeelongdouble and -mabi=ibmlongdouble gcc PowerPC supports 3 representations of long double: * -mlong-double-64 long double has the same representation of double but is mangled as `e`. In clang, this is the default on AIX, FreeBSD and Linux musl. * -mlong-double-128 2 possible 128-bit floating point representations: + -mabi=ibmlongdouble IBM extended double format. Mangled as `g` In clang, this is the default on Linux glibc. + -mabi=ieeelongdouble IEEE 754 quadruple-precision format. Mangled as `u9__ieee128` (`U10__float128` before gcc 8.2) This is currently unavailable. This patch adds -mabi=ibmlongdouble and -mabi=ieeelongdouble, and thus makes the IEEE 754 quadruple-precision long double available for languages supported by clang. Reviewed By: hfinkel Differential Revision: https://reviews.llvm.org/D64283 llvm-svn: 366044 --- clang/lib/Driver/ToolChains/Clang.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'clang/lib/Driver') diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index c84cb480f1a..6a83e1a480a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1803,12 +1803,21 @@ void Clang::AddPPCTargetArgs(const ArgList &Args, break; } - if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) - // The ppc64 linux abis are all "altivec" abis by default. Accept and ignore - // the option if given as we don't have backend support for any targets - // that don't use the altivec abi. - if (StringRef(A->getValue()) != "altivec") + bool IEEELongDouble = false; + for (const Arg *A : Args.filtered(options::OPT_mabi_EQ)) { + StringRef V = A->getValue(); + if (V == "ieeelongdouble") + IEEELongDouble = true; + else if (V == "ibmlongdouble") + IEEELongDouble = false; + else if (V != "altivec") + // The ppc64 linux abis are all "altivec" abis by default. Accept and ignore + // the option if given as we don't have backend support for any targets + // that don't use the altivec abi. ABIName = A->getValue(); + } + if (IEEELongDouble) + CmdArgs.push_back("-mabi=ieeelongdouble"); ppc::FloatABI FloatABI = ppc::getPPCFloatABI(getToolChain().getDriver(), Args); -- cgit v1.2.3