mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 17:11:44 +03:00
Predefine version D_HardFloat instead of D_SoftFloat for -float-abi=softfp (#2678)
Matching the D_HardFloat semantics: 'the target hardware has a floating point unit'.
This commit is contained in:
parent
7464d8449f
commit
0cd14bf80e
5 changed files with 59 additions and 21 deletions
|
@ -618,21 +618,22 @@ void fixupUClibcEnv()
|
|||
/// Also defines D_HardFloat or D_SoftFloat depending if FPU should be used
|
||||
void registerPredefinedFloatABI(const char *soft, const char *hard,
|
||||
const char *softfp = nullptr) {
|
||||
// Use target floating point unit instead of s/w float routines
|
||||
// FIXME: This is a semantic change!
|
||||
bool useFPU = gTargetMachine->Options.FloatABIType == llvm::FloatABI::Hard;
|
||||
VersionCondition::addPredefinedGlobalIdent(useFPU ? "D_HardFloat"
|
||||
: "D_SoftFloat");
|
||||
|
||||
if (gTargetMachine->Options.FloatABIType == llvm::FloatABI::Soft) {
|
||||
VersionCondition::addPredefinedGlobalIdent(useFPU && softfp ? softfp
|
||||
: soft);
|
||||
} else if (gTargetMachine->Options.FloatABIType == llvm::FloatABI::Hard) {
|
||||
assert(useFPU && "Should be using the FPU if using float-abi=hard");
|
||||
switch (floatABI) {
|
||||
case FloatABI::Soft:
|
||||
VersionCondition::addPredefinedGlobalIdent(soft);
|
||||
break;
|
||||
case FloatABI::SoftFP:
|
||||
VersionCondition::addPredefinedGlobalIdent(softfp ? softfp : soft);
|
||||
break;
|
||||
case FloatABI::Hard:
|
||||
VersionCondition::addPredefinedGlobalIdent(hard);
|
||||
} else {
|
||||
assert(0 && "FloatABIType neither Soft or Hard");
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("Unknown float ABI");
|
||||
}
|
||||
|
||||
VersionCondition::addPredefinedGlobalIdent(
|
||||
floatABI == FloatABI::Soft ? "D_SoftFloat" : "D_HardFloat");
|
||||
}
|
||||
|
||||
/// Registers the predefined versions specific to the current target triple
|
||||
|
@ -997,6 +998,7 @@ int cppmain(int argc, char **argv) {
|
|||
// check and fix environment for uClibc
|
||||
fixupUClibcEnv();
|
||||
|
||||
// create target machine and finalize floatABI
|
||||
gTargetMachine = createTargetMachine(
|
||||
mTargetTriple, arch, opts::getCPUStr(), opts::getFeaturesStr(), bitness,
|
||||
floatABI, relocModel, opts::getCodeModel(), codeGenOptLevel(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue