summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorSilviu Baranga <silviu.baranga@arm.com>2013-10-21 10:54:53 +0000
committerSilviu Baranga <silviu.baranga@arm.com>2013-10-21 10:54:53 +0000
commitf9671dd09d0e58cf98e8339a701c1a9283565c36 (patch)
treea8ebac6e987f2daacdf3f297135bebdb232fba36 /clang/lib/Basic/Targets.cpp
parent6652921d5aba1e5c158212d288d2b7d6e53386c8 (diff)
downloadbcm5719-llvm-f9671dd09d0e58cf98e8339a701c1a9283565c36.tar.gz
bcm5719-llvm-f9671dd09d0e58cf98e8339a701c1a9283565c36.zip
Add the __ARM_ARCH_EXT_IDIV__ predefine. It is set to 1 if we have hardware divide in the mode that we are compiling in (depending on the target features), not defined if we don't. Should be compatible with the GCC conterpart. Also adding a -hwdiv option to overide the default behavior.
llvm-svn: 193074
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r--clang/lib/Basic/Targets.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 2f90e98a391..f5249e54670 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -3599,6 +3599,12 @@ class ARMTargetInfo : public TargetInfo {
NeonFPU = (1 << 3)
};
+ // Possible HWDiv features.
+ enum HWDivMode {
+ HWDivThumb = (1 << 0),
+ HWDivARM = (1 << 1)
+ };
+
static bool FPUModeIsVFP(FPUMode Mode) {
return Mode & (VFP2FPU | VFP3FPU | VFP4FPU | NeonFPU);
}
@@ -3618,6 +3624,7 @@ class ARMTargetInfo : public TargetInfo {
unsigned IsAAPCS : 1;
unsigned IsThumb : 1;
+ unsigned HWDiv : 2;
// Initialized via features.
unsigned SoftFloat : 1;
@@ -3770,6 +3777,7 @@ public:
DiagnosticsEngine &Diags) {
FPU = 0;
SoftFloat = SoftFloatABI = false;
+ HWDiv = 0;
for (unsigned i = 0, e = Features.size(); i != e; ++i) {
if (Features[i] == "+soft-float")
SoftFloat = true;
@@ -3783,6 +3791,10 @@ public:
FPU |= VFP4FPU;
else if (Features[i] == "+neon")
FPU |= NeonFPU;
+ else if (Features[i] == "+hwdiv")
+ HWDiv |= HWDivThumb;
+ else if (Features[i] == "+hwdiv-arm")
+ HWDiv |= HWDivARM;
}
if (!(FPU & NeonFPU) && FPMath == FP_Neon) {
@@ -3812,6 +3824,8 @@ public:
.Case("softfloat", SoftFloat)
.Case("thumb", IsThumb)
.Case("neon", (FPU & NeonFPU) && !SoftFloat)
+ .Case("hwdiv", HWDiv & HWDivThumb)
+ .Case("hwdiv-arm", HWDiv & HWDivARM)
.Default(false);
}
// FIXME: Should we actually have some table instead of these switches?
@@ -3905,6 +3919,8 @@ public:
if (CPUArch == "6T2" || IsARMv7)
Builder.defineMacro("__thumb2__");
}
+ if (((HWDiv & HWDivThumb) && IsThumb) || ((HWDiv & HWDivARM) && !IsThumb))
+ Builder.defineMacro("__ARM_ARCH_EXT_IDIV__", "1");
// Note, this is always on in gcc, even though it doesn't make sense.
Builder.defineMacro("__APCS_32__");
OpenPOWER on IntegriCloud