Add support for setting presets.

Fixes #11.

Presets are groups of settings and values applied at once. This is used
as a shorthand in test files, so for example "isa intel nehalem" enables
all of the CPUID bits that the Nehalem micro-architecture provides.
This commit is contained in:
Jakob Stoklund Olesen
2017-07-13 14:49:17 -07:00
parent 89634fa645
commit 4bb0e2014c
10 changed files with 213 additions and 33 deletions

View File

@@ -2,7 +2,7 @@
Intel settings.
"""
from __future__ import absolute_import
from cdsl.settings import SettingGroup, BoolSetting
from cdsl.settings import SettingGroup, BoolSetting, Preset
from cdsl.predicates import And
import base.settings as shared
from .defs import ISA
@@ -38,4 +38,10 @@ use_popcnt = And(has_popcnt, has_sse42)
use_bmi1 = And(has_bmi1)
use_lzcnt = And(has_lzcnt)
# Presets corresponding to Intel CPUs.
nehalem = Preset(
has_sse2, has_sse3, has_ssse3, has_sse41, has_sse42, has_popcnt)
haswell = Preset(nehalem, has_bmi1, has_lzcnt)
ISA.settings.close(globals())