[Lldb-commits] [lldb] [lldb][test] Unify and extend test infrastructure for checking CPU features (PR #153914)
Julian Lettner via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 15 19:45:04 PDT 2025
================
@@ -1360,39 +1328,43 @@ def isARM(self):
self.getArchitecture().lower().startswith("arm")
)
+ def isSupported(self, cpu_feature: cpu_feature.CPUFeature):
+ triple = self.dbg.GetSelectedPlatform().GetTriple()
+ cmd_runner = self.run_platform_command
+ return cpu_feature.is_supported(triple, cmd_runner)
+
def isAArch64SVE(self):
- return self.isAArch64() and "sve" in self.getCPUInfo()
+ return self.isAArch64() and self.isSupported(cpu_feature.SVE)
def isAArch64SME(self):
- return self.isAArch64() and "sme" in self.getCPUInfo()
+ return self.isAArch64() and self.isSupported(cpu_feature.SME)
def isAArch64SME2(self):
# If you have sme2, you also have sme.
- return self.isAArch64() and "sme2" in self.getCPUInfo()
+ return self.isAArch64() and self.isSupported(cpu_feature.SME2)
def isAArch64SMEFA64(self):
# smefa64 allows the use of the full A64 instruction set in streaming
# mode. This is required by certain test programs to setup register
# state.
- cpuinfo = self.getCPUInfo()
- return self.isAArch64() and "sme" in cpuinfo and "smefa64" in cpuinfo
----------------
yln wrote:
Note that `cpuinfo` here is just the contents of `/proc/cpuinfo` as a string (not a collection of flags). So testing with a prefix/substring will always be trivially true (and is nonsensical), e.g., `sme` will automatically be true if `sme2` or `smefa64` is present. I did not change the behavior of this.
One way to fix this would be to parse and merge the CPU flags in `cpuinfo` and use exact match on that set of flags.
https://github.com/llvm/llvm-project/pull/153914
More information about the lldb-commits
mailing list