Implement the increment and decrement instructions, and the two operand form of signed multiplication.

--HG--
extra : convert_revision : d87df4b1b5470bed1d963dfe8e2ffa1403718342
This commit is contained in:
Gabe Black 2007-07-20 14:59:14 -07:00
parent ec5f66190e
commit d926de462a
2 changed files with 66 additions and 2 deletions

View file

@ -53,7 +53,47 @@
#
# Authors: Gabe Black
microcode = ""
microcode = '''
def macroop INC_R
{
addi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
};
def macroop INC_M
{
ld t1, ds, [scale, index, base], disp
addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
st t1, ds, [scale, index, base], disp
};
def macroop INC_P
{
rdip t7
ld t1, ds, [0, t0, t7], disp
addi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
st t1, ds, [0, t0, t7], disp
};
def macroop DEC_R
{
subi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
};
def macroop DEC_M
{
ld t1, ds, [scale, index, base], disp
subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
st t1, ds, [scale, index, base], disp
};
def macroop DEC_P
{
rdip t7
ld t1, ds, [0, t0, t7], disp
subi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
st t1, ds, [0, t0, t7], disp
};
'''
#let {{
# class DEC(Inst):
# "GenFault ${new UnimpInstFault}"

View file

@ -53,7 +53,31 @@
#
# Authors: Gabe Black
microcode = ""
microcode = '''
#
# Two operand signed multiply. These should set the CF and OF flags if the
# result is too large for the destination register
#
def macroop IMUL_R_R
{
mul1s reg, reg, regm
};
def macroop IMUL_R_M
{
ld t1, ds, [scale, index, base], disp
mul1s reg, reg, t1
};
def macroop IMUL_R_P
{
rdip t7
ld t1, ds, [scale, index, base], disp
mul1s reg, reg, t1
};
'''
#let {{
# class MUL(Inst):
# "GenFault ${new UnimpInstFault}"