Fix generated code for ISA predicates on encoding recipes.

The generated code had syntax errors and inverted logic.

Add an SSE 4.1 requirement to the floating point rounding instructions.
This commit is contained in:
Jakob Stoklund Olesen
2017-12-08 10:22:01 -08:00
parent 362a4bdc4c
commit f03729d742
4 changed files with 14 additions and 8 deletions

View File

@@ -169,15 +169,19 @@ def emit_recipe_predicates(isa, fmt):
# Generate the predicate function.
with fmt.indented(
'fn {}({}: ::settings::PredicateView, '
'inst: &ir::InstructionData) -> bool {{'
'{}: &ir::InstructionData) -> bool {{'
.format(
name,
'isap' if isap else '_'), '}'):
'isap' if isap else '_',
'inst' if instp else '_'), '}'):
if isap:
n = isa.settings.predicate_number[isap]
with fmt.indented('if isap.test({})'.format(n), '}'):
with fmt.indented('if !isap.test({}) {{'.format(n), '}'):
fmt.line('return false;')
emit_instp(instp, fmt)
if instp:
emit_instp(instp, fmt)
else:
fmt.line('true')
# Generate the static table.
with fmt.indented(

View File

@@ -13,6 +13,7 @@ from base.formats import Ternary, FuncAddr, UnaryGlobalVar
from base.formats import RegMove, RegSpill, RegFill, CopySpecial
from .registers import GPR, ABCD, FPR, GPR8, FPR8, FLAG, StackGPR32, StackFPR32
from .defs import supported_floatccs
from .settings import use_sse41
try:
from typing import Tuple, Dict, Sequence, Any # noqa
@@ -372,6 +373,7 @@ rfurm = TailRecipe(
# XX /r, RMI form for one of the roundXX SSE 4.1 instructions.
furmi_rnd = TailRecipe(
'furmi_rnd', Unary, size=2, ins=FPR, outs=FPR,
isap=use_sse41,
emit='''
PUT_OP(bits, rex2(in_reg0, out_reg0), sink);
modrm_rr(in_reg0, out_reg0, sink);