i386-asm: fix imul

With imul the 3rd operand defaults to the 2nd on.  The previous
logic left 'op_type[2]' uninitialized which caused the bug to
show up only sometimes.
This commit is contained in:
grischka 2009-12-06 17:41:22 +01:00
parent 56d6abdb3d
commit e500c9118a

View File

@ -676,10 +676,11 @@ static void asm_opcode(TCCState *s1, int opcode)
g(seg_prefix);
v = pa->opcode;
if (v == 0x69 || v == 0x69) {
if ((v == 0x69 || v == 0x6b) && nb_ops == 2) {
/* kludge for imul $im, %reg */
nb_ops = 3;
ops[2] = ops[1];
op_type[2] = op_type[1];
} else if (v == 0xcd && ops[0].e.v == 3 && !ops[0].e.sym) {
v--; /* int $3 case */
nb_ops = 0;