Generate type check predicates for secondary type variables.

The encoding tables are keyed by the controlling type variable only. We
need to distinguish different encodings for instructions with multiple
type variables.

Add a TypePredicate instruction predicate which can check the type of an
instruction value operand. Combine type checks into the instruction
predicate for instructions with more than one type variable.

Add Intel encodings for fcvt_from_sint.f32.i64 which can now be
distinguished from fcvt_from_sint.f32.i32.
This commit is contained in:
Jakob Stoklund Olesen
2017-07-26 08:12:16 -07:00
parent 637966dc7f
commit 84aeb3eb56
9 changed files with 156 additions and 32 deletions

View File

@@ -1,7 +1,7 @@
"""Defining instruction set architectures."""
from __future__ import absolute_import
from collections import OrderedDict
from .predicates import And
from .predicates import And, TypePredicate
from .registers import RegClass, Register, Stack
from .ast import Apply
from .types import ValueType
@@ -405,6 +405,13 @@ class Encoding(object):
self.recipe = recipe
self.encbits = encbits
# Add secondary type variables to the instruction predicate.
if len(self.typevars) > 1:
for tv, vt in zip(self.inst.other_typevars, self.typevars[1:]):
typred = TypePredicate.typevar_check(self.inst, tv, vt)
instp = And.combine(instp, typred)
# Record specific predicates. Note that the recipe also has predicates.
self.instp = instp
self.isap = isap