forked from OSchip/llvm-project
[CMake] [Clang] Add option to specify PowerPC long double format
This method introduces new CMake variable PPC_LINUX_DEFAULT_IEEELONGDOUBLE (false by default) to enable fp128 as default long double format. Reviewed By: jsji Differential Revision: https://reviews.llvm.org/D118110
This commit is contained in:
parent
4e077c0a0b
commit
b797d5e6b2
|
@ -237,6 +237,9 @@ set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
|
|||
set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL
|
||||
"enable x86 relax relocations by default")
|
||||
|
||||
set(PPC_LINUX_DEFAULT_IEEELONGDOUBLE OFF CACHE BOOL
|
||||
"Enable IEEE binary128 as default long double format on PowerPC Linux.")
|
||||
|
||||
set(CLANG_SPAWN_CC1 OFF CACHE BOOL
|
||||
"Whether clang should use a new process for the CC1 invocation")
|
||||
|
||||
|
|
|
@ -78,6 +78,9 @@
|
|||
/* enable x86 relax relocations by default */
|
||||
#cmakedefine01 ENABLE_X86_RELAX_RELOCATIONS
|
||||
|
||||
/* Enable IEEE binary128 as default long double format on PowerPC Linux. */
|
||||
#cmakedefine01 PPC_LINUX_DEFAULT_IEEELONGDOUBLE
|
||||
|
||||
/* Enable each functionality of modules */
|
||||
#cmakedefine01 CLANG_ENABLE_ARCMT
|
||||
#cmakedefine01 CLANG_ENABLE_OBJC_REWRITER
|
||||
|
|
|
@ -409,6 +409,9 @@ public:
|
|||
/// Check whether to enable x86 relax relocations by default.
|
||||
virtual bool useRelaxRelocations() const;
|
||||
|
||||
/// Check whether use IEEE binary128 as long double format by default.
|
||||
bool defaultToIEEELongDouble() const;
|
||||
|
||||
/// GetDefaultStackProtectorLevel - Get the default stack protector level for
|
||||
/// this tool chain.
|
||||
virtual LangOptions::StackProtectorMode
|
||||
|
|
|
@ -109,6 +109,10 @@ bool ToolChain::useRelaxRelocations() const {
|
|||
return ENABLE_X86_RELAX_RELOCATIONS;
|
||||
}
|
||||
|
||||
bool ToolChain::defaultToIEEELongDouble() const {
|
||||
return PPC_LINUX_DEFAULT_IEEELONGDOUBLE && getTriple().isOSLinux();
|
||||
}
|
||||
|
||||
SanitizerArgs
|
||||
ToolChain::getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const {
|
||||
SanitizerArgs SanArgs(*this, JobArgs, !SanitizerArgsChecked);
|
||||
|
|
|
@ -2061,7 +2061,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
|
|||
}
|
||||
}
|
||||
|
||||
bool IEEELongDouble = false;
|
||||
bool IEEELongDouble = getToolChain().defaultToIEEELongDouble();
|
||||
for (const Arg *A : Args.filtered(options::OPT_mabi_EQ)) {
|
||||
StringRef V = A->getValue();
|
||||
if (V == "ieeelongdouble")
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// RUN: %clang -target powerpc-linux-gnu -emit-llvm -S -O0 %s -o - | FileCheck %s --check-prefix=CHECK-BE --check-prefix=CHECK
|
||||
// RUN: %clang -target powerpc64-linux-gnu -emit-llvm -S -O0 %s -o - | FileCheck %s --check-prefix=CHECK-BE --check-prefix=CHECK
|
||||
// RUN: %clang -target powerpc64le-linux-gnu -emit-llvm -S -O0 %s -o - | FileCheck %s --check-prefix=CHECK-LE --check-prefix=CHECK
|
||||
// RUN: %clang -target powerpc-linux-gnu -emit-llvm -S -mabi=ibmlongdouble \
|
||||
// RUN: -O0 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE
|
||||
// RUN: %clang -target powerpc64-linux-gnu -emit-llvm -S -mabi=ibmlongdouble \
|
||||
// RUN: -O0 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE
|
||||
// RUN: %clang -target powerpc64le-linux-gnu -emit-llvm -S -mabi=ibmlongdouble \
|
||||
// RUN: -O0 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-LE
|
||||
|
||||
bool b;
|
||||
double d = -1.0;
|
||||
|
|
|
@ -63,9 +63,6 @@
|
|||
// CHECK-ELFv1-IEEE: "-mabi=ieeelongdouble"
|
||||
// CHECK-ELFv1-IEEE: "-target-abi" "elfv1"
|
||||
|
||||
// Check -mabi=ibmlongdouble is the default.
|
||||
// RUN: %clang -target powerpc64le-linux-gnu %s -### 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-ELFv2-IBM128 %s
|
||||
// RUN: %clang -target powerpc64le-linux-gnu %s -mabi=ibmlongdouble -### 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-ELFv2-IBM128 %s
|
||||
|
||||
|
|
Loading…
Reference in New Issue