Skip to content

Commit

Permalink
jit floor_n
Browse files Browse the repository at this point in the history
not sure if round mode 9 is actually correct. The
compiler explorer claims that's what gcc gives for
`(double) round(foo)`. I only see values 0 through 3
explained on the 'net.
  • Loading branch information
timo committed Apr 8, 2018
1 parent fa16746 commit a206cd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/jit/graph.c
Expand Up @@ -1513,6 +1513,7 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
case MVM_OP_div_n:
case MVM_OP_neg_n:
/* number coercion */
case MVM_OP_floor_n:
case MVM_OP_coerce_ni:
case MVM_OP_coerce_in:
case MVM_OP_extend_i32:
Expand Down
8 changes: 8 additions & 0 deletions src/jit/x64/emit.dasc
Expand Up @@ -1106,6 +1106,14 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJ
| movsd qword WORK[reg_a], xmm0;
break;
}
case MVM_OP_floor_n: {
MVMint16 dst = ins->operands[0].reg.orig;
MVMint16 src = ins->operands[1].reg.orig;
| movsd xmm0, qword WORK[src];
| roundsd xmm0, xmm0, 9;
| movsd qword WORK[dst], xmm0;
break;
}
case MVM_OP_coerce_in: {
MVMint16 dst = ins->operands[0].reg.orig;
MVMint16 src = ins->operands[1].reg.orig;
Expand Down

0 comments on commit a206cd8

Please sign in to comment.