Properly handle turning off NEON on ARM devices.
BUG=6127576
Change-Id: I82880a9ef92a3222b5a15e663104aad4bf508392
diff --git a/lib/ExecutionEngine/Compiler.cpp b/lib/ExecutionEngine/Compiler.cpp
index 58a49c5..cf18ef6 100644
--- a/lib/ExecutionEngine/Compiler.cpp
+++ b/lib/ExecutionEngine/Compiler.cpp
@@ -186,19 +186,13 @@
# endif
# endif
-# if defined(ARCH_ARM_HAVE_NEON)
+# if defined(ARCH_ARM_HAVE_NEON) && !defined(DISABLE_ARCH_ARM_HAVE_NEON)
Features.push_back("+neon");
Features.push_back("+neonfp");
# else
Features.push_back("-neon");
Features.push_back("-neonfp");
# endif
-
-// FIXME(all): Turn NEON back on after debugging the rebase.
-# if 1 || defined(DISABLE_ARCH_ARM_HAVE_NEON)
- Features.push_back("-neon");
- Features.push_back("-neonfp");
-# endif
}
// Register the scheduler
@@ -252,6 +246,8 @@
llvm::TargetData *TD = NULL;
llvm::TargetMachine *TM = NULL;
+ std::vector<std::string> ExtraFeatures;
+
std::string FeaturesStr;
if (mModule == NULL) // No module was loaded
@@ -305,12 +301,12 @@
#if defined(ARCH_ARM_HAVE_NEON)
// Full-precision means we have to disable NEON
if (ME.getRSFloatPrecision() == bcinfo::RS_FP_Full) {
- Features.push_back("-neon");
- Features.push_back("-neonfp");
+ ExtraFeatures.push_back("-neon");
+ ExtraFeatures.push_back("-neonfp");
}
#endif
- if (!CPU.empty() || !Features.empty()) {
+ if (!CPU.empty() || !Features.empty() || !ExtraFeatures.empty()) {
llvm::SubtargetFeatures F;
for (std::vector<std::string>::const_iterator
@@ -318,6 +314,11 @@
F.AddFeature(*I);
}
+ for (std::vector<std::string>::const_iterator
+ I = ExtraFeatures.begin(), E = ExtraFeatures.end(); I != E; I++) {
+ F.AddFeature(*I);
+ }
+
FeaturesStr = F.getString();
}