Implement CPUFeatures::InferFromOS for Linux.
This also includes CPUFeatures::InferFromIDRegisterEmulation since that is the
mechanism used for recent features in Linux.
This has been checked against the documented behaviours, but has not been tested
for many of the recent features.
Change-Id: I94d9ee05f225f12f5eb72f9d30f23ec236a38d53
diff --git a/src/cpu-features.h b/src/cpu-features.h
index 5e1bb26..77e056f 100644
--- a/src/cpu-features.h
+++ b/src/cpu-features.h
@@ -219,8 +219,18 @@
return CPUFeatures(kFP, kNEON, kCRC32);
}
+ // Construct a new CPUFeatures object using ID registers. This assumes that
+ // kIDRegisterEmulation is present.
+ static CPUFeatures InferFromIDRegisters();
+
+ enum QueryIDRegistersOption {
+ kDontQueryIDRegisters,
+ kQueryIDRegistersIfAvailable
+ };
+
// Construct a new CPUFeatures object based on what the OS reports.
- static CPUFeatures InferFromOS();
+ static CPUFeatures InferFromOS(
+ QueryIDRegistersOption option = kQueryIDRegistersIfAvailable);
// Combine another CPUFeatures object into this one. Features that already
// exist in this set are left unchanged.