]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips: extend mips_features with a check for FPU
authorPetar Jovanovic <mips32r2@gmail.com>
Sat, 27 Sep 2014 05:18:21 +0000 (05:18 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Sat, 27 Sep 2014 05:18:21 +0000 (05:18 +0000)
Extend mips_features with "hard-float" query to which mips_features will
respond whether or not the platform is meant to have a floating point unit.
The query is not a runtime check, but a built-time check.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14570

tests/mips_features.c

index 1aef820bdd44d3cb81157c1b87f6a8186e30b2f1..d0e01e5fdcba5757794330ad33b53b85775f1212 100644 (file)
@@ -47,7 +47,17 @@ static int mipsCPUInfo(const char *search_string) {
 static int go(char *feature)
 {
    int cpuinfo;
-   if (strcmp(feature, "mips32-dsp") == 0) {
+   if (strcmp(feature, "hard-float") == 0) {
+#if defined(__mips_hard_float)
+      /* This is not a runtime detection.
+         If mips_features is built as hard-float, the assumption is that
+         the target MIPS platform has a floating-point unit. */
+      return FEATURE_PRESENT;
+#else
+      return FEATURE_NOT_PRESENT;
+#endif
+   }
+   else if (strcmp(feature, "mips32-dsp") == 0) {
       const char *dsp = "dsp";
       cpuinfo = mipsCPUInfo(dsp);
       if (cpuinfo == 1) {