This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [lit] Add feature flags for native CPU features
ClosedPublic

Authored by mgorny on Apr 24 2019, 8:53 AM.

Details

Summary

Add a new lit-cpuid tool that detects CPU features used by some of
the tests, and use it to populate available_features in lit. For now,
this means that the test for MM/XMM register read will be run only
when the host CPU support SSE instruction set. However, this is going
to make it possible to introduce additional tests relying on AVX.

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Apr 24 2019, 8:53 AM
labath added a subscriber: JDevlieghere.

I like this approach, but as this is a novel idea, I'd like to get more opinions first. @JDevlieghere, what do you think?

lldb/lit/lit.cfg.py
81 ↗(On Diff #196467)

So if the binary is not found for any reason, this will just silently skip the relevant tests, right? Would it make sense to at least print a warning in this case?

mgorny marked an inline comment as done.Apr 25 2019, 9:27 AM
mgorny added inline comments.
lldb/lit/lit.cfg.py
81 ↗(On Diff #196467)

Yes, it will skip them. I don't have an opinion on whether it's something we should warn about; but I can surely add one.

JDevlieghere accepted this revision.Apr 25 2019, 9:37 AM

I really like this too, it's conceptually simple, easy to use and allows us to write more tests in lit. Thanks for doing this Michał.

lldb/lit/lit.cfg.py
81 ↗(On Diff #196467)

I agree it would be good to print a warning. We're the ones building the tool so there's really no good reason for it not to be found.

This revision is now accepted and ready to land.Apr 25 2019, 9:37 AM
mgorny updated this revision to Diff 196675.Apr 25 2019, 10:38 AM

Added warnings for missing or failed lit-cpuid. Not that there any failure conditions in the program right now ;-).

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2019, 6:19 AM