From 27603b9980062c33f163e3baf6cf348099fd57b1 Mon Sep 17 00:00:00 2001 From: lemon Date: Tue, 14 Oct 2025 22:07:05 +0200 Subject: amd64: not, udiv --- amd64/emit.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'amd64') diff --git a/amd64/emit.c b/amd64/emit.c index 490f21f..b38141b 100644 --- a/amd64/emit.c +++ b/amd64/emit.c @@ -584,10 +584,17 @@ DEFINSTR1(Xdec, DEFINSTR1(Xneg, {4|8, PGPR, 0, "\xF7", EN_R, .ext=3} /* NEG r32/64 */ ) +DEFINSTR1(Xnot, + {4|8, PGPR, 0, "\xF7", EN_R, .ext=2} /* NEG r32/64 */ +) DEFINSTR1(Xidiv, {4|8, PGPR, 0, "\xF7", EN_R, .ext=7}, /* IDIV r32/64 */ {4|8, PMEM, 0, "\xF7", EN_M, .ext=7}, /* IDIV m32/64 */ ) +DEFINSTR1(Xdiv, + {4|8, PGPR, 0, "\xF7", EN_R, .ext=6}, /* DIV r32/64 */ + {4|8, PMEM, 0, "\xF7", EN_M, .ext=6}, /* DIV m32/64 */ +) DEFINSTR1(Xcall, {-1, PSYM, 0, "\xE8", EN_R32, .norexw=1}, /* CALL rel32 */ {-1, PGPR, 0, "\xFF", EN_R, .ext=2, .norexw=1}, /* CALL r64 */ @@ -923,6 +930,7 @@ emitinstr(uchar **pcode, struct function *fn, struct block *blk, int curi, struc case Oxinc: X1 = Xinc; goto ALU1; case Oxdec: X1 = Xdec; goto ALU1; case Oneg: X1 = Xneg; goto ALU1; + case Onot: X1 = Xnot; goto ALU1; ALU1: dst = mkregoper(ins->l); assert(ins->reg-1 == dst.reg); @@ -949,6 +957,11 @@ emitinstr(uchar **pcode, struct function *fn, struct block *blk, int curi, struc break; } break; + case Oudiv: + DS("\x31\xD2"); /* XOR EDX,EDX */ + assert(mkregoper(ins->l).reg == RAX); + Xdiv(pcode, cls, mkdatregoper(ins->r)); + break; case Oequ: case Oneq: case Olth: case Ogth: case Olte: case Ogte: case Oulth: case Ougth: case Oulte: case Ougte: -- cgit v1.2.3