r179486 - [Mips] Follow-up to r179481. Consider "single-float" as a separate
Simon Atanasyan
simon at atanasyan.com
Sun Apr 14 07:07:30 PDT 2013
Author: atanasyan
Date: Sun Apr 14 09:07:30 2013
New Revision: 179486
URL: http://llvm.org/viewvc/llvm-project?rev=179486&view=rev
Log:
[Mips] Follow-up to r179481. Consider "single-float" as a separate
independent of float ABI feature in the MipsTargetInfoBase class.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/init.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=179486&r1=179485&r2=179486&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sun Apr 14 09:07:30 2013
@@ -4405,8 +4405,9 @@ class MipsTargetInfoBase : public Target
static const Builtin::Info BuiltinInfo[];
std::string CPU;
bool IsMips16;
+ bool IsSingleFloat;
enum MipsFloatABI {
- HardFloat, SingleFloat, SoftFloat
+ HardFloat, SoftFloat
} FloatABI;
enum DspRevEnum {
NoDSP, DSP1, DSP2
@@ -4422,6 +4423,7 @@ public:
: TargetInfo(triple),
CPU(CPUStr),
IsMips16(false),
+ IsSingleFloat(false),
FloatABI(HardFloat),
DspRev(NoDSP),
ABI(ABIStr)
@@ -4448,15 +4450,14 @@ public:
case HardFloat:
Builder.defineMacro("__mips_hard_float", Twine(1));
break;
- case SingleFloat:
- Builder.defineMacro("__mips_hard_float", Twine(1));
- Builder.defineMacro("__mips_single_float", Twine(1));
- break;
case SoftFloat:
Builder.defineMacro("__mips_soft_float", Twine(1));
break;
}
+ if (IsSingleFloat)
+ Builder.defineMacro("__mips_single_float", Twine(1));
+
if (IsMips16)
Builder.defineMacro("__mips16", Twine(1));
@@ -4564,13 +4565,14 @@ public:
virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
IsMips16 = false;
+ IsSingleFloat = false;
FloatABI = HardFloat;
DspRev = NoDSP;
for (std::vector<std::string>::iterator it = Features.begin(),
ie = Features.end(); it != ie; ++it) {
if (*it == "+single-float")
- FloatABI = SingleFloat;
+ IsSingleFloat = true;
else if (*it == "+soft-float")
FloatABI = SoftFloat;
else if (*it == "+mips16")
Modified: cfe/trunk/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=179486&r1=179485&r2=179486&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Sun Apr 14 09:07:30 2013
@@ -1150,6 +1150,12 @@
// MIPS-FABI-SINGLE:#define __mips_hard_float 1
// MIPS-FABI-SINGLE:#define __mips_single_float 1
//
+// RUN: %clang_cc1 -target-feature +soft-float -target-feature +single-float \
+// RUN: -E -dM -ffreestanding -triple=mips-none-none < /dev/null \
+// RUN: | FileCheck -check-prefix MIPS-FABI-SINGLE-SOFT %s
+// MIPS-FABI-SINGLE-SOFT:#define __mips_single_float 1
+// MIPS-FABI-SINGLE-SOFT:#define __mips_soft_float 1
+//
// Check MIPS features macros
//
// RUN: %clang_cc1 -target-feature +mips16 \
More information about the cfe-commits
mailing list