Skip to content

Commit

Permalink
Add numeric negation
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw committed Oct 13, 2014
1 parent 03ac9a7 commit e75de84
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/jit/emit_x64.dasc
Expand Up @@ -735,6 +735,17 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitGraph *jg,
| mov WORK[dst], rax;
break;
}
case MVM_OP_neg_n: {
/* Negation is xor-ing the highest byte. Pretty simple right */
MVMint16 dst = ins->operands[0].reg.orig;
MVMint16 src = ins->operands[1].reg.orig;
| mov TMP1, 1;
| sal TMP1, 63;
| mov TMP2, qword WORK[src];
| xor TMP2, TMP1;
| mov qword WORK[dst], TMP2;
break;
}
case MVM_OP_eq_i:
case MVM_OP_eqaddr:
case MVM_OP_ne_i:
Expand Down
1 change: 1 addition & 0 deletions src/jit/graph.c
Expand Up @@ -658,6 +658,7 @@ static MVMint32 jgb_consume_ins(MVMThreadContext *tc, JitGraphBuilder *jgb,
case MVM_OP_sub_n:
case MVM_OP_mul_n:
case MVM_OP_div_n:
case MVM_OP_neg_n:
/* number coercion */
case MVM_OP_coerce_ni:
case MVM_OP_coerce_in:
Expand Down

0 comments on commit e75de84

Please sign in to comment.