Skip to content

Commit

Permalink
Removed inc/dec instructions because usage not recommended.
Browse files Browse the repository at this point in the history
  • Loading branch information
maximecb authored and XrXr committed Oct 20, 2021
1 parent 5f4e30b commit 12283c5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 38 deletions.
26 changes: 0 additions & 26 deletions ujit_asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,19 +900,6 @@ void cqo(codeblock_t* cb)
cb_write_bytes(cb, 2, 0x48, 0x99);
}

// dec - Decrement integer by 1
void dec(codeblock_t* cb, x86opnd_t opnd)
{
write_rm_unary(
cb,
"dec",
0xFE, // opMemReg8
0xFF, // opMemRegPref
0x01, // opExt
opnd
);
}

/*
// div - Unsigned integer division
alias div = writeRMUnary!(
Expand Down Expand Up @@ -1011,19 +998,6 @@ void imul(CodeBlock cb, X86Opnd opnd0, X86Opnd opnd1, X86Opnd opnd2)
}
*/

// inc - Increment integer by 1
void inc(codeblock_t* cb, x86opnd_t opnd)
{
write_rm_unary(
cb,
"inc",
0xFE, // opMemReg8
0xFF, // opMemRegPref
0x00, // opExt
opnd
);
}

/// jcc - relative jumps to a label
void ja (codeblock_t* cb, size_t label_idx) { cb_write_jcc(cb, "ja" , 0x0F, 0x87, label_idx); }
void jae (codeblock_t* cb, size_t label_idx) { cb_write_jcc(cb, "jae" , 0x0F, 0x83, label_idx); }
Expand Down
2 changes: 0 additions & 2 deletions ujit_asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ void cmovz(codeblock_t* cb, x86opnd_t dst, x86opnd_t src);
void cmp(codeblock_t* cb, x86opnd_t opnd0, x86opnd_t opnd1);
void cdq(codeblock_t* cb);
void cqo(codeblock_t* cb);
void dec(codeblock_t* cb, x86opnd_t opnd);
void inc(codeblock_t* cb, x86opnd_t opnd);
void ja(codeblock_t* cb, size_t label_idx);
void jae(codeblock_t* cb, size_t label_idx);
void jb(codeblock_t* cb, size_t label_idx);
Expand Down
10 changes: 0 additions & 10 deletions ujit_asm_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ void run_tests()
// cqo
cb_set_pos(cb, 0); cqo(cb); check_bytes(cb, "4899");

// dec
cb_set_pos(cb, 0); dec(cb, CX); check_bytes(cb, "66FFC9");
cb_set_pos(cb, 0); dec(cb, EDX); check_bytes(cb, "FFCA");

// div
/*
test(
Expand All @@ -132,12 +128,6 @@ void run_tests()
);
*/

// inc
cb_set_pos(cb, 0); inc(cb, BL); check_bytes(cb, "FEC3");
cb_set_pos(cb, 0); inc(cb, ESP); check_bytes(cb, "FFC4");
cb_set_pos(cb, 0); inc(cb, mem_opnd(32, RSP, 0)); check_bytes(cb, "FF0424");
cb_set_pos(cb, 0); inc(cb, mem_opnd(64, RSP, 4)); check_bytes(cb, "48FF442404");

// jcc
{
cb_set_pos(cb, 0);
Expand Down

0 comments on commit 12283c5

Please sign in to comment.