tuliom updated this revision to Diff 480858.
tuliom added a comment.
I'm attaching a new version of the patch.
> Can you please upload the patch with full context (-U99999)?
@nikic Done!
> The assumption here is that libc++ is being compiled with a compiler that has
> the same ieeelongdouble default as the clang that is being built, right?
@nikic Right.
> New functions should use camelCase
@MaskRay Fixed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139450/new/
https://reviews.llvm.org/D139450
Files:
clang/lib/Driver/ToolChains/PPCLinux.cpp
clang/lib/Driver/ToolChains/PPCLinux.h
clang/test/Driver/lit.local.cfg
clang/test/Driver/ppc-float-abi-warning.cpp
clang/test/lit.site.cfg.py.in
Index: clang/test/lit.site.cfg.py.in
===================================================================
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -38,6 +38,7 @@
config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@")
config.standalone_build = @CLANG_BUILT_STANDALONE@
+config.ppc_linux_default_ieeelongdouble = "@PPC_LINUX_DEFAULT_IEEELONGDOUBLE@"
import lit.llvm
lit.llvm.initialize(lit_config, config)
Index: clang/test/Driver/ppc-float-abi-warning.cpp
===================================================================
--- clang/test/Driver/ppc-float-abi-warning.cpp
+++ clang/test/Driver/ppc-float-abi-warning.cpp
@@ -7,12 +7,23 @@
// RUN: --dyld-prefix=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-12 \
// RUN: -mabi=ieeelongdouble -stdlib=libstdc++ 2>&1 | \
// RUN: FileCheck %s --check-prefix=NOWARN
-// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s \
-// RUN: -mabi=ieeelongdouble -stdlib=libc++ 2>&1 | FileCheck %s
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN: -stdlib=libc++ 2>&1 | \
+// RUN: FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN: -mabi=ibmlongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
+// RUN: FileCheck %s --check-prefix=NOWARN
// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
// RUN: -mabi=ieeelongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
// RUN: FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN: -mabi=%if ppc_linux_default_ieeelongdouble %{ieeelongdouble%} \
+// RUN: %else %{ibmlongdouble%} -stdlib=libc++ 2>&1 | \
+// RUN: FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN: -mabi=%if ppc_linux_default_ieeelongdouble %{ibmlongdouble%} \
+// RUN: %else %{ieeelongdouble%} -stdlib=libc++ 2>&1 | FileCheck %s
-// CHECK: warning: float ABI 'ieeelongdouble' is not supported by current library
-// NOWARN-NOT: warning: float ABI 'ieeelongdouble' is not supported by current library
+// CHECK: warning: float ABI '{{.*}}' is not supported by current library
+// NOWARN-NOT: warning: float ABI '{{.*}}' is not supported by current library
long double foo(long double x) { return x; }
Index: clang/test/Driver/lit.local.cfg
===================================================================
--- clang/test/Driver/lit.local.cfg
+++ clang/test/Driver/lit.local.cfg
@@ -21,3 +21,6 @@
if llvm_config.use_lld(required=False):
config.available_features.add('lld')
+
+if config.ppc_linux_default_ieeelongdouble == "ON":
+ config.available_features.add('ppc_linux_default_ieeelongdouble')
Index: clang/lib/Driver/ToolChains/PPCLinux.h
===================================================================
--- clang/lib/Driver/ToolChains/PPCLinux.h
+++ clang/lib/Driver/ToolChains/PPCLinux.h
@@ -27,6 +27,8 @@
private:
bool SupportIEEEFloat128(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args) const;
+ bool supportIBMLongDouble(const Driver &D,
+ const llvm::opt::ArgList &Args) const;
};
} // end namespace toolchains
Index: clang/lib/Driver/ToolChains/PPCLinux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/PPCLinux.cpp
+++ clang/lib/Driver/ToolChains/PPCLinux.cpp
@@ -49,7 +49,9 @@
: Linux(D, Triple, Args) {
if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
StringRef ABIName = A->getValue();
- if (ABIName == "ieeelongdouble" && !SupportIEEEFloat128(D, Triple, Args))
+
+ if ((ABIName == "ieeelongdouble" && !SupportIEEEFloat128(D, Triple, Args)) ||
+ (ABIName == "ibmlongdouble" && !supportIBMLongDouble(D, Args)))
D.Diag(diag::warn_drv_unsupported_float_abi_by_lib) << ABIName;
}
}
@@ -67,6 +69,19 @@
Linux::AddClangSystemIncludeArgs(DriverArgs, CC1Args);
}
+bool PPCLinuxToolChain::supportIBMLongDouble(
+ const Driver &D,
+ const llvm::opt::ArgList &Args) const {
+ if (Args.hasArg(options::OPT_nostdlib, options::OPT_nostdlibxx))
+ return true;
+
+ CXXStdlibType StdLib = ToolChain::GetCXXStdlibType(Args);
+ if (StdLib == CST_Libstdcxx)
+ return true;
+
+ return StdLib == CST_Libcxx && !defaultToIEEELongDouble();
+}
+
bool PPCLinuxToolChain::SupportIEEEFloat128(
const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args) const {
@@ -78,7 +93,7 @@
CXXStdlibType StdLib = ToolChain::GetCXXStdlibType(Args);
bool HasUnsupportedCXXLib =
- StdLib == CST_Libcxx ||
+ (StdLib == CST_Libcxx && !defaultToIEEELongDouble()) ||
(StdLib == CST_Libstdcxx &&
GCCInstallation.getVersion().isOlderThan(12, 1, 0));
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits