Check if a certain CPU feature is supported by the platform and compiler. Parameters ---------- name : str CPU feature name in uppercase. force_flags : list or None, optional If None(default), default compiler flags for every CPU fea
(self, name, force_flags=None, macros=[])
| 1578 | |
| 1579 | @_Cache.me |
| 1580 | def feature_is_supported(self, name, force_flags=None, macros=[]): |
| 1581 | """ |
| 1582 | Check if a certain CPU feature is supported by the platform and compiler. |
| 1583 | |
| 1584 | Parameters |
| 1585 | ---------- |
| 1586 | name : str |
| 1587 | CPU feature name in uppercase. |
| 1588 | |
| 1589 | force_flags : list or None, optional |
| 1590 | If None(default), default compiler flags for every CPU feature will |
| 1591 | be used during test. |
| 1592 | |
| 1593 | macros : list of tuples, optional |
| 1594 | A list of C macro definitions. |
| 1595 | """ |
| 1596 | assert(name.isupper()) |
| 1597 | assert(force_flags is None or isinstance(force_flags, list)) |
| 1598 | |
| 1599 | supported = name in self.feature_supported |
| 1600 | if supported: |
| 1601 | for impl in self.feature_implies(name): |
| 1602 | if not self.feature_test(impl, force_flags, macros=macros): |
| 1603 | return False |
| 1604 | if not self.feature_test(name, force_flags, macros=macros): |
| 1605 | return False |
| 1606 | return supported |
| 1607 | |
| 1608 | @_Cache.me |
| 1609 | def feature_can_autovec(self, name): |
no test coverage detected