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
|
set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL
|
||||||
"enable x86 relax relocations by default")
|
"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
|
set(CLANG_SPAWN_CC1 OFF CACHE BOOL
|
||||||
"Whether clang should use a new process for the CC1 invocation")
|
"Whether clang should use a new process for the CC1 invocation")
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,9 @@
|
||||||
/* enable x86 relax relocations by default */
|
/* enable x86 relax relocations by default */
|
||||||
#cmakedefine01 ENABLE_X86_RELAX_RELOCATIONS
|
#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 */
|
/* Enable each functionality of modules */
|
||||||
#cmakedefine01 CLANG_ENABLE_ARCMT
|
#cmakedefine01 CLANG_ENABLE_ARCMT
|
||||||
#cmakedefine01 CLANG_ENABLE_OBJC_REWRITER
|
#cmakedefine01 CLANG_ENABLE_OBJC_REWRITER
|
||||||
|
|
|
@ -409,6 +409,9 @@ public:
|
||||||
/// Check whether to enable x86 relax relocations by default.
|
/// Check whether to enable x86 relax relocations by default.
|
||||||
virtual bool useRelaxRelocations() const;
|
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
|
/// GetDefaultStackProtectorLevel - Get the default stack protector level for
|
||||||
/// this tool chain.
|
/// this tool chain.
|
||||||
virtual LangOptions::StackProtectorMode
|
virtual LangOptions::StackProtectorMode
|
||||||
|
|
|
@ -109,6 +109,10 @@ bool ToolChain::useRelaxRelocations() const {
|
||||||
return ENABLE_X86_RELAX_RELOCATIONS;
|
return ENABLE_X86_RELAX_RELOCATIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ToolChain::defaultToIEEELongDouble() const {
|
||||||
|
return PPC_LINUX_DEFAULT_IEEELONGDOUBLE && getTriple().isOSLinux();
|
||||||
|
}
|
||||||
|
|
||||||
SanitizerArgs
|
SanitizerArgs
|
||||||
ToolChain::getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const {
|
ToolChain::getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const {
|
||||||
SanitizerArgs SanArgs(*this, JobArgs, !SanitizerArgsChecked);
|
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)) {
|
for (const Arg *A : Args.filtered(options::OPT_mabi_EQ)) {
|
||||||
StringRef V = A->getValue();
|
StringRef V = A->getValue();
|
||||||
if (V == "ieeelongdouble")
|
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 powerpc-linux-gnu -emit-llvm -S -mabi=ibmlongdouble \
|
||||||
// RUN: %clang -target powerpc64-linux-gnu -emit-llvm -S -O0 %s -o - | FileCheck %s --check-prefix=CHECK-BE --check-prefix=CHECK
|
// RUN: -O0 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE
|
||||||
// RUN: %clang -target powerpc64le-linux-gnu -emit-llvm -S -O0 %s -o - | FileCheck %s --check-prefix=CHECK-LE --check-prefix=CHECK
|
// 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;
|
bool b;
|
||||||
double d = -1.0;
|
double d = -1.0;
|
||||||
|
|
|
@ -63,9 +63,6 @@
|
||||||
// CHECK-ELFv1-IEEE: "-mabi=ieeelongdouble"
|
// CHECK-ELFv1-IEEE: "-mabi=ieeelongdouble"
|
||||||
// CHECK-ELFv1-IEEE: "-target-abi" "elfv1"
|
// 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: %clang -target powerpc64le-linux-gnu %s -mabi=ibmlongdouble -### 2>&1 \
|
||||||
// RUN: | FileCheck -check-prefix=CHECK-ELFv2-IBM128 %s
|
// RUN: | FileCheck -check-prefix=CHECK-ELFv2-IBM128 %s
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue