Add RISC-V encodings for supported icmp variants.

Only slt and ult variants are in the instruction set. Other condition
codes must be synthesized.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-31 12:12:09 -07:00
parent 75b156e1c7
commit e9907fbdd6
5 changed files with 69 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ instruction formats described in the reference:
from __future__ import absolute_import
from cdsl.isa import EncRecipe
from cdsl.predicates import IsSignedInt
from base.formats import Binary, BinaryImm, MultiAry
from base.formats import Binary, BinaryImm, MultiAry, IntCompare
from .registers import GPR
# The low 7 bits of a RISC-V instruction is the base opcode. All 32-bit
@@ -79,6 +79,9 @@ R = EncRecipe('R', Binary, ins=(GPR, GPR), outs=GPR)
# R-type with an immediate shift amount instead of rs2.
Rshamt = EncRecipe('Rshamt', BinaryImm, ins=GPR, outs=GPR)
# R-type encoding of an integer comparison.
Ricmp = EncRecipe('Ricmp', IntCompare, ins=(GPR, GPR), outs=GPR)
I = EncRecipe(
'I', BinaryImm, ins=GPR, outs=GPR,
instp=IsSignedInt(BinaryImm.imm, 12))